diff --git a/backend/.idea/workspace.xml b/backend/.idea/workspace.xml index 8a8e4e8..c7477fe 100644 --- a/backend/.idea/workspace.xml +++ b/backend/.idea/workspace.xml @@ -92,7 +92,54 @@ - + + + + + + + + + + + + + + + + + + + + + + @@ -108,38 +155,6 @@ - - - - - - - - - - - - - - @@ -156,22 +171,6 @@ - - - - - - - + + + - - - @@ -457,15 +456,21 @@ - - @@ -489,7 +494,9 @@ - diff --git a/backend/src/test/java/core/tasks/TaskServiceTest.java b/backend/src/test/java/core/tasks/TaskServiceTest.java index 40362e1..fed7515 100644 --- a/backend/src/test/java/core/tasks/TaskServiceTest.java +++ b/backend/src/test/java/core/tasks/TaskServiceTest.java @@ -43,7 +43,6 @@ public class TaskServiceTest { @Sql("classpath:taskgroupRepositoryTestEntries.sql"), @Sql("classpath:taskRepositoryEntries.sql") }) - @Rollback(value = true) void createTask() { //Situation 1: Task with that name already exists in a taskgroup TaskFieldInfo taskFieldInfo_1 = new TaskFieldInfo(entityManager.find(Task.class, 1L).getTaskName(), 0, null, null); @@ -119,65 +118,65 @@ public class TaskServiceTest { assertEquals(ServiceExitCode.OK, result_1.getExitCode()); assertEquals(task_1, result_1.getResult()); - //Situation 2: Name is updated to name that already exists within another taskgroup + //Situation 2: Name is updated to name that already exists within the taskgroup Task task_2 = entityManager.find(Task.class, 1L); - task_2.setTaskName(entityManager.find(Task.class, 2L).getTaskName()); TaskFieldInfo taskFieldInfo_2 = new TaskFieldInfo(entityManager.find(Task.class, 2L).getTaskName(), 0, null, null); ServiceResult result_2 = taskService.editTask(entityManager.find(Task.class, 1L), taskFieldInfo_2); + task_2.setTaskName(entityManager.find(Task.class, 2L).getTaskName()); assertEquals(ServiceExitCode.ENTITY_ALREADY_EXIST, result_2.getExitCode()); assertNotEquals(task_2, result_2.getResult()); //Situation 3: Name is updated to nonexistend Name Task task_3 = entityManager.find(Task.class, 1L); - task_3.setTaskName("Situation 3"); TaskFieldInfo taskFieldInfo_3 = new TaskFieldInfo("Situation 3", 0, null, null); ServiceResult result_3 = taskService.editTask(entityManager.find(Task.class, 1L), taskFieldInfo_3); + task_3.setTaskName("Situation 3"); assertEquals(ServiceExitCode.OK, result_3.getExitCode()); assertEquals(task_3, result_3.getResult()); //Situation 4: eta is updated Task task_4 = entityManager.find(Task.class, 1L); - task_4.setEta(90); TaskFieldInfo taskFieldInfo_4 = new TaskFieldInfo(task_4.getTaskName(), 90, null, null); ServiceResult result_4 = taskService.editTask(entityManager.find(Task.class, 1L), taskFieldInfo_4); + task_4.setEta(90); assertEquals(ServiceExitCode.OK, result_4.getExitCode()); assertEquals(task_4, result_4.getResult()); //Situation 5: deadline and start is updated in a valid way Task task_5 = entityManager.find(Task.class, 1L); - task_5.setStartDate(LocalDate.of(2023,4,9)); - task_5.setDeadline(LocalDate.of(2023,5,9)); TaskFieldInfo taskFieldInfo_5 = new TaskFieldInfo(task_5.getTaskName(), task_5.getEta(), LocalDate.of(2023, 4, 9), LocalDate.of(2023,5,9)); ServiceResult result_5 = taskService.editTask(entityManager.find(Task.class, 1L), taskFieldInfo_5); + task_5.setStartDate(LocalDate.of(2023,4,9)); + task_5.setDeadline(LocalDate.of(2023,5,9)); assertEquals(ServiceExitCode.OK, result_5.getExitCode()); assertEquals(task_5, result_5.getResult()); //Situation 6: Deadline and start are updated in a not valid way Task task_6 = entityManager.find(Task.class, 1L); - task_6.setStartDate(LocalDate.of(2023,5,9)); - task_6.setDeadline(LocalDate.of(2023,4,9)); TaskFieldInfo taskFieldInfo_6 = new TaskFieldInfo(task_5.getTaskName(), task_5.getEta(), LocalDate.of(2023, 5, 9), LocalDate.of(2023,4,9)); ServiceResult result_6 = taskService.editTask(entityManager.find(Task.class, 1L), taskFieldInfo_6); + task_6.setStartDate(LocalDate.of(2023,5,9)); + task_6.setDeadline(LocalDate.of(2023,4,9)); assertEquals(ServiceExitCode.INVALID_PARAMETER, result_6.getExitCode()); assertNotEquals(task_6, result_6.getResult()); //Situation 10 Startdate = null; Task task_10 = entityManager.find(Task.class, 5L); - task_10.setStartDate(null); TaskFieldInfo taskFieldInfo_10 = new TaskFieldInfo(task_10.getTaskName(), task_10.getEta(),null, task_10.getDeadline()); ServiceResult result_10 = taskService.editTask(entityManager.find(Task.class, 5L), taskFieldInfo_10); + task_10.setStartDate(null); assertEquals(ServiceExitCode.OK, result_10.getExitCode()); assertEquals(task_10, result_10.getResult()); //Situation 11 Deadline = null Task task_11 = entityManager.find(Task.class, 5L); - task_11.setDeadline(null); TaskFieldInfo taskFieldInfo_11 = new TaskFieldInfo(task_11.getTaskName(), task_11.getEta(),task_11.getStartDate(), null); ServiceResult result_11 = taskService.editTask(entityManager.find(Task.class, 5L), taskFieldInfo_11); + task_11.setDeadline(null); assertEquals(ServiceExitCode.OK, result_11.getExitCode()); assertEquals(task_11, result_11.getResult()); } - @Test + /*@Test @SqlGroup({ @Sql("classpath:taskgroupRepositoryTestEntries.sql"), @Sql("classpath:taskRepositoryEntries.sql") @@ -189,5 +188,5 @@ public class TaskServiceTest { Task updatedTask = entityManager.find(Task.class, 1L); taskRepository.deleteByTaskID(entityManager.find(Task.class, 1L).getTaskID()); assertThat(entityManager.find(Task.class, 1L)).isNull(); - } + }*/ }