Compare commits
5 Commits
26f7ecbee6
...
TestImplem
| Author | SHA1 | Date | |
|---|---|---|---|
| 7d05bb921a | |||
| 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
|
#Wed Dec 03 17:27:55 CET 2025
|
||||||
gradle.version=9.1.0
|
gradle.version=8.14
|
||||||
|
|||||||
@@ -36,6 +36,11 @@ sourceSets {
|
|||||||
|
|
||||||
test {
|
test {
|
||||||
useJUnitPlatform()
|
useJUnitPlatform()
|
||||||
|
testLogging {
|
||||||
|
events "passed", "skipped", "failed"
|
||||||
|
exceptionFormat "full"
|
||||||
|
showStandardStreams = true
|
||||||
|
}
|
||||||
finalizedBy jacocoTestReport
|
finalizedBy jacocoTestReport
|
||||||
}
|
}
|
||||||
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{
|
|
||||||
}
|
|
||||||
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
70
test/hhn/temp/project/GoodCasesTest.java
Normal file
70
test/hhn/temp/project/GoodCasesTest.java
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
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);
|
||||||
|
}
|
||||||
|
@Test
|
||||||
|
@DisplayName("Check Getters")
|
||||||
|
public void assertGettersWorkCorrectly() {
|
||||||
|
int workerId = manager.createWorker("Alfred");
|
||||||
|
assertEquals(manager.workerMap.get(workerId).getName(), "Alfred");
|
||||||
|
//This one may be somewhat nonsensical, but it ensures the getId works so one may iterate over the workerMap
|
||||||
|
assertEquals(manager.workerMap.get(workerId).getId(), workerId);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -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