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.DisplayName;
|
||||||
import org.junit.jupiter.api.Test;
|
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 {
|
public class BadCasesTest {
|
||||||
|
AssignmentManager manager;
|
||||||
|
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
public void setup() {
|
public void setup() {
|
||||||
AssignmentManager manager = new AssignmentManager();
|
manager = new AssignmentManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@DisplayName("Assert that added tasks can't be Null")
|
@DisplayName("Assert that added tasks can't be Null")
|
||||||
public void assertNewTasksAreNotNull() {
|
public void assertNewTasksAreNotNull() {
|
||||||
|
int workerId = manager.createWorker("Alfred");
|
||||||
|
assertThrows(manager.addTask(workerId, null, null) instanceof IllegalArgumentException);
|
||||||
}
|
}
|
||||||
@Test
|
@Test
|
||||||
@DisplayName("Assert List isn't empty after adding a task")
|
@DisplayName("Assert List isn't empty after adding a task")
|
||||||
public void assertListNowEmptyAfterAdd() {
|
public void assertListNowEmptyAfterAdd() {
|
||||||
|
int workerId = manager.createWorker("Alfred");
|
||||||
|
int taskId = manager.addTask(workerId, "Run", "Jog 10 Miles");
|
||||||
|
assertTrue(manager.getTaskList().size >= 1);
|
||||||
}
|
}
|
||||||
@Test
|
@Test
|
||||||
@DisplayName("Assert only existing tasks can be edited")
|
@DisplayName("Assert only existing tasks can be edited")
|
||||||
public void assertEditOnlyExistingTasks() {
|
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