Added Tests for removing, finishing and unfinishing tasks and so on for test coverage.

This commit is contained in:
2025-12-03 19:32:59 +01:00
parent 7640b1ef35
commit 98bbddb31a
15 changed files with 46 additions and 28 deletions

Binary file not shown.

File diff suppressed because one or more lines are too long

View File

@@ -650,7 +650,7 @@ code + .copy-button {
<script type="text/javascript">
function configurationCacheProblems() { return (
// begin-report-data
{"diagnostics":[{"locations":[{}],"problem":[{"text":"Properties should be assigned using the 'propName = value' syntax. Setting a property via the Gradle-generated 'propName value' or 'propName(value)' syntax in Groovy DSL has been deprecated."}],"severity":"WARNING","problemDetails":[{"text":"This is scheduled to be removed in Gradle 10.0."}],"contextualLabel":"Properties should be assigned using the 'propName = value' syntax. Setting a property via the Gradle-generated 'propName value' or 'propName(value)' syntax in Groovy DSL has been deprecated.","documentationLink":"https://docs.gradle.org/8.14/userguide/upgrading_version_8.html#groovy_space_assignment_syntax","problemId":[{"name":"deprecation","displayName":"Deprecation"},{"name":"properties-should-be-assigned-using-the-propname-value-syntax-setting-a-property-via-the-gradle-generated-propname-value-or-propname-value-syntax-in-groovy-dsl","displayName":"Properties should be assigned using the 'propName = value' syntax. Setting a property via the Gradle-generated 'propName value' or 'propName(value)' syntax in Groovy DSL has been deprecated."}],"solutions":[[{"text":"Use assignment ('exceptionFormat = <value>') instead."}]]}],"problemsReport":{"totalProblemCount":1,"buildName":"Template","requestedTasks":"test","documentationLink":"https://docs.gradle.org/8.14/userguide/reporting_problems.html","documentationLinkCaption":"Problem report","summaries":[]}}
{"diagnostics":[{"locations":[{}],"problem":[{"text":"Properties should be assigned using the 'propName = value' syntax. Setting a property via the Gradle-generated 'propName value' or 'propName(value)' syntax in Groovy DSL has been deprecated."}],"severity":"WARNING","problemDetails":[{"text":"This is scheduled to be removed in Gradle 10.0."}],"contextualLabel":"Properties should be assigned using the 'propName = value' syntax. Setting a property via the Gradle-generated 'propName value' or 'propName(value)' syntax in Groovy DSL has been deprecated.","documentationLink":"https://docs.gradle.org/8.14/userguide/upgrading_version_8.html#groovy_space_assignment_syntax","problemId":[{"name":"deprecation","displayName":"Deprecation"},{"name":"properties-should-be-assigned-using-the-propname-value-syntax-setting-a-property-via-the-gradle-generated-propname-value-or-propname-value-syntax-in-groovy-dsl","displayName":"Properties should be assigned using the 'propName = value' syntax. Setting a property via the Gradle-generated 'propName value' or 'propName(value)' syntax in Groovy DSL has been deprecated."}],"solutions":[[{"text":"Use assignment ('exceptionFormat = <value>') instead."}]]}],"problemsReport":{"totalProblemCount":1,"buildName":"Template","requestedTasks":"jacocoTestReport","documentationLink":"https://docs.gradle.org/8.14/userguide/reporting_problems.html","documentationLinkCaption":"Problem report","summaries":[]}}
// end-report-data
);}
</script>

View File

@@ -41,7 +41,7 @@
</td>
<td>
<div class="infoBox" id="duration">
<div class="counter">0.045s</div>
<div class="counter">0.056s</div>
<p>duration</p>
</div>
</td>
@@ -78,19 +78,19 @@
<tr>
<td class="success">Assert only existing tasks can be edited</td>
<td class="success">assertEditOnlyExistingTasks()</td>
<td class="success">0.005s</td>
<td class="success">0.004s</td>
<td class="success">passed</td>
</tr>
<tr>
<td class="success">Assert List isn't empty after adding a task</td>
<td class="success">assertListNowEmptyAfterAdd()</td>
<td class="success">0.037s</td>
<td class="success">0.050s</td>
<td class="success">passed</td>
</tr>
<tr>
<td class="success">Assert that added tasks can't be Null</td>
<td class="success">assertNewTasksAreNotNull()</td>
<td class="success">0.003s</td>
<td class="success">0.002s</td>
<td class="success">passed</td>
</tr>
</table>
@@ -103,7 +103,7 @@
<input id="line-wrapping-toggle" type="checkbox" autocomplete="off"/>
</label>
</div>Generated by
<a href="https://www.gradle.org">Gradle 8.14</a> at 03.12.2025, 19:19:51</p>
<a href="https://www.gradle.org">Gradle 8.14</a> at 03.12.2025, 19:20:37</p>
</div>
</div>
</body>

View File

@@ -41,7 +41,7 @@
</td>
<td>
<div class="infoBox" id="duration">
<div class="counter">0.013s</div>
<div class="counter">0.016s</div>
<p>duration</p>
</div>
</td>
@@ -90,7 +90,7 @@
<tr>
<td class="success">Check Getters</td>
<td class="success">assertGettersWorkCorrectly()</td>
<td class="success">0.004s</td>
<td class="success">0.005s</td>
<td class="success">passed</td>
</tr>
<tr>
@@ -108,7 +108,7 @@
<tr>
<td class="success">Assert that a Worker can add a Task</td>
<td class="success">assertWorkerCanAddTask()</td>
<td class="success">0.002s</td>
<td class="success">0.004s</td>
<td class="success">passed</td>
</tr>
<tr>
@@ -127,7 +127,7 @@
<input id="line-wrapping-toggle" type="checkbox" autocomplete="off"/>
</label>
</div>Generated by
<a href="https://www.gradle.org">Gradle 8.14</a> at 03.12.2025, 19:19:51</p>
<a href="https://www.gradle.org">Gradle 8.14</a> at 03.12.2025, 19:20:37</p>
</div>
</div>
</body>

View File

@@ -38,7 +38,7 @@
</td>
<td>
<div class="infoBox" id="duration">
<div class="counter">0.058s</div>
<div class="counter">0.072s</div>
<p>duration</p>
</div>
</td>
@@ -85,7 +85,7 @@
<td>10</td>
<td>0</td>
<td>0</td>
<td>0.058s</td>
<td>0.072s</td>
<td class="success">100%</td>
</tr>
</tbody>
@@ -112,7 +112,7 @@
<td>3</td>
<td>0</td>
<td>0</td>
<td>0.045s</td>
<td>0.056s</td>
<td class="success">100%</td>
</tr>
<tr>
@@ -122,7 +122,7 @@
<td>7</td>
<td>0</td>
<td>0</td>
<td>0.013s</td>
<td>0.016s</td>
<td class="success">100%</td>
</tr>
</tbody>
@@ -136,7 +136,7 @@
<input id="line-wrapping-toggle" type="checkbox" autocomplete="off"/>
</label>
</div>Generated by
<a href="https://www.gradle.org">Gradle 8.14</a> at 03.12.2025, 19:19:51</p>
<a href="https://www.gradle.org">Gradle 8.14</a> at 03.12.2025, 19:20:37</p>
</div>
</div>
</body>

View File

@@ -40,7 +40,7 @@
</td>
<td>
<div class="infoBox" id="duration">
<div class="counter">0.058s</div>
<div class="counter">0.072s</div>
<p>duration</p>
</div>
</td>
@@ -83,7 +83,7 @@
<td>3</td>
<td>0</td>
<td>0</td>
<td>0.045s</td>
<td>0.056s</td>
<td class="success">100%</td>
</tr>
<tr>
@@ -93,7 +93,7 @@
<td>7</td>
<td>0</td>
<td>0</td>
<td>0.013s</td>
<td>0.016s</td>
<td class="success">100%</td>
</tr>
</table>
@@ -106,7 +106,7 @@
<input id="line-wrapping-toggle" type="checkbox" autocomplete="off"/>
</label>
</div>Generated by
<a href="https://www.gradle.org">Gradle 8.14</a> at 03.12.2025, 19:19:51</p>
<a href="https://www.gradle.org">Gradle 8.14</a> at 03.12.2025, 19:20:37</p>
</div>
</div>
</body>

View File

@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuite name="hhn.temp.project.BadCasesTest" tests="3" skipped="0" failures="0" errors="0" timestamp="2025-12-03T18:19:51.018Z" hostname="KEVIN-THINKPAD" time="0.047">
<testsuite name="hhn.temp.project.BadCasesTest" tests="3" skipped="0" failures="0" errors="0" timestamp="2025-12-03T18:20:36.897Z" hostname="KEVIN-THINKPAD" time="0.059">
<properties/>
<testcase name="Assert List isn't empty after adding a task" classname="hhn.temp.project.BadCasesTest" time="0.037"/>
<testcase name="Assert only existing tasks can be edited" classname="hhn.temp.project.BadCasesTest" time="0.005"/>
<testcase name="Assert that added tasks can't be Null" classname="hhn.temp.project.BadCasesTest" time="0.003"/>
<testcase name="Assert List isn't empty after adding a task" classname="hhn.temp.project.BadCasesTest" time="0.05"/>
<testcase name="Assert only existing tasks can be edited" classname="hhn.temp.project.BadCasesTest" time="0.004"/>
<testcase name="Assert that added tasks can't be Null" classname="hhn.temp.project.BadCasesTest" time="0.002"/>
<system-out><![CDATA[]]></system-out>
<system-err><![CDATA[]]></system-err>
</testsuite>

View File

@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuite name="hhn.temp.project.GoodCasesTest" tests="7" skipped="0" failures="0" errors="0" timestamp="2025-12-03T18:19:51.076Z" hostname="KEVIN-THINKPAD" time="0.024">
<testsuite name="hhn.temp.project.GoodCasesTest" tests="7" skipped="0" failures="0" errors="0" timestamp="2025-12-03T18:20:36.963Z" hostname="KEVIN-THINKPAD" time="0.026">
<properties/>
<testcase name="Check Getters" classname="hhn.temp.project.GoodCasesTest" time="0.004"/>
<testcase name="Check Getters" classname="hhn.temp.project.GoodCasesTest" time="0.005"/>
<testcase name="Assert that added Tasks are added to the List" classname="hhn.temp.project.GoodCasesTest" time="0.001"/>
<testcase name="Assert that Worker can remove Task" classname="hhn.temp.project.GoodCasesTest" time="0.001"/>
<testcase name="Assert that a Worker can add a Task" classname="hhn.temp.project.GoodCasesTest" time="0.002"/>
<testcase name="Assert that a Worker can add a Task" classname="hhn.temp.project.GoodCasesTest" time="0.004"/>
<testcase name="Assert existing Tasks can be edited" classname="hhn.temp.project.GoodCasesTest" time="0.001"/>
<testcase name="Assert that Task State is actually changed when submitted as finished" classname="hhn.temp.project.GoodCasesTest" time="0.002"/>
<testcase name="Assert deleted Tasks no longer show up in the List" classname="hhn.temp.project.GoodCasesTest" time="0.002"/>

View File

@@ -32,6 +32,24 @@ public class BadCasesTest {
public void assertEditOnlyExistingTasks() {
int workerId = manager.createWorker("Alfred");
assertThrows(IllegalArgumentException.class, () -> manager.editTask(workerId, 99969, "I", "am Illegal"));
assertThrows(IllegalArgumentException.class, () -> manager.editTask(22200, 99969, "I", "am Illegal"));
}
@Test
@DisplayName("Assert Add Task is programmed defensively")
public void assertAddTaskOnlyAcceptsValidParameters() {
int workerId = manager.createWorker("Alfred");
assertThrows(IllegalArgumentException.class, () -> manager.addTask( 20203,"I", "am Illegal"));
assertThrows(IllegalArgumentException.class, () -> manager.addTask( workerId,null, null));
}
@Test
@DisplayName("Assert that Remove Task is programmed defensively")
public void assertRemoveTaskOnlyAcceptsValidParameters() {
assertThrows(IllegalArgumentException.class, () -> manager.removeTask(20320));
}
@Test
@DisplayName("Assert that un-/finishing a Task only works with valid parameters")
public void assertTaskStateChangesOnlyAcceptsValidParameters() {
assertThrows(IllegalArgumentException.class, () -> manager.finishTask(20405, 21034));
assertThrows(IllegalArgumentException.class, () -> manager.unfinishTask(20405, 21034));
}
}