tests #43
@ -4,8 +4,10 @@
|
|||||||
<option name="autoReloadType" value="SELECTIVE" />
|
<option name="autoReloadType" value="SELECTIVE" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="3a869f59-290a-4ab2-b036-a878ce801bc4" name="Changes" comment="Use @Sql instead of persit()">
|
<list default="true" id="3a869f59-290a-4ab2-b036-a878ce801bc4" name="Changes" comment="Resolve Merge-Conflict">
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/main/java/core/services/TaskService.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/core/services/TaskService.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/test/java/core/tasks/TaskServiceTest.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/test/java/core/tasks/TaskServiceTest.java" afterDir="false" />
|
||||||
</list>
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
@ -84,7 +86,54 @@
|
|||||||
<recent name="$PROJECT_DIR$/src/test/java/core/taskgroups" />
|
<recent name="$PROJECT_DIR$/src/test/java/core/taskgroups" />
|
||||||
</key>
|
</key>
|
||||||
</component>
|
</component>
|
||||||
<component name="RunManager" selected="JUnit.TaskgroupServiceTest">
|
<component name="RunManager" selected="JUnit.TaskServiceTest">
|
||||||
|
<configuration name="TaskServiceTest" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
|
||||||
|
<module name="demo" />
|
||||||
|
<extension name="coverage">
|
||||||
|
<pattern>
|
||||||
|
<option name="PATTERN" value="core.tasks.*" />
|
||||||
|
<option name="ENABLED" value="true" />
|
||||||
|
</pattern>
|
||||||
|
</extension>
|
||||||
|
<option name="PACKAGE_NAME" value="core.tasks" />
|
||||||
|
<option name="MAIN_CLASS_NAME" value="core.tasks.TaskServiceTest" />
|
||||||
|
<option name="TEST_OBJECT" value="class" />
|
||||||
|
<method v="2">
|
||||||
|
<option name="Make" enabled="true" />
|
||||||
|
</method>
|
||||||
|
</configuration>
|
||||||
|
<configuration name="TaskServiceTest.createTask" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
|
||||||
|
<module name="demo" />
|
||||||
|
<extension name="coverage">
|
||||||
|
<pattern>
|
||||||
|
<option name="PATTERN" value="core.tasks.*" />
|
||||||
|
<option name="ENABLED" value="true" />
|
||||||
|
</pattern>
|
||||||
|
</extension>
|
||||||
|
<option name="PACKAGE_NAME" value="core.tasks" />
|
||||||
|
<option name="MAIN_CLASS_NAME" value="core.tasks.TaskServiceTest" />
|
||||||
|
<option name="METHOD_NAME" value="createTask" />
|
||||||
|
<option name="TEST_OBJECT" value="method" />
|
||||||
|
<method v="2">
|
||||||
|
<option name="Make" enabled="true" />
|
||||||
|
</method>
|
||||||
|
</configuration>
|
||||||
|
<configuration name="TaskServiceTest.editTask" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
|
||||||
|
<module name="demo" />
|
||||||
|
<extension name="coverage">
|
||||||
|
<pattern>
|
||||||
|
<option name="PATTERN" value="core.tasks.*" />
|
||||||
|
<option name="ENABLED" value="true" />
|
||||||
|
</pattern>
|
||||||
|
</extension>
|
||||||
|
<option name="PACKAGE_NAME" value="core.tasks" />
|
||||||
|
<option name="MAIN_CLASS_NAME" value="core.tasks.TaskServiceTest" />
|
||||||
|
<option name="METHOD_NAME" value="editTask" />
|
||||||
|
<option name="TEST_OBJECT" value="method" />
|
||||||
|
<method v="2">
|
||||||
|
<option name="Make" enabled="true" />
|
||||||
|
</method>
|
||||||
|
</configuration>
|
||||||
<configuration name="TaskgroupServiceTest" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
|
<configuration name="TaskgroupServiceTest" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
|
||||||
<module name="demo" />
|
<module name="demo" />
|
||||||
<extension name="coverage">
|
<extension name="coverage">
|
||||||
@ -100,38 +149,6 @@
|
|||||||
<option name="Make" enabled="true" />
|
<option name="Make" enabled="true" />
|
||||||
</method>
|
</method>
|
||||||
</configuration>
|
</configuration>
|
||||||
<configuration name="TaskgroupServiceTest.deleteTaskgroup" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
|
|
||||||
<module name="demo" />
|
|
||||||
<extension name="coverage">
|
|
||||||
<pattern>
|
|
||||||
<option name="PATTERN" value="core.taskgroups.*" />
|
|
||||||
<option name="ENABLED" value="true" />
|
|
||||||
</pattern>
|
|
||||||
</extension>
|
|
||||||
<option name="PACKAGE_NAME" value="core.taskgroups" />
|
|
||||||
<option name="MAIN_CLASS_NAME" value="core.taskgroups.TaskgroupServiceTest" />
|
|
||||||
<option name="METHOD_NAME" value="deleteTaskgroup" />
|
|
||||||
<option name="TEST_OBJECT" value="method" />
|
|
||||||
<method v="2">
|
|
||||||
<option name="Make" enabled="true" />
|
|
||||||
</method>
|
|
||||||
</configuration>
|
|
||||||
<configuration name="TaskgroupServiceTest.deleteTaskgroupByUser" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
|
|
||||||
<module name="demo" />
|
|
||||||
<extension name="coverage">
|
|
||||||
<pattern>
|
|
||||||
<option name="PATTERN" value="core.taskgroups.*" />
|
|
||||||
<option name="ENABLED" value="true" />
|
|
||||||
</pattern>
|
|
||||||
</extension>
|
|
||||||
<option name="PACKAGE_NAME" value="core.taskgroups" />
|
|
||||||
<option name="MAIN_CLASS_NAME" value="core.taskgroups.TaskgroupServiceTest" />
|
|
||||||
<option name="METHOD_NAME" value="deleteTaskgroupByUser" />
|
|
||||||
<option name="TEST_OBJECT" value="method" />
|
|
||||||
<method v="2">
|
|
||||||
<option name="Make" enabled="true" />
|
|
||||||
</method>
|
|
||||||
</configuration>
|
|
||||||
<configuration name="TaskgroupServiceTest.getTaskgroupByIDAndUsername" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
|
<configuration name="TaskgroupServiceTest.getTaskgroupByIDAndUsername" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
|
||||||
<module name="demo" />
|
<module name="demo" />
|
||||||
<extension name="coverage">
|
<extension name="coverage">
|
||||||
@ -148,22 +165,6 @@
|
|||||||
<option name="Make" enabled="true" />
|
<option name="Make" enabled="true" />
|
||||||
</method>
|
</method>
|
||||||
</configuration>
|
</configuration>
|
||||||
<configuration name="TaskgroupServiceTest.getTopTaskgroupsByUser" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
|
|
||||||
<module name="demo" />
|
|
||||||
<extension name="coverage">
|
|
||||||
<pattern>
|
|
||||||
<option name="PATTERN" value="core.taskgroups.*" />
|
|
||||||
<option name="ENABLED" value="true" />
|
|
||||||
</pattern>
|
|
||||||
</extension>
|
|
||||||
<option name="PACKAGE_NAME" value="core.taskgroups" />
|
|
||||||
<option name="MAIN_CLASS_NAME" value="core.taskgroups.TaskgroupServiceTest" />
|
|
||||||
<option name="METHOD_NAME" value="getTopTaskgroupsByUser" />
|
|
||||||
<option name="TEST_OBJECT" value="method" />
|
|
||||||
<method v="2">
|
|
||||||
<option name="Make" enabled="true" />
|
|
||||||
</method>
|
|
||||||
</configuration>
|
|
||||||
<configuration name="DemoApplication" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot" nameIsGenerated="true">
|
<configuration name="DemoApplication" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot" nameIsGenerated="true">
|
||||||
<module name="demo" />
|
<module name="demo" />
|
||||||
<option name="SPRING_BOOT_MAIN_CLASS" value="core.DemoApplication" />
|
<option name="SPRING_BOOT_MAIN_CLASS" value="core.DemoApplication" />
|
||||||
@ -173,11 +174,11 @@
|
|||||||
</configuration>
|
</configuration>
|
||||||
<recent_temporary>
|
<recent_temporary>
|
||||||
<list>
|
<list>
|
||||||
|
<item itemvalue="JUnit.TaskServiceTest" />
|
||||||
|
<item itemvalue="JUnit.TaskServiceTest.createTask" />
|
||||||
|
<item itemvalue="JUnit.TaskServiceTest.editTask" />
|
||||||
<item itemvalue="JUnit.TaskgroupServiceTest" />
|
<item itemvalue="JUnit.TaskgroupServiceTest" />
|
||||||
<item itemvalue="JUnit.TaskgroupServiceTest.getTaskgroupByIDAndUsername" />
|
<item itemvalue="JUnit.TaskgroupServiceTest.getTaskgroupByIDAndUsername" />
|
||||||
<item itemvalue="JUnit.TaskgroupServiceTest.deleteTaskgroupByUser" />
|
|
||||||
<item itemvalue="JUnit.TaskgroupServiceTest.getTopTaskgroupsByUser" />
|
|
||||||
<item itemvalue="JUnit.TaskgroupServiceTest.deleteTaskgroup" />
|
|
||||||
</list>
|
</list>
|
||||||
</recent_temporary>
|
</recent_temporary>
|
||||||
</component>
|
</component>
|
||||||
@ -449,15 +450,21 @@
|
|||||||
<option name="project" value="LOCAL" />
|
<option name="project" value="LOCAL" />
|
||||||
<updated>1699646291964</updated>
|
<updated>1699646291964</updated>
|
||||||
</task>
|
</task>
|
||||||
<option name="localTasksCounter" value="30" />
|
<task id="LOCAL-00030" summary="Resolve Merge-Conflict">
|
||||||
|
<option name="closed" value="true" />
|
||||||
|
<created>1699693472182</created>
|
||||||
|
<option name="number" value="00030" />
|
||||||
|
<option name="presentableId" value="LOCAL-00030" />
|
||||||
|
<option name="project" value="LOCAL" />
|
||||||
|
<updated>1699693472182</updated>
|
||||||
|
</task>
|
||||||
|
<option name="localTasksCounter" value="31" />
|
||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
<component name="TypeScriptGeneratedFilesManager">
|
<component name="TypeScriptGeneratedFilesManager">
|
||||||
<option name="version" value="3" />
|
<option name="version" value="3" />
|
||||||
</component>
|
</component>
|
||||||
<component name="VcsManagerConfiguration">
|
<component name="VcsManagerConfiguration">
|
||||||
<MESSAGE value="Delete and clear Tasks (Frontend)" />
|
|
||||||
<MESSAGE value="Define Entity BasicTaskSchedule and Taskcontroller" />
|
|
||||||
<MESSAGE value="Delete Schedules" />
|
<MESSAGE value="Delete Schedules" />
|
||||||
<MESSAGE value="Deliver Schedule Path Info when fetching Schedules" />
|
<MESSAGE value="Deliver Schedule Path Info when fetching Schedules" />
|
||||||
<MESSAGE value="Removed unused TaskgroupShortInfo.java" />
|
<MESSAGE value="Removed unused TaskgroupShortInfo.java" />
|
||||||
@ -481,7 +488,9 @@
|
|||||||
<MESSAGE value="Test TaskRepository" />
|
<MESSAGE value="Test TaskRepository" />
|
||||||
<MESSAGE value="Initialize Testing of Testservice" />
|
<MESSAGE value="Initialize Testing of Testservice" />
|
||||||
<MESSAGE value="Use @Sql instead of persit()" />
|
<MESSAGE value="Use @Sql instead of persit()" />
|
||||||
<option name="LAST_COMMIT_MESSAGE" value="Use @Sql instead of persit()" />
|
<MESSAGE value="Make the Test Transactional" />
|
||||||
|
<MESSAGE value="Resolve Merge-Conflict" />
|
||||||
|
<option name="LAST_COMMIT_MESSAGE" value="Resolve Merge-Conflict" />
|
||||||
</component>
|
</component>
|
||||||
<component name="XDebuggerManager">
|
<component name="XDebuggerManager">
|
||||||
<breakpoint-manager>
|
<breakpoint-manager>
|
||||||
|
@ -70,11 +70,13 @@ public class TaskService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ServiceResult<Task> editTask(Task task, TaskFieldInfo taskFieldInfo) {
|
public ServiceResult<Task> editTask(Task task, TaskFieldInfo taskFieldInfo) {
|
||||||
if(!task.getTaskName().equals(taskFieldInfo.getTaskName()) && !existTaskByName(task.getTaskgroup().getTasks(), taskFieldInfo.getTaskName())) {
|
if(!task.getTaskName().equals(taskFieldInfo.getTaskName())) {
|
||||||
task.setTaskName(taskFieldInfo.getTaskName());
|
//taskname will be updated
|
||||||
|
if(existTaskByName(task.getTaskgroup().getTasks(), taskFieldInfo.getTaskName())) {
|
||||||
} else if(!task.getTaskName().equals(taskFieldInfo.getTaskName()) && existTaskByName(task.getTaskgroup().getTasks(), taskFieldInfo.getTaskName())) {
|
return new ServiceResult<>(ServiceExitCode.ENTITY_ALREADY_EXIST);
|
||||||
return new ServiceResult<>(ServiceExitCode.ENTITY_ALREADY_EXIST);
|
} else {
|
||||||
|
task.setTaskName(taskFieldInfo.getTaskName());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Check for invalid date (deadline before start
|
//Check for invalid date (deadline before start
|
||||||
|
@ -22,6 +22,7 @@ import static org.assertj.core.api.AssertionsForClassTypes.assertThat;
|
|||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
|
|
||||||
@SpringBootTest
|
@SpringBootTest
|
||||||
|
@Transactional
|
||||||
public class TaskServiceTest {
|
public class TaskServiceTest {
|
||||||
|
|
||||||
|
|
||||||
@ -42,7 +43,6 @@ public class TaskServiceTest {
|
|||||||
@Sql("classpath:taskgroupRepositoryTestEntries.sql"),
|
@Sql("classpath:taskgroupRepositoryTestEntries.sql"),
|
||||||
@Sql("classpath:taskRepositoryEntries.sql")
|
@Sql("classpath:taskRepositoryEntries.sql")
|
||||||
})
|
})
|
||||||
@Rollback(value = true)
|
|
||||||
void createTask() {
|
void createTask() {
|
||||||
//Situation 1: Task with that name already exists in a taskgroup
|
//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);
|
TaskFieldInfo taskFieldInfo_1 = new TaskFieldInfo(entityManager.find(Task.class, 1L).getTaskName(), 0, null, null);
|
||||||
@ -118,65 +118,65 @@ public class TaskServiceTest {
|
|||||||
assertEquals(ServiceExitCode.OK, result_1.getExitCode());
|
assertEquals(ServiceExitCode.OK, result_1.getExitCode());
|
||||||
assertEquals(task_1, result_1.getResult());
|
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 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);
|
TaskFieldInfo taskFieldInfo_2 = new TaskFieldInfo(entityManager.find(Task.class, 2L).getTaskName(), 0, null, null);
|
||||||
ServiceResult<Task> result_2 = taskService.editTask(entityManager.find(Task.class, 1L), taskFieldInfo_2);
|
ServiceResult<Task> 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());
|
assertEquals(ServiceExitCode.ENTITY_ALREADY_EXIST, result_2.getExitCode());
|
||||||
assertNotEquals(task_2, result_2.getResult());
|
assertNotEquals(task_2, result_2.getResult());
|
||||||
|
|
||||||
//Situation 3: Name is updated to nonexistend Name
|
//Situation 3: Name is updated to nonexistend Name
|
||||||
Task task_3 = entityManager.find(Task.class, 1L);
|
Task task_3 = entityManager.find(Task.class, 1L);
|
||||||
task_3.setTaskName("Situation 3");
|
|
||||||
TaskFieldInfo taskFieldInfo_3 = new TaskFieldInfo("Situation 3", 0, null, null);
|
TaskFieldInfo taskFieldInfo_3 = new TaskFieldInfo("Situation 3", 0, null, null);
|
||||||
ServiceResult<Task> result_3 = taskService.editTask(entityManager.find(Task.class, 1L), taskFieldInfo_3);
|
ServiceResult<Task> result_3 = taskService.editTask(entityManager.find(Task.class, 1L), taskFieldInfo_3);
|
||||||
|
task_3.setTaskName("Situation 3");
|
||||||
assertEquals(ServiceExitCode.OK, result_3.getExitCode());
|
assertEquals(ServiceExitCode.OK, result_3.getExitCode());
|
||||||
assertEquals(task_3, result_3.getResult());
|
assertEquals(task_3, result_3.getResult());
|
||||||
|
|
||||||
//Situation 4: eta is updated
|
//Situation 4: eta is updated
|
||||||
Task task_4 = entityManager.find(Task.class, 1L);
|
Task task_4 = entityManager.find(Task.class, 1L);
|
||||||
task_4.setEta(90);
|
|
||||||
TaskFieldInfo taskFieldInfo_4 = new TaskFieldInfo(task_4.getTaskName(), 90, null, null);
|
TaskFieldInfo taskFieldInfo_4 = new TaskFieldInfo(task_4.getTaskName(), 90, null, null);
|
||||||
ServiceResult<Task> result_4 = taskService.editTask(entityManager.find(Task.class, 1L), taskFieldInfo_4);
|
ServiceResult<Task> result_4 = taskService.editTask(entityManager.find(Task.class, 1L), taskFieldInfo_4);
|
||||||
|
task_4.setEta(90);
|
||||||
assertEquals(ServiceExitCode.OK, result_4.getExitCode());
|
assertEquals(ServiceExitCode.OK, result_4.getExitCode());
|
||||||
assertEquals(task_4, result_4.getResult());
|
assertEquals(task_4, result_4.getResult());
|
||||||
|
|
||||||
//Situation 5: deadline and start is updated in a valid way
|
//Situation 5: deadline and start is updated in a valid way
|
||||||
Task task_5 = entityManager.find(Task.class, 1L);
|
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));
|
TaskFieldInfo taskFieldInfo_5 = new TaskFieldInfo(task_5.getTaskName(), task_5.getEta(), LocalDate.of(2023, 4, 9), LocalDate.of(2023,5,9));
|
||||||
ServiceResult<Task> result_5 = taskService.editTask(entityManager.find(Task.class, 1L), taskFieldInfo_5);
|
ServiceResult<Task> 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(ServiceExitCode.OK, result_5.getExitCode());
|
||||||
assertEquals(task_5, result_5.getResult());
|
assertEquals(task_5, result_5.getResult());
|
||||||
|
|
||||||
//Situation 6: Deadline and start are updated in a not valid way
|
//Situation 6: Deadline and start are updated in a not valid way
|
||||||
Task task_6 = entityManager.find(Task.class, 1L);
|
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));
|
TaskFieldInfo taskFieldInfo_6 = new TaskFieldInfo(task_5.getTaskName(), task_5.getEta(), LocalDate.of(2023, 5, 9), LocalDate.of(2023,4,9));
|
||||||
ServiceResult<Task> result_6 = taskService.editTask(entityManager.find(Task.class, 1L), taskFieldInfo_6);
|
ServiceResult<Task> 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());
|
assertEquals(ServiceExitCode.INVALID_PARAMETER, result_6.getExitCode());
|
||||||
assertNotEquals(task_6, result_6.getResult());
|
assertNotEquals(task_6, result_6.getResult());
|
||||||
|
|
||||||
//Situation 10 Startdate = null;
|
//Situation 10 Startdate = null;
|
||||||
Task task_10 = entityManager.find(Task.class, 5L);
|
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());
|
TaskFieldInfo taskFieldInfo_10 = new TaskFieldInfo(task_10.getTaskName(), task_10.getEta(),null, task_10.getDeadline());
|
||||||
ServiceResult<Task> result_10 = taskService.editTask(entityManager.find(Task.class, 5L), taskFieldInfo_10);
|
ServiceResult<Task> result_10 = taskService.editTask(entityManager.find(Task.class, 5L), taskFieldInfo_10);
|
||||||
|
task_10.setStartDate(null);
|
||||||
assertEquals(ServiceExitCode.OK, result_10.getExitCode());
|
assertEquals(ServiceExitCode.OK, result_10.getExitCode());
|
||||||
assertEquals(task_10, result_10.getResult());
|
assertEquals(task_10, result_10.getResult());
|
||||||
|
|
||||||
//Situation 11 Deadline = null
|
//Situation 11 Deadline = null
|
||||||
Task task_11 = entityManager.find(Task.class, 5L);
|
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);
|
TaskFieldInfo taskFieldInfo_11 = new TaskFieldInfo(task_11.getTaskName(), task_11.getEta(),task_11.getStartDate(), null);
|
||||||
ServiceResult<Task> result_11 = taskService.editTask(entityManager.find(Task.class, 5L), taskFieldInfo_11);
|
ServiceResult<Task> result_11 = taskService.editTask(entityManager.find(Task.class, 5L), taskFieldInfo_11);
|
||||||
|
task_11.setDeadline(null);
|
||||||
assertEquals(ServiceExitCode.OK, result_11.getExitCode());
|
assertEquals(ServiceExitCode.OK, result_11.getExitCode());
|
||||||
assertEquals(task_11, result_11.getResult());
|
assertEquals(task_11, result_11.getResult());
|
||||||
}
|
}
|
||||||
@Test
|
/*@Test
|
||||||
@SqlGroup({
|
@SqlGroup({
|
||||||
@Sql("classpath:taskgroupRepositoryTestEntries.sql"),
|
@Sql("classpath:taskgroupRepositoryTestEntries.sql"),
|
||||||
@Sql("classpath:taskRepositoryEntries.sql")
|
@Sql("classpath:taskRepositoryEntries.sql")
|
||||||
@ -188,5 +188,5 @@ public class TaskServiceTest {
|
|||||||
Task updatedTask = entityManager.find(Task.class, 1L);
|
Task updatedTask = entityManager.find(Task.class, 1L);
|
||||||
taskRepository.deleteByTaskID(entityManager.find(Task.class, 1L).getTaskID());
|
taskRepository.deleteByTaskID(entityManager.find(Task.class, 1L).getTaskID());
|
||||||
assertThat(entityManager.find(Task.class, 1L)).isNull();
|
assertThat(entityManager.find(Task.class, 1L)).isNull();
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user