ScannerImplementation #5
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -650,7 +650,7 @@ code + .copy-button {
|
|||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
function configurationCacheProblems() { return (
|
function configurationCacheProblems() { return (
|
||||||
// begin-report-data
|
// 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
|
// end-report-data
|
||||||
);}
|
);}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -41,7 +41,7 @@
|
|||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div class="infoBox" id="duration">
|
<div class="infoBox" id="duration">
|
||||||
<div class="counter">0.021s</div>
|
<div class="counter">0.016s</div>
|
||||||
<p>duration</p>
|
<p>duration</p>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
@@ -87,7 +87,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td class="success">Assert only existing tasks can be edited</td>
|
<td class="success">Assert only existing tasks can be edited</td>
|
||||||
<td class="success">assertEditOnlyExistingTasks()</td>
|
<td class="success">assertEditOnlyExistingTasks()</td>
|
||||||
<td class="success">0.004s</td>
|
<td class="success">0.003s</td>
|
||||||
<td class="success">passed</td>
|
<td class="success">passed</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -99,19 +99,19 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td class="success">Assert List isn't empty after adding a task</td>
|
<td class="success">Assert List isn't empty after adding a task</td>
|
||||||
<td class="success">assertListNowEmptyAfterAdd()</td>
|
<td class="success">assertListNowEmptyAfterAdd()</td>
|
||||||
<td class="success">0.004s</td>
|
<td class="success">0.002s</td>
|
||||||
<td class="success">passed</td>
|
<td class="success">passed</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="success">Assert that added tasks can't be Null</td>
|
<td class="success">Assert that added tasks can't be Null</td>
|
||||||
<td class="success">assertNewTasksAreNotNull()</td>
|
<td class="success">assertNewTasksAreNotNull()</td>
|
||||||
<td class="success">0.003s</td>
|
<td class="success">0.002s</td>
|
||||||
<td class="success">passed</td>
|
<td class="success">passed</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="success">Assert that Remove Task is programmed defensively</td>
|
<td class="success">Assert that Remove Task is programmed defensively</td>
|
||||||
<td class="success">assertRemoveTaskOnlyAcceptsValidParameters()</td>
|
<td class="success">assertRemoveTaskOnlyAcceptsValidParameters()</td>
|
||||||
<td class="success">0.002s</td>
|
<td class="success">0.001s</td>
|
||||||
<td class="success">passed</td>
|
<td class="success">passed</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -143,7 +143,7 @@
|
|||||||
<input id="line-wrapping-toggle" type="checkbox" autocomplete="off"/>
|
<input id="line-wrapping-toggle" type="checkbox" autocomplete="off"/>
|
||||||
</label>
|
</label>
|
||||||
</div>Generated by
|
</div>Generated by
|
||||||
<a href="https://www.gradle.org">Gradle 8.14</a> at 04.01.2026, 16:32:20</p>
|
<a href="https://www.gradle.org">Gradle 8.14</a> at 06.01.2026, 19:34:44</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div class="infoBox" id="failures">
|
<div class="infoBox" id="failures">
|
||||||
<div class="counter">2</div>
|
<div class="counter">1</div>
|
||||||
<p>failures</p>
|
<p>failures</p>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
@@ -41,7 +41,7 @@
|
|||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div class="infoBox" id="duration">
|
<div class="infoBox" id="duration">
|
||||||
<div class="counter">0.051s</div>
|
<div class="counter">0.085s</div>
|
||||||
<p>duration</p>
|
<p>duration</p>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
@@ -51,7 +51,7 @@
|
|||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div class="infoBox failures" id="successRate">
|
<div class="infoBox failures" id="successRate">
|
||||||
<div class="percent">84%</div>
|
<div class="percent">92%</div>
|
||||||
<p>successful</p>
|
<p>successful</p>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
@@ -73,24 +73,6 @@
|
|||||||
<div class="tab">
|
<div class="tab">
|
||||||
<h2>Failed tests</h2>
|
<h2>Failed tests</h2>
|
||||||
<div class="test">
|
<div class="test">
|
||||||
<a name="assertEditingTasksIsPossibleThroughUi()"></a>
|
|
||||||
<h3 class="failures">Check that editing is possible through UI</h3>
|
|
||||||
<span class="code">
|
|
||||||
<pre>org.opentest4j.AssertionFailedError: expected: <Walk> but was: <Run>
|
|
||||||
at app//org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
|
|
||||||
at app//org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
|
|
||||||
at app//org.junit.jupiter.api.AssertEquals.failNotEqual(AssertEquals.java:197)
|
|
||||||
at app//org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:182)
|
|
||||||
at app//org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:177)
|
|
||||||
at app//org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:1141)
|
|
||||||
at app//hhn.temp.project.GoodCasesTest.assertEditingTasksIsPossibleThroughUi(GoodCasesTest.java:133)
|
|
||||||
at java.base@17.0.2/java.lang.reflect.Method.invoke(Method.java:568)
|
|
||||||
at java.base@17.0.2/java.util.ArrayList.forEach(ArrayList.java:1511)
|
|
||||||
at java.base@17.0.2/java.util.ArrayList.forEach(ArrayList.java:1511)
|
|
||||||
</pre>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div class="test">
|
|
||||||
<a name="assertRemoveWorkerActuallyRemoves()"></a>
|
<a name="assertRemoveWorkerActuallyRemoves()"></a>
|
||||||
<h3 class="failures">Assert that removing a worker removes the worker from the worker list</h3>
|
<h3 class="failures">Assert that removing a worker removes the worker from the worker list</h3>
|
||||||
<span class="code">
|
<span class="code">
|
||||||
@@ -121,7 +103,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td class="success">Check that every required surface command actually works</td>
|
<td class="success">Check that every required surface command actually works</td>
|
||||||
<td class="success">assertCommandsAreRecognized()</td>
|
<td class="success">assertCommandsAreRecognized()</td>
|
||||||
<td class="success">0.004s</td>
|
<td class="success">0.017s</td>
|
||||||
<td class="success">passed</td>
|
<td class="success">passed</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -131,51 +113,51 @@
|
|||||||
<td class="success">passed</td>
|
<td class="success">passed</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="failures">Check that editing is possible through UI</td>
|
<td class="success">Check that editing is possible through UI</td>
|
||||||
<td class="failures">assertEditingTasksIsPossibleThroughUi()</td>
|
<td class="success">assertEditingTasksIsPossibleThroughUi()</td>
|
||||||
<td class="failures">0.008s</td>
|
<td class="success">0.014s</td>
|
||||||
<td class="failures">failed</td>
|
<td class="success">passed</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="success">Assert existing Tasks can be edited</td>
|
<td class="success">Assert existing Tasks can be edited</td>
|
||||||
<td class="success">assertExistingTasksCanBeEdited()</td>
|
<td class="success">assertExistingTasksCanBeEdited()</td>
|
||||||
<td class="success">0.003s</td>
|
<td class="success">0.001s</td>
|
||||||
<td class="success">passed</td>
|
<td class="success">passed</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="success">Check that every task command works</td>
|
<td class="success">Check that every task command works</td>
|
||||||
<td class="success">assertFinishingTasksIsPossibleThroughUi()</td>
|
<td class="success">assertFinishingTasksIsPossibleThroughUi()</td>
|
||||||
<td class="success">0.005s</td>
|
<td class="success">0.008s</td>
|
||||||
<td class="success">passed</td>
|
<td class="success">passed</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="success">Check Getters</td>
|
<td class="success">Check Getters</td>
|
||||||
<td class="success">assertGettersWorkCorrectly()</td>
|
<td class="success">assertGettersWorkCorrectly()</td>
|
||||||
<td class="success">0.014s</td>
|
<td class="success">0.019s</td>
|
||||||
<td class="success">passed</td>
|
<td class="success">passed</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="failures">Assert that removing a worker removes the worker from the worker list</td>
|
<td class="failures">Assert that removing a worker removes the worker from the worker list</td>
|
||||||
<td class="failures">assertRemoveWorkerActuallyRemoves()</td>
|
<td class="failures">assertRemoveWorkerActuallyRemoves()</td>
|
||||||
<td class="failures">0.005s</td>
|
<td class="failures">0.012s</td>
|
||||||
<td class="failures">failed</td>
|
<td class="failures">failed</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="success">Assert that removing Workers is possible through the UI</td>
|
<td class="success">Assert that removing Workers is possible through the UI</td>
|
||||||
<td class="success">assertRemovingWorkersIsPossibleThroughUI()</td>
|
<td class="success">assertRemovingWorkersIsPossibleThroughUI()</td>
|
||||||
<td class="success">0.002s</td>
|
<td class="success">0.005s</td>
|
||||||
<td class="success">passed</td>
|
<td class="success">passed</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="success">Assert that the Scanner is actually started when AM calls start</td>
|
<td class="success">Assert that the Scanner is actually started when AM calls start</td>
|
||||||
<td class="success">assertScannerExists()</td>
|
<td class="success">assertScannerExists()</td>
|
||||||
<td class="success">0.002s</td>
|
<td class="success">0.001s</td>
|
||||||
<td class="success">passed</td>
|
<td class="success">passed</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="success">Assert that Task State is actually changed when submitted as finished</td>
|
<td class="success">Assert that Task State is actually changed when submitted as finished</td>
|
||||||
<td class="success">assertTaskStateChanges()</td>
|
<td class="success">assertTaskStateChanges()</td>
|
||||||
<td class="success">0.004s</td>
|
<td class="success">0.002s</td>
|
||||||
<td class="success">passed</td>
|
<td class="success">passed</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -187,7 +169,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td class="success">Assert that a Worker can add a Task</td>
|
<td class="success">Assert that a Worker can add a Task</td>
|
||||||
<td class="success">assertWorkerCanAddTask()</td>
|
<td class="success">assertWorkerCanAddTask()</td>
|
||||||
<td class="success">0.001s</td>
|
<td class="success">0.003s</td>
|
||||||
<td class="success">passed</td>
|
<td class="success">passed</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -201,35 +183,74 @@
|
|||||||
<div class="tab">
|
<div class="tab">
|
||||||
<h2>Standard output</h2>
|
<h2>Standard output</h2>
|
||||||
<span class="code">
|
<span class="code">
|
||||||
<pre>Enter task ID: Error: Cannot invoke "java.util.Scanner.nextLine()" because "this.scanner" is null
|
<pre>Enter task ID:
|
||||||
Enter new name;description: Error: Cannot invoke "java.util.Scanner.nextLine()" because "this.scanner" is null
|
Task 1 (Run) selected
|
||||||
Unknown command. Type 'help' for available commands.
|
Commands: finish, unfinish, remove, edit, back
|
||||||
Available commands:
|
Enter new name;description:
|
||||||
createWorker - Create a new worker
|
Task edited
|
||||||
createTask - Create a new task
|
=== Available Commands ===
|
||||||
selectTask - Select a task to work with
|
General:
|
||||||
listWorkers - List all workers
|
help, ? - Show this help
|
||||||
help/? - Show this help
|
|
||||||
exit - Exit the program
|
exit - Exit the program
|
||||||
Available commands:
|
listworkers - List all workers and select one
|
||||||
createWorker - Create a new worker
|
selecttask - Select a task by ID
|
||||||
createTask - Create a new task
|
createtask - Create a new task
|
||||||
selectTask - Select a task to work with
|
createworker - Create a new worker
|
||||||
listWorkers - List all workers
|
listtasks - List all tasks
|
||||||
help/? - Show this help
|
listunfinished - List unfinished tasks
|
||||||
|
listfinished - List finished tasks
|
||||||
|
|
||||||
|
When a task is selected:
|
||||||
|
finish - Mark task as finished
|
||||||
|
unfinish - Mark task as unfinished
|
||||||
|
remove - Remove the task
|
||||||
|
edit - Edit task name and description
|
||||||
|
back - Return to main menu
|
||||||
|
|
||||||
|
When a worker is selected:
|
||||||
|
remove - Remove the worker
|
||||||
|
back - Return to main menu
|
||||||
|
=== Available Commands ===
|
||||||
|
General:
|
||||||
|
help, ? - Show this help
|
||||||
exit - Exit the program
|
exit - Exit the program
|
||||||
Enter worker name: Error: Cannot invoke "java.util.Scanner.nextLine()" because "this.scanner" is null
|
listworkers - List all workers and select one
|
||||||
Enter worker ID: Error: Cannot invoke "java.util.Scanner.nextLine()" because "this.scanner" is null
|
selecttask - Select a task by ID
|
||||||
Enter task ID: Error: Cannot invoke "java.util.Scanner.nextLine()" because "this.scanner" is null
|
createtask - Create a new task
|
||||||
Unknown command. Type 'help' for available commands.
|
createworker - Create a new worker
|
||||||
Unknown command. Type 'help' for available commands.
|
listtasks - List all tasks
|
||||||
Enter task ID: Error: Cannot invoke "java.util.Scanner.nextLine()" because "this.scanner" is null
|
listunfinished - List unfinished tasks
|
||||||
|
listfinished - List finished tasks
|
||||||
|
|
||||||
|
When a task is selected:
|
||||||
|
finish - Mark task as finished
|
||||||
|
unfinish - Mark task as unfinished
|
||||||
|
remove - Remove the task
|
||||||
|
edit - Edit task name and description
|
||||||
|
back - Return to main menu
|
||||||
|
|
||||||
|
When a worker is selected:
|
||||||
|
remove - Remove the worker
|
||||||
|
back - Return to main menu
|
||||||
|
Enter worker name:
|
||||||
|
Created worker with ID: 1
|
||||||
|
Enter task ID:
|
||||||
|
Invalid input. Please enter a task ID or 'back':
|
||||||
|
Invalid input. Please enter a task ID or 'back':
|
||||||
|
Enter task ID:
|
||||||
|
Task 1 (Run) selected
|
||||||
|
Commands: finish, unfinish, remove, edit, back
|
||||||
Task marked as finished
|
Task marked as finished
|
||||||
Task marked as unfinished
|
Task marked as unfinished
|
||||||
Task removed
|
Task removed
|
||||||
Unknown command. Type 'help' for available commands.
|
Unknown command. Type 'help' for available commands.
|
||||||
Unknown command. Type 'help' for available commands.
|
Unknown command. Type 'help' for available commands.
|
||||||
Enter worker ID: Error: Cannot invoke "java.util.Scanner.nextLine()" because "this.scanner" is null
|
Available workers:
|
||||||
|
1: Alfred
|
||||||
|
2: Balfred
|
||||||
|
Enter worker ID to select (or 'back'):
|
||||||
|
Worker 1 (Alfred) selected
|
||||||
|
Commands: remove, back
|
||||||
Worker removed
|
Worker removed
|
||||||
Unknown command. Type 'help' for available commands.
|
Unknown command. Type 'help' for available commands.
|
||||||
Unknown command. Type 'help' for available commands.
|
Unknown command. Type 'help' for available commands.
|
||||||
@@ -244,7 +265,7 @@ Unknown command. Type 'help' for available commands.
|
|||||||
<input id="line-wrapping-toggle" type="checkbox" autocomplete="off"/>
|
<input id="line-wrapping-toggle" type="checkbox" autocomplete="off"/>
|
||||||
</label>
|
</label>
|
||||||
</div>Generated by
|
</div>Generated by
|
||||||
<a href="https://www.gradle.org">Gradle 8.14</a> at 04.01.2026, 16:32:20</p>
|
<a href="https://www.gradle.org">Gradle 8.14</a> at 06.01.2026, 19:34:44</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div class="infoBox" id="failures">
|
<div class="infoBox" id="failures">
|
||||||
<div class="counter">5</div>
|
<div class="counter">4</div>
|
||||||
<p>failures</p>
|
<p>failures</p>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
@@ -38,7 +38,7 @@
|
|||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div class="infoBox" id="duration">
|
<div class="infoBox" id="duration">
|
||||||
<div class="counter">1.810s</div>
|
<div class="counter">1.063s</div>
|
||||||
<p>duration</p>
|
<p>duration</p>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
@@ -48,7 +48,7 @@
|
|||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div class="infoBox failures" id="successRate">
|
<div class="infoBox failures" id="successRate">
|
||||||
<div class="percent">80%</div>
|
<div class="percent">84%</div>
|
||||||
<p>successful</p>
|
<p>successful</p>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
@@ -84,10 +84,6 @@
|
|||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="classes/hhn.temp.project.GoodCasesTest.html">GoodCasesTest</a>.
|
<a href="classes/hhn.temp.project.GoodCasesTest.html">GoodCasesTest</a>.
|
||||||
<a href="classes/hhn.temp.project.GoodCasesTest.html#assertEditingTasksIsPossibleThroughUi()">Check that editing is possible through UI</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href="classes/hhn.temp.project.GoodCasesTest.html">GoodCasesTest</a>.
|
|
||||||
<a href="classes/hhn.temp.project.GoodCasesTest.html#assertRemoveWorkerActuallyRemoves()">Assert that removing a worker removes the worker from the worker list</a>
|
<a href="classes/hhn.temp.project.GoodCasesTest.html#assertRemoveWorkerActuallyRemoves()">Assert that removing a worker removes the worker from the worker list</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
@@ -111,10 +107,10 @@
|
|||||||
<a href="packages/hhn.temp.project.html">hhn.temp.project</a>
|
<a href="packages/hhn.temp.project.html">hhn.temp.project</a>
|
||||||
</td>
|
</td>
|
||||||
<td>25</td>
|
<td>25</td>
|
||||||
<td>5</td>
|
<td>4</td>
|
||||||
<td>0</td>
|
<td>0</td>
|
||||||
<td>1.810s</td>
|
<td>1.063s</td>
|
||||||
<td class="failures">80%</td>
|
<td class="failures">84%</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
@@ -140,7 +136,7 @@
|
|||||||
<td>8</td>
|
<td>8</td>
|
||||||
<td>0</td>
|
<td>0</td>
|
||||||
<td>0</td>
|
<td>0</td>
|
||||||
<td>0.021s</td>
|
<td>0.016s</td>
|
||||||
<td class="success">100%</td>
|
<td class="success">100%</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -150,7 +146,7 @@
|
|||||||
<td>1</td>
|
<td>1</td>
|
||||||
<td>0</td>
|
<td>0</td>
|
||||||
<td>0</td>
|
<td>0</td>
|
||||||
<td>0.027s</td>
|
<td>0.070s</td>
|
||||||
<td class="success">100%</td>
|
<td class="success">100%</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -160,7 +156,7 @@
|
|||||||
<td>3</td>
|
<td>3</td>
|
||||||
<td>3</td>
|
<td>3</td>
|
||||||
<td>0</td>
|
<td>0</td>
|
||||||
<td>1.711s</td>
|
<td>0.892s</td>
|
||||||
<td class="failures">0%</td>
|
<td class="failures">0%</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -168,10 +164,10 @@
|
|||||||
<a href="classes/hhn.temp.project.GoodCasesTest.html">hhn.temp.project.GoodCasesTest</a>
|
<a href="classes/hhn.temp.project.GoodCasesTest.html">hhn.temp.project.GoodCasesTest</a>
|
||||||
</td>
|
</td>
|
||||||
<td>13</td>
|
<td>13</td>
|
||||||
<td>2</td>
|
<td>1</td>
|
||||||
<td>0</td>
|
<td>0</td>
|
||||||
<td>0.051s</td>
|
<td>0.085s</td>
|
||||||
<td class="failures">84%</td>
|
<td class="failures">92%</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
@@ -184,7 +180,7 @@
|
|||||||
<input id="line-wrapping-toggle" type="checkbox" autocomplete="off"/>
|
<input id="line-wrapping-toggle" type="checkbox" autocomplete="off"/>
|
||||||
</label>
|
</label>
|
||||||
</div>Generated by
|
</div>Generated by
|
||||||
<a href="https://www.gradle.org">Gradle 8.14</a> at 04.01.2026, 16:32:20</p>
|
<a href="https://www.gradle.org">Gradle 8.14</a> at 06.01.2026, 19:34:44</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div class="infoBox" id="failures">
|
<div class="infoBox" id="failures">
|
||||||
<div class="counter">5</div>
|
<div class="counter">4</div>
|
||||||
<p>failures</p>
|
<p>failures</p>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
@@ -40,7 +40,7 @@
|
|||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div class="infoBox" id="duration">
|
<div class="infoBox" id="duration">
|
||||||
<div class="counter">1.810s</div>
|
<div class="counter">1.063s</div>
|
||||||
<p>duration</p>
|
<p>duration</p>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
@@ -50,7 +50,7 @@
|
|||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div class="infoBox failures" id="successRate">
|
<div class="infoBox failures" id="successRate">
|
||||||
<div class="percent">80%</div>
|
<div class="percent">84%</div>
|
||||||
<p>successful</p>
|
<p>successful</p>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
@@ -83,10 +83,6 @@
|
|||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="../classes/hhn.temp.project.GoodCasesTest.html">GoodCasesTest</a>.
|
<a href="../classes/hhn.temp.project.GoodCasesTest.html">GoodCasesTest</a>.
|
||||||
<a href="../classes/hhn.temp.project.GoodCasesTest.html#assertEditingTasksIsPossibleThroughUi()">Check that editing is possible through UI</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href="../classes/hhn.temp.project.GoodCasesTest.html">GoodCasesTest</a>.
|
|
||||||
<a href="../classes/hhn.temp.project.GoodCasesTest.html#assertRemoveWorkerActuallyRemoves()">Assert that removing a worker removes the worker from the worker list</a>
|
<a href="../classes/hhn.temp.project.GoodCasesTest.html#assertRemoveWorkerActuallyRemoves()">Assert that removing a worker removes the worker from the worker list</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
@@ -111,7 +107,7 @@
|
|||||||
<td>8</td>
|
<td>8</td>
|
||||||
<td>0</td>
|
<td>0</td>
|
||||||
<td>0</td>
|
<td>0</td>
|
||||||
<td>0.021s</td>
|
<td>0.016s</td>
|
||||||
<td class="success">100%</td>
|
<td class="success">100%</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -121,7 +117,7 @@
|
|||||||
<td>1</td>
|
<td>1</td>
|
||||||
<td>0</td>
|
<td>0</td>
|
||||||
<td>0</td>
|
<td>0</td>
|
||||||
<td>0.027s</td>
|
<td>0.070s</td>
|
||||||
<td class="success">100%</td>
|
<td class="success">100%</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -131,7 +127,7 @@
|
|||||||
<td>3</td>
|
<td>3</td>
|
||||||
<td>3</td>
|
<td>3</td>
|
||||||
<td>0</td>
|
<td>0</td>
|
||||||
<td>1.711s</td>
|
<td>0.892s</td>
|
||||||
<td class="failures">0%</td>
|
<td class="failures">0%</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -139,10 +135,10 @@
|
|||||||
<a href="../classes/hhn.temp.project.GoodCasesTest.html">GoodCasesTest</a>
|
<a href="../classes/hhn.temp.project.GoodCasesTest.html">GoodCasesTest</a>
|
||||||
</td>
|
</td>
|
||||||
<td>13</td>
|
<td>13</td>
|
||||||
<td>2</td>
|
<td>1</td>
|
||||||
<td>0</td>
|
<td>0</td>
|
||||||
<td>0.051s</td>
|
<td>0.085s</td>
|
||||||
<td class="failures">84%</td>
|
<td class="failures">92%</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
@@ -154,7 +150,7 @@
|
|||||||
<input id="line-wrapping-toggle" type="checkbox" autocomplete="off"/>
|
<input id="line-wrapping-toggle" type="checkbox" autocomplete="off"/>
|
||||||
</label>
|
</label>
|
||||||
</div>Generated by
|
</div>Generated by
|
||||||
<a href="https://www.gradle.org">Gradle 8.14</a> at 04.01.2026, 16:32:20</p>
|
<a href="https://www.gradle.org">Gradle 8.14</a> at 06.01.2026, 19:34:44</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<testsuite name="hhn.temp.project.BadCasesTest" tests="8" skipped="0" failures="0" errors="0" timestamp="2026-01-04T15:32:20.146Z" hostname="KEVIN-THINKPAD" time="0.035">
|
<testsuite name="hhn.temp.project.BadCasesTest" tests="8" skipped="0" failures="0" errors="0" timestamp="2026-01-06T18:34:44.742Z" hostname="KEVIN-THINKPAD" time="0.026">
|
||||||
<properties/>
|
<properties/>
|
||||||
<testcase name="Assert List isn't empty after adding a task" classname="hhn.temp.project.BadCasesTest" time="0.004"/>
|
<testcase name="Assert List isn't empty after adding a task" classname="hhn.temp.project.BadCasesTest" time="0.002"/>
|
||||||
<testcase name="Assert non-existent commands are recognized as such" classname="hhn.temp.project.BadCasesTest" time="0.001"/>
|
<testcase name="Assert non-existent commands are recognized as such" classname="hhn.temp.project.BadCasesTest" time="0.001"/>
|
||||||
<testcase name="Assert that Remove Task is programmed defensively" classname="hhn.temp.project.BadCasesTest" time="0.002"/>
|
<testcase name="Assert that Remove Task is programmed defensively" classname="hhn.temp.project.BadCasesTest" time="0.001"/>
|
||||||
<testcase name="Assert that removing a non-existent worker throws an Exception" classname="hhn.temp.project.BadCasesTest" time="0.002"/>
|
<testcase name="Assert that removing a non-existent worker throws an Exception" classname="hhn.temp.project.BadCasesTest" time="0.002"/>
|
||||||
<testcase name="Assert Add Task is programmed defensively" classname="hhn.temp.project.BadCasesTest" time="0.002"/>
|
<testcase name="Assert Add Task is programmed defensively" classname="hhn.temp.project.BadCasesTest" time="0.002"/>
|
||||||
<testcase name="Assert only existing tasks can be edited" classname="hhn.temp.project.BadCasesTest" time="0.004"/>
|
<testcase name="Assert only existing tasks can be edited" classname="hhn.temp.project.BadCasesTest" time="0.003"/>
|
||||||
<testcase name="Assert that un-/finishing a Task only works with valid parameters" classname="hhn.temp.project.BadCasesTest" time="0.003"/>
|
<testcase name="Assert that un-/finishing a Task only works with valid parameters" classname="hhn.temp.project.BadCasesTest" time="0.003"/>
|
||||||
<testcase name="Assert that added tasks can't be Null" classname="hhn.temp.project.BadCasesTest" time="0.003"/>
|
<testcase name="Assert that added tasks can't be Null" classname="hhn.temp.project.BadCasesTest" time="0.002"/>
|
||||||
<system-out><![CDATA[Unknown command. Type 'help' for available commands.
|
<system-out><![CDATA[Unknown command. Type 'help' for available commands.
|
||||||
]]></system-out>
|
]]></system-out>
|
||||||
<system-err><![CDATA[]]></system-err>
|
<system-err><![CDATA[]]></system-err>
|
||||||
|
|||||||
@@ -1,29 +1,16 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<testsuite name="hhn.temp.project.GoodCasesTest" tests="13" skipped="0" failures="2" errors="0" timestamp="2026-01-04T15:32:20.071Z" hostname="KEVIN-THINKPAD" time="0.067">
|
<testsuite name="hhn.temp.project.GoodCasesTest" tests="13" skipped="0" failures="1" errors="0" timestamp="2026-01-06T18:34:44.633Z" hostname="KEVIN-THINKPAD" time="0.105">
|
||||||
<properties/>
|
<properties/>
|
||||||
<testcase name="Check Getters" classname="hhn.temp.project.GoodCasesTest" time="0.014"/>
|
<testcase name="Check Getters" classname="hhn.temp.project.GoodCasesTest" time="0.019"/>
|
||||||
<testcase name="Check that editing is possible through UI" classname="hhn.temp.project.GoodCasesTest" time="0.008">
|
<testcase name="Check that editing is possible through UI" classname="hhn.temp.project.GoodCasesTest" time="0.014"/>
|
||||||
<failure message="org.opentest4j.AssertionFailedError: expected: <Walk> but was: <Run>" type="org.opentest4j.AssertionFailedError">org.opentest4j.AssertionFailedError: expected: <Walk> but was: <Run>
|
<testcase name="Check that every required surface command actually works" classname="hhn.temp.project.GoodCasesTest" time="0.017"/>
|
||||||
at app//org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
|
|
||||||
at app//org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
|
|
||||||
at app//org.junit.jupiter.api.AssertEquals.failNotEqual(AssertEquals.java:197)
|
|
||||||
at app//org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:182)
|
|
||||||
at app//org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:177)
|
|
||||||
at app//org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:1141)
|
|
||||||
at app//hhn.temp.project.GoodCasesTest.assertEditingTasksIsPossibleThroughUi(GoodCasesTest.java:133)
|
|
||||||
at java.base@17.0.2/java.lang.reflect.Method.invoke(Method.java:568)
|
|
||||||
at java.base@17.0.2/java.util.ArrayList.forEach(ArrayList.java:1511)
|
|
||||||
at java.base@17.0.2/java.util.ArrayList.forEach(ArrayList.java:1511)
|
|
||||||
</failure>
|
|
||||||
</testcase>
|
|
||||||
<testcase name="Check that every required surface command actually works" classname="hhn.temp.project.GoodCasesTest" time="0.004"/>
|
|
||||||
<testcase name="Assert that added Tasks are added to the List" classname="hhn.temp.project.GoodCasesTest" time="0.001"/>
|
<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 Worker can remove Task" classname="hhn.temp.project.GoodCasesTest" time="0.001"/>
|
||||||
<testcase name="Check that every task command works" classname="hhn.temp.project.GoodCasesTest" time="0.005"/>
|
<testcase name="Check that every task command works" classname="hhn.temp.project.GoodCasesTest" time="0.008"/>
|
||||||
<testcase name="Assert that a Worker can add a 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.003"/>
|
||||||
<testcase name="Assert that removing Workers is possible through the UI" classname="hhn.temp.project.GoodCasesTest" time="0.002"/>
|
<testcase name="Assert that removing Workers is possible through the UI" classname="hhn.temp.project.GoodCasesTest" time="0.005"/>
|
||||||
<testcase name="Assert existing Tasks can be edited" classname="hhn.temp.project.GoodCasesTest" time="0.003"/>
|
<testcase name="Assert existing Tasks can be edited" classname="hhn.temp.project.GoodCasesTest" time="0.001"/>
|
||||||
<testcase name="Assert that removing a worker removes the worker from the worker list" classname="hhn.temp.project.GoodCasesTest" time="0.005">
|
<testcase name="Assert that removing a worker removes the worker from the worker list" classname="hhn.temp.project.GoodCasesTest" time="0.012">
|
||||||
<failure message="org.opentest4j.AssertionFailedError: Expected java.lang.IllegalArgumentException to be thrown, but nothing was thrown." type="org.opentest4j.AssertionFailedError">org.opentest4j.AssertionFailedError: Expected java.lang.IllegalArgumentException to be thrown, but nothing was thrown.
|
<failure message="org.opentest4j.AssertionFailedError: Expected java.lang.IllegalArgumentException to be thrown, but nothing was thrown." type="org.opentest4j.AssertionFailedError">org.opentest4j.AssertionFailedError: Expected java.lang.IllegalArgumentException to be thrown, but nothing was thrown.
|
||||||
at app//org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:152)
|
at app//org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:152)
|
||||||
at app//org.junit.jupiter.api.AssertThrows.assertThrows(AssertThrows.java:73)
|
at app//org.junit.jupiter.api.AssertThrows.assertThrows(AssertThrows.java:73)
|
||||||
@@ -35,38 +22,77 @@
|
|||||||
at java.base@17.0.2/java.util.ArrayList.forEach(ArrayList.java:1511)
|
at java.base@17.0.2/java.util.ArrayList.forEach(ArrayList.java:1511)
|
||||||
</failure>
|
</failure>
|
||||||
</testcase>
|
</testcase>
|
||||||
<testcase name="Assert that the Scanner is actually started when AM calls start" classname="hhn.temp.project.GoodCasesTest" time="0.002"/>
|
<testcase name="Assert that the Scanner is actually started when AM calls start" 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.004"/>
|
<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.001"/>
|
<testcase name="Assert deleted Tasks no longer show up in the List" classname="hhn.temp.project.GoodCasesTest" time="0.001"/>
|
||||||
<system-out><![CDATA[Enter task ID: Error: Cannot invoke "java.util.Scanner.nextLine()" because "this.scanner" is null
|
<system-out><![CDATA[Enter task ID:
|
||||||
Enter new name;description: Error: Cannot invoke "java.util.Scanner.nextLine()" because "this.scanner" is null
|
Task 1 (Run) selected
|
||||||
Unknown command. Type 'help' for available commands.
|
Commands: finish, unfinish, remove, edit, back
|
||||||
Available commands:
|
Enter new name;description:
|
||||||
createWorker - Create a new worker
|
Task edited
|
||||||
createTask - Create a new task
|
=== Available Commands ===
|
||||||
selectTask - Select a task to work with
|
General:
|
||||||
listWorkers - List all workers
|
help, ? - Show this help
|
||||||
help/? - Show this help
|
|
||||||
exit - Exit the program
|
exit - Exit the program
|
||||||
Available commands:
|
listworkers - List all workers and select one
|
||||||
createWorker - Create a new worker
|
selecttask - Select a task by ID
|
||||||
createTask - Create a new task
|
createtask - Create a new task
|
||||||
selectTask - Select a task to work with
|
createworker - Create a new worker
|
||||||
listWorkers - List all workers
|
listtasks - List all tasks
|
||||||
help/? - Show this help
|
listunfinished - List unfinished tasks
|
||||||
|
listfinished - List finished tasks
|
||||||
|
|
||||||
|
When a task is selected:
|
||||||
|
finish - Mark task as finished
|
||||||
|
unfinish - Mark task as unfinished
|
||||||
|
remove - Remove the task
|
||||||
|
edit - Edit task name and description
|
||||||
|
back - Return to main menu
|
||||||
|
|
||||||
|
When a worker is selected:
|
||||||
|
remove - Remove the worker
|
||||||
|
back - Return to main menu
|
||||||
|
=== Available Commands ===
|
||||||
|
General:
|
||||||
|
help, ? - Show this help
|
||||||
exit - Exit the program
|
exit - Exit the program
|
||||||
Enter worker name: Error: Cannot invoke "java.util.Scanner.nextLine()" because "this.scanner" is null
|
listworkers - List all workers and select one
|
||||||
Enter worker ID: Error: Cannot invoke "java.util.Scanner.nextLine()" because "this.scanner" is null
|
selecttask - Select a task by ID
|
||||||
Enter task ID: Error: Cannot invoke "java.util.Scanner.nextLine()" because "this.scanner" is null
|
createtask - Create a new task
|
||||||
Unknown command. Type 'help' for available commands.
|
createworker - Create a new worker
|
||||||
Unknown command. Type 'help' for available commands.
|
listtasks - List all tasks
|
||||||
Enter task ID: Error: Cannot invoke "java.util.Scanner.nextLine()" because "this.scanner" is null
|
listunfinished - List unfinished tasks
|
||||||
|
listfinished - List finished tasks
|
||||||
|
|
||||||
|
When a task is selected:
|
||||||
|
finish - Mark task as finished
|
||||||
|
unfinish - Mark task as unfinished
|
||||||
|
remove - Remove the task
|
||||||
|
edit - Edit task name and description
|
||||||
|
back - Return to main menu
|
||||||
|
|
||||||
|
When a worker is selected:
|
||||||
|
remove - Remove the worker
|
||||||
|
back - Return to main menu
|
||||||
|
Enter worker name:
|
||||||
|
Created worker with ID: 1
|
||||||
|
Enter task ID:
|
||||||
|
Invalid input. Please enter a task ID or 'back':
|
||||||
|
Invalid input. Please enter a task ID or 'back':
|
||||||
|
Enter task ID:
|
||||||
|
Task 1 (Run) selected
|
||||||
|
Commands: finish, unfinish, remove, edit, back
|
||||||
Task marked as finished
|
Task marked as finished
|
||||||
Task marked as unfinished
|
Task marked as unfinished
|
||||||
Task removed
|
Task removed
|
||||||
Unknown command. Type 'help' for available commands.
|
Unknown command. Type 'help' for available commands.
|
||||||
Unknown command. Type 'help' for available commands.
|
Unknown command. Type 'help' for available commands.
|
||||||
Enter worker ID: Error: Cannot invoke "java.util.Scanner.nextLine()" because "this.scanner" is null
|
Available workers:
|
||||||
|
1: Alfred
|
||||||
|
2: Balfred
|
||||||
|
Enter worker ID to select (or 'back'):
|
||||||
|
Worker 1 (Alfred) selected
|
||||||
|
Commands: remove, back
|
||||||
Worker removed
|
Worker removed
|
||||||
Unknown command. Type 'help' for available commands.
|
Unknown command. Type 'help' for available commands.
|
||||||
Unknown command. Type 'help' for available commands.
|
Unknown command. Type 'help' for available commands.
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -49,6 +49,12 @@ public class AssignmentManager {
|
|||||||
}
|
}
|
||||||
return taskMap.get(taskId);
|
return taskMap.get(taskId);
|
||||||
}
|
}
|
||||||
|
public Worker getWorker(int workerId) {
|
||||||
|
if (!workerMap.containsKey(workerId)) {
|
||||||
|
throw new IllegalArgumentException("Worker Id does not exist");
|
||||||
|
}
|
||||||
|
return workerMap.get(workerId);
|
||||||
|
}
|
||||||
public void editTask(int workerId, int taskId, String name, String description) {
|
public void editTask(int workerId, int taskId, String name, String description) {
|
||||||
if (!workerMap.containsKey(workerId) || !taskMap.containsKey(taskId)) {
|
if (!workerMap.containsKey(workerId) || !taskMap.containsKey(taskId)) {
|
||||||
throw new IllegalArgumentException("Task Id or Worker Id does not exist");
|
throw new IllegalArgumentException("Task Id or Worker Id does not exist");
|
||||||
|
|||||||
@@ -6,8 +6,6 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
|||||||
public class UserCommands implements Runnable {
|
public class UserCommands implements Runnable {
|
||||||
private Scanner scanner;
|
private Scanner scanner;
|
||||||
private AssignmentManager manager;
|
private AssignmentManager manager;
|
||||||
private boolean inTaskSelection = false;
|
|
||||||
private boolean inWorkerSelection = false;
|
|
||||||
private Integer selectedTaskId = null;
|
private Integer selectedTaskId = null;
|
||||||
private Integer selectedWorkerId = null;
|
private Integer selectedWorkerId = null;
|
||||||
private AtomicBoolean running = new AtomicBoolean(false);
|
private AtomicBoolean running = new AtomicBoolean(false);
|
||||||
@@ -21,7 +19,8 @@ public class UserCommands implements Runnable {
|
|||||||
AWAITING_CREATE_TASK_WORKER,
|
AWAITING_CREATE_TASK_WORKER,
|
||||||
AWAITING_CREATE_TASK_NAME,
|
AWAITING_CREATE_TASK_NAME,
|
||||||
AWAITING_CREATE_TASK_DESC,
|
AWAITING_CREATE_TASK_DESC,
|
||||||
AWAITING_CREATE_WORKER_NAME
|
AWAITING_CREATE_WORKER_NAME,
|
||||||
|
AWAITING_TASK_SELECTION
|
||||||
}
|
}
|
||||||
|
|
||||||
private InputState currentState = InputState.MAIN_MENU;
|
private InputState currentState = InputState.MAIN_MENU;
|
||||||
@@ -68,12 +67,35 @@ public class UserCommands implements Runnable {
|
|||||||
private void printPrompt() {
|
private void printPrompt() {
|
||||||
if (!running.get()) return;
|
if (!running.get()) return;
|
||||||
|
|
||||||
if (inTaskSelection && selectedTaskId != null) {
|
switch (currentState) {
|
||||||
|
case MAIN_MENU:
|
||||||
|
System.out.println("Type '?' or 'help' for a list of commands");
|
||||||
|
break;
|
||||||
|
case TASK_SELECTED:
|
||||||
System.out.println("Task " + selectedTaskId + " selected. Commands: finish, unfinish, remove, edit, back");
|
System.out.println("Task " + selectedTaskId + " selected. Commands: finish, unfinish, remove, edit, back");
|
||||||
} else if (inWorkerSelection && selectedWorkerId != null) {
|
break;
|
||||||
|
case WORKER_SELECTED:
|
||||||
|
if (selectedWorkerId != null) {
|
||||||
System.out.println("Worker " + selectedWorkerId + " selected. Commands: remove, back");
|
System.out.println("Worker " + selectedWorkerId + " selected. Commands: remove, back");
|
||||||
} else {
|
} else {
|
||||||
System.out.println("Type '?' or 'help' for a list of commands");
|
System.out.println("Enter worker ID to select (or 'back'):");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case AWAITING_EDIT_INPUT:
|
||||||
|
System.out.println("Enter new name;description:");
|
||||||
|
break;
|
||||||
|
case AWAITING_CREATE_WORKER_NAME:
|
||||||
|
System.out.println("Enter worker name:");
|
||||||
|
break;
|
||||||
|
case AWAITING_CREATE_TASK_WORKER:
|
||||||
|
System.out.println("Enter worker ID:");
|
||||||
|
break;
|
||||||
|
case AWAITING_CREATE_TASK_NAME:
|
||||||
|
System.out.println("Enter task name:");
|
||||||
|
break;
|
||||||
|
case AWAITING_CREATE_TASK_DESC:
|
||||||
|
System.out.println("Enter task description:");
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
System.out.print("> ");
|
System.out.print("> ");
|
||||||
}
|
}
|
||||||
@@ -89,73 +111,90 @@ public class UserCommands implements Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (inTaskSelection) {
|
switch (currentState) {
|
||||||
handleTaskSelectionInput(input);
|
case MAIN_MENU:
|
||||||
} else if (inWorkerSelection) {
|
|
||||||
handleWorkerSelectionInput(input);
|
|
||||||
} else {
|
|
||||||
handleMainMenuInput(input);
|
handleMainMenuInput(input);
|
||||||
|
break;
|
||||||
|
case TASK_SELECTED:
|
||||||
|
handleTaskSelectionInput(input);
|
||||||
|
break;
|
||||||
|
case WORKER_SELECTED:
|
||||||
|
handleWorkerSelectionInput(input);
|
||||||
|
break;
|
||||||
|
case AWAITING_EDIT_INPUT:
|
||||||
|
handleEditInput(input);
|
||||||
|
break;
|
||||||
|
case AWAITING_CREATE_TASK_WORKER:
|
||||||
|
handleCreateTaskWorkerInput(input);
|
||||||
|
break;
|
||||||
|
case AWAITING_CREATE_TASK_NAME:
|
||||||
|
handleCreateTaskNameInput(input);
|
||||||
|
break;
|
||||||
|
case AWAITING_CREATE_TASK_DESC:
|
||||||
|
handleCreateTaskDescInput(input);
|
||||||
|
break;
|
||||||
|
case AWAITING_CREATE_WORKER_NAME:
|
||||||
|
handleCreateWorkerNameInput(input);
|
||||||
|
break;
|
||||||
|
case AWAITING_TASK_SELECTION:
|
||||||
|
handleTaskIdInput(input);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
System.out.println("Error: " + e.getMessage());
|
System.out.println("Error: " + e.getMessage());
|
||||||
|
resetToMainMenu();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showHelp() {
|
private void showHelp() {
|
||||||
if (inTaskSelection && selectedTaskId != null) {
|
System.out.println("=== Available Commands ===");
|
||||||
System.out.println("Task commands:");
|
System.out.println("General:");
|
||||||
|
System.out.println(" help, ? - Show this help");
|
||||||
|
System.out.println(" exit - Exit the program");
|
||||||
|
System.out.println(" listworkers - List all workers and select one");
|
||||||
|
System.out.println(" selecttask - Select a task by ID");
|
||||||
|
System.out.println(" createtask - Create a new task");
|
||||||
|
System.out.println(" createworker - Create a new worker");
|
||||||
|
System.out.println(" listtasks - List all tasks");
|
||||||
|
System.out.println(" listunfinished - List unfinished tasks");
|
||||||
|
System.out.println(" listfinished - List finished tasks");
|
||||||
|
|
||||||
|
System.out.println("\nWhen a task is selected:");
|
||||||
System.out.println(" finish - Mark task as finished");
|
System.out.println(" finish - Mark task as finished");
|
||||||
System.out.println(" unfinish - Mark task as unfinished");
|
System.out.println(" unfinish - Mark task as unfinished");
|
||||||
System.out.println(" remove - Remove this task");
|
System.out.println(" remove - Remove the task");
|
||||||
System.out.println(" edit - Edit task (prompts for name;description)");
|
System.out.println(" edit - Edit task name and description");
|
||||||
System.out.println(" back - Return to main menu");
|
System.out.println(" back - Return to main menu");
|
||||||
} else if (inWorkerSelection && selectedWorkerId != null) {
|
|
||||||
System.out.println("Worker commands:");
|
System.out.println("\nWhen a worker is selected:");
|
||||||
System.out.println(" remove - Remove this worker");
|
System.out.println(" remove - Remove the worker");
|
||||||
System.out.println(" back - Return to main menu");
|
System.out.println(" back - Return to main menu");
|
||||||
} else {
|
|
||||||
System.out.println("Available commands:");
|
|
||||||
System.out.println(" createWorker - Create a new worker");
|
|
||||||
System.out.println(" createTask - Create a new task");
|
|
||||||
System.out.println(" selectTask - Select a task to work with");
|
|
||||||
System.out.println(" listWorkers - List all workers");
|
|
||||||
System.out.println(" help/? - Show this help");
|
|
||||||
System.out.println(" exit - Exit the program");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleMainMenuInput(String input) {
|
private void handleMainMenuInput(String input) {
|
||||||
switch (input.toLowerCase()) {
|
switch (input.toLowerCase()) {
|
||||||
case "createworker":
|
case "createworker":
|
||||||
System.out.print("Enter worker name: ");
|
System.out.println("Enter worker name:");
|
||||||
String workerName = scanner.nextLine().trim();
|
currentState = InputState.AWAITING_CREATE_WORKER_NAME;
|
||||||
int workerId = manager.createWorker(workerName);
|
|
||||||
System.out.println("Created worker with ID: " + workerId);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "createtask":
|
case "createtask":
|
||||||
System.out.print("Enter worker ID: ");
|
System.out.println("Enter worker ID:");
|
||||||
int workerIdForTask = Integer.parseInt(scanner.nextLine().trim());
|
currentState = InputState.AWAITING_CREATE_TASK_WORKER;
|
||||||
System.out.print("Enter task name: ");
|
|
||||||
String taskName = scanner.nextLine().trim();
|
|
||||||
System.out.print("Enter task description: ");
|
|
||||||
String taskDesc = scanner.nextLine().trim();
|
|
||||||
int taskId = manager.addTask(workerIdForTask, taskName, taskDesc);
|
|
||||||
System.out.println("Created task with ID: " + taskId);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "selecttask":
|
case "selecttask":
|
||||||
inTaskSelection = true;
|
System.out.println("Enter task ID:");
|
||||||
System.out.print("Enter task ID: ");
|
currentState = InputState.AWAITING_TASK_SELECTION; // Change to new state
|
||||||
String taskIdInput = scanner.nextLine().trim();
|
|
||||||
selectedTaskId = Integer.parseInt(taskIdInput);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "listworkers":
|
case "listworkers":
|
||||||
inWorkerSelection = true;
|
System.out.println("Available workers:");
|
||||||
System.out.print("Enter worker ID: ");
|
for (Worker w : manager.getWorkerMap().values()) {
|
||||||
String workerIdInput = scanner.nextLine().trim();
|
System.out.println(" " + w.getId() + ": " + w.getName());
|
||||||
selectedWorkerId = Integer.parseInt(workerIdInput);
|
}
|
||||||
|
System.out.println("Enter worker ID to select (or 'back'):");
|
||||||
|
currentState = InputState.WORKER_SELECTED;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -163,7 +202,133 @@ public class UserCommands implements Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void handleWorkerSelectionInput(String input) {
|
||||||
|
if ("back".equalsIgnoreCase(input)) {
|
||||||
|
resetToMainMenu();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
int workerId = Integer.parseInt(input.trim());
|
||||||
|
Worker worker = manager.getWorker(workerId);
|
||||||
|
if (worker != null) {
|
||||||
|
selectedWorkerId = workerId;
|
||||||
|
System.out.println("Worker " + workerId + " (" + worker.getName() + ") selected");
|
||||||
|
System.out.println("Commands: remove, back");
|
||||||
|
} else {
|
||||||
|
System.out.println("Worker not found. Please enter a valid worker ID:");
|
||||||
|
}
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
if (selectedWorkerId != null) {
|
||||||
|
handleWorkerCommand(input);
|
||||||
|
} else {
|
||||||
|
System.out.println("Invalid input. Please enter a worker ID or 'back':");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void handleWorkerCommand(String input) {
|
||||||
|
switch (input.toLowerCase()) {
|
||||||
|
case "remove":
|
||||||
|
manager.removeWorker(selectedWorkerId);
|
||||||
|
System.out.println("Worker removed");
|
||||||
|
resetToMainMenu();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "back":
|
||||||
|
resetToMainMenu();
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
System.out.println("Unknown command. Available commands: remove, back");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void handleCreateWorkerNameInput(String input) {
|
||||||
|
int workerId = manager.createWorker(input.trim());
|
||||||
|
System.out.println("Created worker with ID: " + workerId);
|
||||||
|
resetToMainMenu();
|
||||||
|
}
|
||||||
|
private void handleTaskIdInput(String input) {
|
||||||
|
if ("back".equalsIgnoreCase(input)) {
|
||||||
|
resetToMainMenu();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
int taskId = Integer.parseInt(input.trim());
|
||||||
|
Task task = manager.getTask(taskId);
|
||||||
|
if (task != null) {
|
||||||
|
selectedTaskId = taskId;
|
||||||
|
currentState = InputState.TASK_SELECTED;
|
||||||
|
System.out.println("Task " + taskId + " (" + task.getName() + ") selected");
|
||||||
|
System.out.println("Commands: finish, unfinish, remove, edit, back");
|
||||||
|
} else {
|
||||||
|
System.out.println("Task not found. Please enter a valid task ID:");
|
||||||
|
}
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
System.out.println("Invalid input. Please enter a task ID or 'back':");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void handleCreateTaskWorkerInput(String input) {
|
||||||
|
try {
|
||||||
|
tempWorkerId = Integer.parseInt(input.trim());
|
||||||
|
System.out.println("Enter task name:");
|
||||||
|
currentState = InputState.AWAITING_CREATE_TASK_NAME;
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
System.out.println("Invalid worker ID. Please enter a number:");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void handleCreateTaskNameInput(String input) {
|
||||||
|
tempTaskName = input.trim();
|
||||||
|
System.out.println("Enter task description:");
|
||||||
|
currentState = InputState.AWAITING_CREATE_TASK_DESC;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void handleCreateTaskDescInput(String input) {
|
||||||
|
int taskId = manager.addTask(tempWorkerId, tempTaskName, input.trim());
|
||||||
|
System.out.println("Created task with ID: " + taskId);
|
||||||
|
resetToMainMenu();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void resetToMainMenu() {
|
||||||
|
currentState = InputState.MAIN_MENU;
|
||||||
|
selectedTaskId = null;
|
||||||
|
selectedWorkerId = null;
|
||||||
|
tempWorkerId = null;
|
||||||
|
tempTaskName = null;
|
||||||
|
}
|
||||||
|
|
||||||
private void handleTaskSelectionInput(String input) {
|
private void handleTaskSelectionInput(String input) {
|
||||||
|
if ("back".equalsIgnoreCase(input)) {
|
||||||
|
resetToMainMenu();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
int taskId = Integer.parseInt(input.trim());
|
||||||
|
Task task = manager.getTask(taskId);
|
||||||
|
if (task != null) {
|
||||||
|
selectedTaskId = taskId;
|
||||||
|
currentState = InputState.TASK_SELECTED;
|
||||||
|
System.out.println("Task " + taskId + " (" + task.getName() + ") selected");
|
||||||
|
System.out.println("Commands: finish, unfinish, remove, edit, back");
|
||||||
|
} else {
|
||||||
|
System.out.println("Task not found. Please enter a valid task ID:");
|
||||||
|
}
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
if (selectedTaskId != null) {
|
||||||
|
handleTaskCommand(input);
|
||||||
|
} else {
|
||||||
|
System.out.println("Invalid input. Please enter a task ID or 'back':");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void handleTaskCommand(String input) {
|
||||||
switch (input.toLowerCase()) {
|
switch (input.toLowerCase()) {
|
||||||
case "finish":
|
case "finish":
|
||||||
manager.finishTask(manager.getTask(selectedTaskId).getWorkerId(),selectedTaskId);
|
manager.finishTask(manager.getTask(selectedTaskId).getWorkerId(),selectedTaskId);
|
||||||
@@ -178,71 +343,46 @@ public class UserCommands implements Runnable {
|
|||||||
case "remove":
|
case "remove":
|
||||||
manager.removeTask(selectedTaskId);
|
manager.removeTask(selectedTaskId);
|
||||||
System.out.println("Task removed");
|
System.out.println("Task removed");
|
||||||
resetSelection();
|
resetToMainMenu();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "edit":
|
case "edit":
|
||||||
System.out.print("Enter new name;description: ");
|
System.out.println("Enter new name;description:");
|
||||||
String editInput = scanner.nextLine().trim();
|
currentState = InputState.AWAITING_EDIT_INPUT;
|
||||||
String[] parts = editInput.split(";", 2);
|
break;
|
||||||
|
|
||||||
|
case "back":
|
||||||
|
resetToMainMenu();
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
System.out.println("Unknown command. Type 'help' for available commands.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void handleEditInput(String input) {
|
||||||
|
String[] parts = input.split(";", 2);
|
||||||
if (parts.length == 2) {
|
if (parts.length == 2) {
|
||||||
manager.editTask(manager.getTask(selectedTaskId).getWorkerId(), selectedTaskId, parts[0], parts[1]);
|
manager.editTask(manager.getTask(selectedTaskId).getWorkerId(), selectedTaskId, parts[0], parts[1]);
|
||||||
System.out.println("Task edited");
|
System.out.println("Task edited");
|
||||||
} else {
|
} else {
|
||||||
System.out.println("Invalid format. Use: name;description");
|
System.out.println("Invalid format. Use: name;description");
|
||||||
|
System.out.println("Please try again:");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
break;
|
currentState = InputState.TASK_SELECTED;
|
||||||
|
|
||||||
case "back":
|
|
||||||
resetSelection();
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
try {
|
|
||||||
selectedTaskId = Integer.parseInt(input);
|
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
System.out.println("Unknown command. Type 'help' for available commands.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void handleWorkerSelectionInput(String input) {
|
|
||||||
switch (input.toLowerCase()) {
|
|
||||||
case "remove":
|
|
||||||
manager.removeWorker(selectedWorkerId);
|
|
||||||
System.out.println("Worker removed");
|
|
||||||
resetSelection();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "back":
|
|
||||||
resetSelection();
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
try {
|
|
||||||
selectedWorkerId = Integer.parseInt(input);
|
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
System.out.println("Unknown command. Type 'help' for available commands.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void resetSelection() {
|
|
||||||
inTaskSelection = false;
|
|
||||||
inWorkerSelection = false;
|
|
||||||
selectedTaskId = null;
|
|
||||||
selectedWorkerId = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Scanner getScanner() {
|
public Scanner getScanner() {
|
||||||
return scanner;
|
return scanner;
|
||||||
}
|
}
|
||||||
|
|
||||||
// For testing - allows setting scanner
|
//only for testing
|
||||||
public void setScanner(Scanner scanner) {
|
public void setScanner(Scanner scanner) {
|
||||||
this.scanner = scanner;
|
this.scanner = scanner;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//only for testing
|
||||||
public boolean isRunning() {
|
public boolean isRunning() {
|
||||||
return running.get();
|
return running.get();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -129,10 +129,10 @@ public class GoodCasesTest {
|
|||||||
manager.getUserCommands().handleInput("selectTask");
|
manager.getUserCommands().handleInput("selectTask");
|
||||||
manager.getUserCommands().handleInput(taskId + "");
|
manager.getUserCommands().handleInput(taskId + "");
|
||||||
manager.getUserCommands().handleInput("edit");
|
manager.getUserCommands().handleInput("edit");
|
||||||
assertDoesNotThrow(() -> manager.getUserCommands().handleInput("Walk;Walk 3 Miles"));
|
manager.getUserCommands().handleInput("Walk;Walk 3 Miles");
|
||||||
assertEquals("Walk", manager.getTask(taskId).getName());
|
assertEquals("Walk", manager.getTask(taskId).getName());
|
||||||
assertEquals("Walk 3 Miles", manager.getTask(taskId).getDescription());
|
assertEquals("Walk 3 Miles", manager.getTask(taskId).getDescription());
|
||||||
assertDoesNotThrow(() -> manager.getUserCommands().handleInput("back"));
|
manager.getUserCommands().handleInput("back");
|
||||||
}
|
}
|
||||||
@Test
|
@Test
|
||||||
@DisplayName("Assert that removing Workers is possible through the UI")
|
@DisplayName("Assert that removing Workers is possible through the UI")
|
||||||
|
|||||||
Reference in New Issue
Block a user