Wrote all the Tests for the Scanner UI
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user