[test-improver] Fix no-assertion tests in TaskServiceTest (Issue #20)#71
Draft
github-actions[bot] wants to merge 1 commit into
Draft
[test-improver] Fix no-assertion tests in TaskServiceTest (Issue #20)#71github-actions[bot] wants to merge 1 commit into
github-actions[bot] wants to merge 1 commit into
Conversation
- testGetTasksByStatus: verify each returned task has the requested status - testGetTasksByAssignee: verify empty list for unknown user, and correct assignee_id filtering when a real task is assigned - testGetAllTasks: assert list is non-empty (DataInitializer seeds tasks) - Remove 3 empty @disabled TODO tests (testAutoAssignTask, testBulkImportWithInvalidData, testConcurrentTaskCreation) that added no value and cluttered the test class Addresses part of Issue #20 (no-assertion tests, assertion-less coverage inflation). Pre-existing failures (testGetQuarter Bug #6, testGetTaskStatistics Bug #3) are unchanged. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
14 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 Test Improver — automated AI assistant focused on improving tests.
Goal & Rationale
TaskServiceTesthad three tests with zero assertions — they ran the code but verified nothing, silently inflating coverage metrics. Additionally three empty@Disabled("TODO: implement")stubs added noise without value. This addresses part of Issue #20.Changes
testGetTasksByStatusTaskhas the requestedstatusfieldtestGetTasksByAssigneeassignee_idfiltering correctnesstestGetAllTasksassertNotNullonlyassertFalse(isEmpty)— DataInitializer seeds tasks at startuptestAutoAssignTask@DisabledTODO stubtestBulkImportWithInvalidData@DisabledTODO stubtestConcurrentTaskCreation@DisabledTODO stubApproach
getTasksByStatus: call all three status values and useforEachto assert every element has the expectedstatus— catches a filter-bug regression.getTasksByAssignee: create an isolated task with a specificassignee_id, fetch by that ID, assert non-empty list with correct assignee, then delete the task to avoid polluting other tests.getAllTasks: assert non-empty — safe because DataInitializer always seeds data before the Spring context is used.Test Status
Only the 2 pre-existing failures remain (both unchanged):
DateUtilsTest.testGetQuarter— Bug 🔴 [BUG] getQuarter() returns 0-3 instead of 1-4 (off-by-one bug) #6 (off-by-one ingetQuarter())TaskServiceTest.testGetTaskStatistics— Bug 🔴 [BUG] ArithmeticException: Division by zero on empty project dashboard #3 (division by zero when no completed tasks)New assertions in
testGetTasksByStatusandtestGetTasksByAssigneepass ✅.Reproducibility
Add this agentic workflows to your repo
To install this agentic workflow, run