Wrote all the Tests for the Scanner UI

This commit is contained in:
2025-12-03 21:13:59 +01:00
parent 79df3d300e
commit 2af4f4b7a4
4 changed files with 57 additions and 6 deletions

View File

@@ -26,11 +26,14 @@ public class AssignmentManager {
workerMap.put(workerIdCounter, worker);
return workerIdCounter;
}
public void removeWorker(int workerId) {
workerMap.remove(workerId);
}
public int addTask(int workerId, String name, String description) {
if (!workerMap.containsKey(workerId) || name == null || description == null) {
throw new IllegalArgumentException("WorkerId must exist and name or description can't be null");
}
Task task = new Task(++taskIdCounter, workerId, name, description, this);
Task task = new Task(++taskIdCounter, workerId, name, description);
taskMap.put(taskIdCounter, task);
return taskIdCounter;
}

View File

@@ -5,10 +5,8 @@ public class Task {
String description;
int taskId;
int workerId;
AssignmentManager manager;
TaskState state;
public Task(int taskId, int workerId, String name, String description, AssignmentManager manager) {
this.manager = manager;
public Task(int taskId, int workerId, String name, String description) {
this.name = name;
this.description = description;
this.taskId = taskId;