TaskgroupRepsitoryTest (+Delete)
All checks were successful
Java CI with Maven / build (push) Successful in 35s

This commit is contained in:
Sebastian Böckelmann 2023-11-08 20:17:57 +01:00
parent 5cf04a6858
commit 8f5e8133f8
2 changed files with 52 additions and 26 deletions

View File

@ -4,11 +4,8 @@
<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="Fix failing test case"> <list default="true" id="3a869f59-290a-4ab2-b036-a878ce801bc4" name="Changes" comment="TaskgroupRepsitoryTest">
<change afterPath="$PROJECT_DIR$/src/test/java/core/taskgroups/TaskgroupRepsitoryTest.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/test/java/core/taskgroups/TaskgroupRepsitoryTest.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/test/java/core/taskgroups/TaskgroupRepsitoryTest.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/test/resources/taskgroupRepositoryTestEntries.sql" 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/entities/timemanager/Taskgroup.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/core/entities/timemanager/Taskgroup.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" />
@ -87,7 +84,7 @@
<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.TaskgroupRepsitoryTest"> <component name="RunManager" selected="JUnit.TaskgroupRepsitoryTest.delete">
<configuration name="TaskgroupRepsitoryTest" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true"> <configuration name="TaskgroupRepsitoryTest" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
<module name="demo" /> <module name="demo" />
<extension name="coverage"> <extension name="coverage">
@ -103,6 +100,22 @@
<option name="Make" enabled="true" /> <option name="Make" enabled="true" />
</method> </method>
</configuration> </configuration>
<configuration name="TaskgroupRepsitoryTest.delete" 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.TaskgroupRepsitoryTest" />
<option name="METHOD_NAME" value="delete" />
<option name="TEST_OBJECT" value="method" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<configuration name="TaskgroupRepsitoryTest.deleteAllByUser" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true"> <configuration name="TaskgroupRepsitoryTest.deleteAllByUser" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
<module name="demo" /> <module name="demo" />
<extension name="coverage"> <extension name="coverage">
@ -135,22 +148,6 @@
<option name="Make" enabled="true" /> <option name="Make" enabled="true" />
</method> </method>
</configuration> </configuration>
<configuration name="TaskgroupRepsitoryTest.findAllByUser" 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.TaskgroupRepsitoryTest" />
<option name="METHOD_NAME" value="findAllByUser" />
<option name="TEST_OBJECT" value="method" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<configuration name="TaskgroupRepsitoryTest.findAllTopTaskgroupsByUser" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true"> <configuration name="TaskgroupRepsitoryTest.findAllTopTaskgroupsByUser" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
<module name="demo" /> <module name="demo" />
<extension name="coverage"> <extension name="coverage">
@ -176,11 +173,11 @@
</configuration> </configuration>
<recent_temporary> <recent_temporary>
<list> <list>
<item itemvalue="JUnit.TaskgroupRepsitoryTest.delete" />
<item itemvalue="JUnit.TaskgroupRepsitoryTest" /> <item itemvalue="JUnit.TaskgroupRepsitoryTest" />
<item itemvalue="JUnit.TaskgroupRepsitoryTest.deleteAllByUser" /> <item itemvalue="JUnit.TaskgroupRepsitoryTest.deleteAllByUser" />
<item itemvalue="JUnit.TaskgroupRepsitoryTest.findAllTopTaskgroupsByUser" /> <item itemvalue="JUnit.TaskgroupRepsitoryTest.findAllTopTaskgroupsByUser" />
<item itemvalue="JUnit.TaskgroupRepsitoryTest.existsByTaskgroupNameAndUser" /> <item itemvalue="JUnit.TaskgroupRepsitoryTest.existsByTaskgroupNameAndUser" />
<item itemvalue="JUnit.TaskgroupRepsitoryTest.findAllByUser" />
</list> </list>
</recent_temporary> </recent_temporary>
</component> </component>
@ -215,7 +212,7 @@
<workItem from="1699205483652" duration="3298000" /> <workItem from="1699205483652" duration="3298000" />
<workItem from="1699380499473" duration="2708000" /> <workItem from="1699380499473" duration="2708000" />
<workItem from="1699460935890" duration="5000" /> <workItem from="1699460935890" duration="5000" />
<workItem from="1699466564154" duration="3193000" /> <workItem from="1699466564154" duration="4487000" />
</task> </task>
<task id="LOCAL-00001" summary="Structure Taskgroups in Hierarchies"> <task id="LOCAL-00001" summary="Structure Taskgroups in Hierarchies">
<option name="closed" value="true" /> <option name="closed" value="true" />
@ -401,7 +398,15 @@
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1699380549911</updated> <updated>1699380549911</updated>
</task> </task>
<option name="localTasksCounter" value="24" /> <task id="LOCAL-00024" summary="TaskgroupRepsitoryTest">
<option name="closed" value="true" />
<created>1699470020407</created>
<option name="number" value="00024" />
<option name="presentableId" value="LOCAL-00024" />
<option name="project" value="LOCAL" />
<updated>1699470020407</updated>
</task>
<option name="localTasksCounter" value="25" />
<servers /> <servers />
</component> </component>
<component name="TypeScriptGeneratedFilesManager"> <component name="TypeScriptGeneratedFilesManager">
@ -432,7 +437,8 @@
<MESSAGE value="Write simple Testcase for ci/cd" /> <MESSAGE value="Write simple Testcase for ci/cd" />
<MESSAGE value="Deactivate Overall System test (temporarly)" /> <MESSAGE value="Deactivate Overall System test (temporarly)" />
<MESSAGE value="Fix failing test case" /> <MESSAGE value="Fix failing test case" />
<option name="LAST_COMMIT_MESSAGE" value="Fix failing test case" /> <MESSAGE value="TaskgroupRepsitoryTest" />
<option name="LAST_COMMIT_MESSAGE" value="TaskgroupRepsitoryTest" />
</component> </component>
<component name="XDebuggerManager"> <component name="XDebuggerManager">
<breakpoint-manager> <breakpoint-manager>

View File

@ -1,6 +1,7 @@
package core.taskgroups; package core.taskgroups;
import core.entities.User; import core.entities.User;
import core.entities.timemanager.Task;
import core.entities.timemanager.Taskgroup; import core.entities.timemanager.Taskgroup;
import core.repositories.timemanager.TaskgroupRepository; import core.repositories.timemanager.TaskgroupRepository;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
@ -90,4 +91,23 @@ public class TaskgroupRepsitoryTest {
assertThat(testEntityManager.find(Taskgroup.class, i)).isNull(); assertThat(testEntityManager.find(Taskgroup.class, i)).isNull();
} }
} }
@Test
@Sql("classpath:taskgroupRepositoryTestEntries.sql")
void delete() {
Taskgroup no_children = testEntityManager.find(Taskgroup.class, 1L);
Taskgroup taskgroup_with_children = testEntityManager.find(Taskgroup.class, 5L);
taskgroupRepository.delete(no_children);
assertThat(testEntityManager.find(Taskgroup.class, 1L)).isNull();
for(long i=2; i<=8; i++) {
assertThat(testEntityManager.find(Taskgroup.class, i)).isNotNull();
}
taskgroupRepository.delete(taskgroup_with_children);
for(long i=5; i<=8; i++) {
assertThat(testEntityManager.find(Taskgroup.class, i)).isNull();
}
}
} }