Compare commits
5 Commits
0c4f092312
...
Worker
| Author | SHA1 | Date | |
|---|---|---|---|
| 4bb1e13f21 | |||
| 8c4849fdf0 | |||
| a5378868ea | |||
| 9641825200 | |||
| d5a9825ec1 |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,2 +1,2 @@
|
||||
#Wed Dec 03 16:01:53 CET 2025
|
||||
gradle.version=9.1.0
|
||||
#Wed Dec 03 17:27:55 CET 2025
|
||||
gradle.version=8.14
|
||||
|
||||
@@ -36,6 +36,11 @@ sourceSets {
|
||||
|
||||
test {
|
||||
useJUnitPlatform()
|
||||
testLogging {
|
||||
events "passed", "skipped", "failed"
|
||||
exceptionFormat "full"
|
||||
showStandardStreams = true
|
||||
}
|
||||
finalizedBy jacocoTestReport
|
||||
}
|
||||
jacocoTestReport {
|
||||
|
||||
BIN
build/classes/java/main/hhn/temp/project/AssignmentManager.class
Normal file
BIN
build/classes/java/main/hhn/temp/project/AssignmentManager.class
Normal file
Binary file not shown.
Binary file not shown.
BIN
build/classes/java/main/hhn/temp/project/Task.class
Normal file
BIN
build/classes/java/main/hhn/temp/project/Task.class
Normal file
Binary file not shown.
BIN
build/classes/java/main/hhn/temp/project/TaskState.class
Normal file
BIN
build/classes/java/main/hhn/temp/project/TaskState.class
Normal file
Binary file not shown.
BIN
build/classes/java/main/hhn/temp/project/Worker.class
Normal file
BIN
build/classes/java/main/hhn/temp/project/Worker.class
Normal file
Binary file not shown.
BIN
build/classes/java/main/hhn/temp/project/provider/Database.class
Normal file
BIN
build/classes/java/main/hhn/temp/project/provider/Database.class
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
663
build/reports/problems/problems-report.html
Normal file
663
build/reports/problems/problems-report.html
Normal file
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
@@ -1,4 +0,0 @@
|
||||
package hhn.temp.project;
|
||||
|
||||
public class Admin extends Worker{
|
||||
}
|
||||
@@ -1,12 +1,22 @@
|
||||
package hhn.temp.project;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class AssignmentManager {
|
||||
List<Worker> workerList;
|
||||
Map<Integer, Worker> workerMap;
|
||||
int workerIdCounter;
|
||||
|
||||
public AssignmentManager() {
|
||||
workerList = new ArrayList<>();
|
||||
workerMap = new HashMap<>();
|
||||
int workerIdCounter = 1000;
|
||||
}
|
||||
|
||||
public int createWorker(String name) {
|
||||
Worker worker = new Worker(name, ++workerIdCounter);
|
||||
workerMap.put(workerIdCounter, worker);
|
||||
return workerIdCounter;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,17 @@
|
||||
package hhn.temp.project;
|
||||
|
||||
public class Worker {
|
||||
String name;
|
||||
int workerId;
|
||||
public Worker(String name, int workerId) {
|
||||
this.name = name;
|
||||
this.workerId = workerId;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public int getId() {
|
||||
return workerId;
|
||||
}
|
||||
}
|
||||
|
||||
38
test/hhn/temp/project/BadCasesTest.java
Normal file
38
test/hhn/temp/project/BadCasesTest.java
Normal file
@@ -0,0 +1,38 @@
|
||||
package hhn.temp.project;
|
||||
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
public class BadCasesTest {
|
||||
AssignmentManager manager;
|
||||
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
manager = new AssignmentManager();
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("Assert that added tasks can't be Null")
|
||||
public void assertNewTasksAreNotNull() {
|
||||
int workerId = manager.createWorker("Alfred");
|
||||
assertThrows(manager.addTask(workerId, null, null) instanceof IllegalArgumentException);
|
||||
}
|
||||
@Test
|
||||
@DisplayName("Assert List isn't empty after adding a task")
|
||||
public void assertListNowEmptyAfterAdd() {
|
||||
int workerId = manager.createWorker("Alfred");
|
||||
int taskId = manager.addTask(workerId, "Run", "Jog 10 Miles");
|
||||
assertTrue(manager.getTaskList().size >= 1);
|
||||
}
|
||||
@Test
|
||||
@DisplayName("Assert only existing tasks can be edited")
|
||||
public void assertEditOnlyExistingTasks() {
|
||||
int workerId = manager.createWorker("Alfred");
|
||||
assertThrows(manager.editTask(workerId, 99969, "I", "am Illegal") instanceof IllegalArgumentException);
|
||||
}
|
||||
|
||||
}
|
||||
62
test/hhn/temp/project/GoodCasesTest.java
Normal file
62
test/hhn/temp/project/GoodCasesTest.java
Normal file
@@ -0,0 +1,62 @@
|
||||
package hhn.temp.project;
|
||||
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
public class GoodCasesTest {
|
||||
AssignmentManager manager;
|
||||
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
manager = new AssignmentManager();
|
||||
}
|
||||
@Test
|
||||
@DisplayName("Assert that a Worker can add a Task")
|
||||
public void assertWorkerCanAddTask() {
|
||||
int workerId = manager.createWorker("Alfred");
|
||||
int taskId = manager.addTask(workerId, "Run", "Jog 10 Miles");
|
||||
assertNotNull(manager.getTask(taskId));
|
||||
assertEquals(manager.getTask(taskId).getName(), "Run");
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("Assert that added Tasks are added to the List")
|
||||
public void assertTasksShowInList() {
|
||||
int sizeCount = manager.getTaskList().size();
|
||||
int workerId = manager.createWorker("Alfred");
|
||||
int taskId = manager.addTask(workerId, "Run", "Jog 10 Miles");
|
||||
assertEquals(sizeCount + 1, manager.getTaskList().size);
|
||||
}
|
||||
@Test
|
||||
@DisplayName("Assert existing Tasks can be edited")
|
||||
public void assertExistingTasksCanBeEdited() {
|
||||
int workerId = manager.createWorker("Alfred");
|
||||
int taskId = manager.addTask(workerId, "Run", "Jog 10 Miles");
|
||||
manager.editTask(workerId, taskId, "Walk", "Walk 3 Miles");
|
||||
assertEquals(manager.getTask(taskId).getName(), "Walk");
|
||||
assertEquals(manager.getTask(taskId).getDescription(), "Walk 3 Miles");
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("Assert that Worker can remove Task")
|
||||
public void assertWorkerCanRemoveOwnTask() {
|
||||
int sizeCount = manager.getTaskList().size();
|
||||
int workerId = manager.createWorker("Alfred");
|
||||
int taskId = manager.addTask(workerId, "Run", "Jog 10 Miles");
|
||||
assertEquals(sizeCount + 1, manager.getTaskList().size);
|
||||
manager.removeTask(taskId);
|
||||
assertEquals(sizeCount - 1, manager.getTaskList().size);
|
||||
}
|
||||
@Test
|
||||
@DisplayName("Assert deleted Tasks no longer show up in the List")
|
||||
public void assertDeletedTasksDisappear() {
|
||||
int workerId = manager.createWorker("Alfred");
|
||||
int taskId = manager.addTask(workerId, "Run", "Jog 10 Miles");
|
||||
manager.removeTask(taskId);
|
||||
assertThrows(manager.getTask(taskId) instanceof IllegalArgumentException);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
package java;
|
||||
|
||||
import hhn.temp.project.AssignmentManager;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Assertions.*;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class BadCasesTest {
|
||||
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
AssignmentManager manager = new AssignmentManager();
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("Assert that added tasks can't be Null")
|
||||
public void assertNewTasksAreNotNull() {
|
||||
|
||||
}
|
||||
@Test
|
||||
@DisplayName("Assert List isn't empty after adding a task")
|
||||
public void assertListNowEmptyAfterAdd() {
|
||||
|
||||
}
|
||||
@Test
|
||||
@DisplayName("Assert only existing tasks can be edited")
|
||||
public void assertEditOnlyExistingTasks() {
|
||||
|
||||
}
|
||||
@Test
|
||||
@DisplayName("Assert Worker can only edit own tasks")
|
||||
public void assertWorkerMayOnlyEditOwnTasks() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
package java;
|
||||
|
||||
import hhn.temp.project.AssignmentManager;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Assertions.*;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
public class GoodCasesTest {
|
||||
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
AssignmentManager manager = new AssignmentManager();
|
||||
}
|
||||
@Test
|
||||
@DisplayName("Assert that a Worker can add a Task")
|
||||
public void assertWorkerCanAddTask() {
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("Assert that added Tasks are added to the List")
|
||||
public void assertTasksShowInList() {
|
||||
|
||||
}
|
||||
@Test
|
||||
@DisplayName("Assert existing Tasks can be edited")
|
||||
public void assertExistingTasksCanBeEdited() {
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("Assert that Worker can remove own Task")
|
||||
public void assertWorkerCanRemoveOwnTask() {
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("Assert that Admin can remove every Task")
|
||||
public void assertAdminCanRemoveEveryTask() {
|
||||
|
||||
}
|
||||
@Test
|
||||
@DisplayName("Assert deleted Tasks no longer show up in the List")
|
||||
public void assertDeletedTasksDisappear() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user