Skip to content

[test-improver] Fix no-assertion tests in TaskServiceTest (Issue #20)#71

Draft
github-actions[bot] wants to merge 1 commit into
mainfrom
test-assist/taskservice-test-cleanup-c93db002bcf1292c
Draft

[test-improver] Fix no-assertion tests in TaskServiceTest (Issue #20)#71
github-actions[bot] wants to merge 1 commit into
mainfrom
test-assist/taskservice-test-cleanup-c93db002bcf1292c

Conversation

@github-actions

Copy link
Copy Markdown

🤖 Test Improver — automated AI assistant focused on improving tests.

Goal & Rationale

TaskServiceTest had 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

Test Before After
testGetTasksByStatus Calls method, no assertions Verifies each returned Task has the requested status field
testGetTasksByAssignee Calls method, no assertions Verifies empty list for non-existent user; verifies assignee_id filtering correctness
testGetAllTasks assertNotNull only Adds assertFalse(isEmpty) — DataInitializer seeds tasks at startup
testAutoAssignTask Empty @Disabled TODO stub Removed
testBulkImportWithInvalidData Empty @Disabled TODO stub Removed
testConcurrentTaskCreation Empty @Disabled TODO stub Removed

Approach

  • For getTasksByStatus: call all three status values and use forEach to assert every element has the expected status — catches a filter-bug regression.
  • For getTasksByAssignee: create an isolated task with a specific assignee_id, fetch by that ID, assert non-empty list with correct assignee, then delete the task to avoid polluting other tests.
  • For getAllTasks: assert non-empty — safe because DataInitializer always seeds data before the Spring context is used.
  • Removed three placeholder stubs — when those scenarios need testing, real tests can be added then.

Test Status

Tests run: 35, Failures: 1, Errors: 1, Skipped: 4

Only the 2 pre-existing failures remain (both unchanged):

New assertions in testGetTasksByStatus and testGetTasksByAssignee pass ✅.

Reproducibility

mvn test -B -pl . -Dtest=TaskServiceTest

Generated by Test Improver · 84.2 AIC · ⌖ 9.29 AIC · ⊞ 10.9K ·
Comment /test-assist to run again

Add this agentic workflows to your repo

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/test-improver.md@1c6668b751c51af8571f01204ceffb19362e0f66

- 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants