Added Tests for TaskState Changes. Actually added functionality to pass that test.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user