Files
GseTDDUebungKCLR/test/hhn/temp/project/BadCasesTest.java

39 lines
1.3 KiB
Java

package hhn.temp.project;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
public class BadCasesTest {
AssignmentManager manager;
@BeforeEach
public void setup() {
manager = new AssignmentManager();
}
@Test
@DisplayName("Assert that added tasks can't be Null")
public void assertNewTasksAreNotNull() {
int workerId = manager.createWorker("Alfred");
assertThrows(manager.addTask(workerId, null, null) instanceof IllegalArgumentException);
}
@Test
@DisplayName("Assert List isn't empty after adding a task")
public void assertListNowEmptyAfterAdd() {
int workerId = manager.createWorker("Alfred");
int taskId = manager.addTask(workerId, "Run", "Jog 10 Miles");
assertTrue(manager.getTaskList().size >= 1);
}
@Test
@DisplayName("Assert only existing tasks can be edited")
public void assertEditOnlyExistingTasks() {
int workerId = manager.createWorker("Alfred");
assertThrows(manager.editTask(workerId, 99969, "I", "am Illegal") instanceof IllegalArgumentException);
}
}