This commit is contained in:
Jan-Philipp Luithardt
2025-12-03 14:19:26 +01:00
parent 62745621f9
commit 835bd912df
36 changed files with 90 additions and 36 deletions

View File

@@ -2,6 +2,7 @@ package project;
import hhn.temp.project.Main;
import hhn.temp.project.Task;
import hhn.temp.project.TaskManager;
import hhn.temp.project.expections.TaskAlreadyExistsException;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
@@ -26,9 +27,17 @@ public class BadCaseTaskTest {
assertThrows(IllegalArgumentException.class,() -> taskManager.createTask(null, ""));
assertThrows(IllegalArgumentException.class,() -> taskManager.createTask(null, null));
assertThrows(IllegalArgumentException.class,() -> taskManager.createTask("", ""));
assertThrows(IllegalArgumentException.class,() -> taskManager.createTask("test", ""));
assertThrows(IllegalArgumentException.class,() -> taskManager.createTask("", "test"));
}
@Test
@DisplayName("Assert an IllegalArgumentException when you create a new Task with the same Name of a exits Task")
public void assertExceptionOnCreateNewTaskWithExitsName() {
String name = "Name";
String description = "Description";
assertDoesNotThrow(() -> taskManager.createTask(name, description));
assertThrows(TaskAlreadyExistsException.class, () -> taskManager.createTask(name, description));
}
@@ -40,7 +49,6 @@ public class BadCaseTaskTest {
Task task = taskManager.createTask(name, description);
assertThrows(IllegalArgumentException.class, () -> task.setDescription(null));
assertThrows(IllegalArgumentException.class, () -> task.setDescription(""));
assertThrows(IllegalArgumentException.class, () -> task.setStatus(null));
@@ -50,7 +58,7 @@ public class BadCaseTaskTest {
@DisplayName("Assert an IllegalArgumentException when calling a non-Existing Task")
public void assertExceptionOnCallingANonextistingTask (){
String name = " Manager";
assertThrows(IllegalArgumentException.class, () -> !name.equals(taskManager.getName()));
//assertThrows(IllegalArgumentException.class, () -> !name.equals(taskManager.getName()));
}