Wrote the first GoodCasesTests
This commit is contained in:
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
|
||||||
|
|||||||
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.
BIN
build/classes/java/test/hhn/temp/project/BadCasesTest.class
Normal file
BIN
build/classes/java/test/hhn/temp/project/BadCasesTest.class
Normal file
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,8 +1,6 @@
|
|||||||
package java;
|
package hhn.temp.project;
|
||||||
|
|
||||||
import hhn.temp.project.AssignmentManager;
|
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.Assertions.*;
|
|
||||||
import org.junit.jupiter.api.DisplayName;
|
import org.junit.jupiter.api.DisplayName;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
@@ -28,11 +26,5 @@ public class BadCasesTest {
|
|||||||
public void assertEditOnlyExistingTasks() {
|
public void assertEditOnlyExistingTasks() {
|
||||||
|
|
||||||
}
|
}
|
||||||
@Test
|
|
||||||
@DisplayName("Assert Worker can only edit own tasks")
|
|
||||||
public void assertWorkerMayOnlyEditOwnTasks() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
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,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