tests #43

Merged
sebastian merged 41 commits from tests into master 2023-11-11 11:20:50 +01:00
2 changed files with 52 additions and 26 deletions
Showing only changes of commit 8f5e8133f8 - Show all commits

View File

@ -4,11 +4,8 @@
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="3a869f59-290a-4ab2-b036-a878ce801bc4" name="Changes" comment="Fix failing test case">
<change 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 default="true" id="3a869f59-290a-4ab2-b036-a878ce801bc4" name="Changes" comment="TaskgroupRepsitoryTest">
<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" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -87,7 +84,7 @@
<recent name="$PROJECT_DIR$/src/test/java/core/taskgroups" />
</key>
</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">
<module name="demo" />
<extension name="coverage">
@ -103,6 +100,22 @@
<option name="Make" enabled="true" />
</method>
</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">
<module name="demo" />
<extension name="coverage">
@ -135,22 +148,6 @@
<option name="Make" enabled="true" />
</method>
</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">
<module name="demo" />
<extension name="coverage">
@ -176,11 +173,11 @@
</configuration>
<recent_temporary>
<list>
<item itemvalue="JUnit.TaskgroupRepsitoryTest.delete" />
<item itemvalue="JUnit.TaskgroupRepsitoryTest" />
<item itemvalue="JUnit.TaskgroupRepsitoryTest.deleteAllByUser" />
<item itemvalue="JUnit.TaskgroupRepsitoryTest.findAllTopTaskgroupsByUser" />
<item itemvalue="JUnit.TaskgroupRepsitoryTest.existsByTaskgroupNameAndUser" />
<item itemvalue="JUnit.TaskgroupRepsitoryTest.findAllByUser" />
</list>
</recent_temporary>
</component>
@ -215,7 +212,7 @@
<workItem from="1699205483652" duration="3298000" />
<workItem from="1699380499473" duration="2708000" />
<workItem from="1699460935890" duration="5000" />
<workItem from="1699466564154" duration="3193000" />
<workItem from="1699466564154" duration="4487000" />
</task>
<task id="LOCAL-00001" summary="Structure Taskgroups in Hierarchies">
<option name="closed" value="true" />
@ -401,7 +398,15 @@
<option name="project" value="LOCAL" />
<updated>1699380549911</updated>
</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 />
</component>
<component name="TypeScriptGeneratedFilesManager">
@ -432,7 +437,8 @@
<MESSAGE value="Write simple Testcase for ci/cd" />
<MESSAGE value="Deactivate Overall System test (temporarly)" />
<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 name="XDebuggerManager">
<breakpoint-manager>

View File

@ -1,6 +1,7 @@
package core.taskgroups;
import core.entities.User;
import core.entities.timemanager.Task;
import core.entities.timemanager.Taskgroup;
import core.repositories.timemanager.TaskgroupRepository;
import org.junit.jupiter.api.Test;
@ -90,4 +91,23 @@ public class TaskgroupRepsitoryTest {
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();
}
}
}