Wrote the first BadCasesTests
This commit is contained in:
@@ -4,27 +4,35 @@ 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() {
|
||||
AssignmentManager manager = new AssignmentManager();
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user