Wrote all the Tests for the Scanner UI
This commit is contained in:
@@ -52,4 +52,20 @@ public class BadCasesTest {
|
||||
assertThrows(IllegalArgumentException.class, () -> manager.finishTask(20405, 21034));
|
||||
assertThrows(IllegalArgumentException.class, () -> manager.unfinishTask(20405, 21034));
|
||||
}
|
||||
@Test
|
||||
@DisplayName("Assert that removing a non-existent worker throws an Exception")
|
||||
public void assertRemovingNonExistentWorkerFails() {
|
||||
assertThrows(IllegalArgumentException.class, () -> manager.removeWorker(34054));
|
||||
}
|
||||
@Test
|
||||
@DisplayName("Assert non-existent commands are recognized as such")
|
||||
public void assertInvalidCommandsDontCrash() {
|
||||
int workerId = manager.createWorker("Alfred");
|
||||
int taskId = manager.addTask(workerId, "Run", "Jog 10 Miles");
|
||||
try {
|
||||
manager.getUserCommands().handleInput("baum");
|
||||
} catch (Exception e) {
|
||||
fail("Should not crash just because a command is invalid");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user