Added Tests for TaskState Changes. Actually added functionality to pass that test.

This commit is contained in:
2025-12-03 19:20:24 +01:00
parent 20daf315ca
commit 7640b1ef35
33 changed files with 122 additions and 59 deletions

View File

@@ -54,4 +54,19 @@ public class AssignmentManager {
}
taskMap.remove(taskId);
}
public void finishTask(int workerId, int taskId) {
if (!workerMap.containsKey(workerId) || !taskMap.containsKey(taskId)) {
throw new IllegalArgumentException("Task Id or Worker Id does not exist");
}
Task task = taskMap.get(taskId);
task.setTaskState(TaskState.FINISHED);
}
public void unfinishTask(int workerId, int taskId) {
if (!workerMap.containsKey(workerId) || !taskMap.containsKey(taskId)) {
throw new IllegalArgumentException("Task Id or Worker Id does not exist");
}
Task task = taskMap.get(taskId);
task.setTaskState(TaskState.IN_PROGRESS);
}
}