Skip to content

Add unit tests for AddCommand and HelpCommand - #11

Merged
dmccoystephenson merged 1 commit into
mainfrom
feature/add-and-help-command-tests
Aug 3, 2026
Merged

Add unit tests for AddCommand and HelpCommand#11
dmccoystephenson merged 1 commit into
mainfrom
feature/add-and-help-command-tests

Conversation

@dmccoystephenson

Copy link
Copy Markdown
Member

Summary

  • Unit tests are added for AddCommand and HelpCommand, the only two command classes previously left without test coverage (EditCommand, RemoveCommand, and DefaultCommand already had tests).
  • Existing Mockito-based conventions from EditCommandTest/RemoveCommandTest are followed: item/inventory/meta are mocked, lore mutation is verified via setLore, and rejection paths are asserted to return false.
  • A latent bug is characterized rather than fixed, per this cycle's test-expansion scope: AddCommand.execute(CommandSender, String[]) has no args.length == 0 guard (unlike its EditCommand/RemoveCommand siblings), so an uncaught IllegalArgumentException is thrown instead of a graceful usage message when /pl add is invoked with no arguments. This is tracked separately in AddCommand throws uncaught exception instead of usage message when args are missing #10, filed alongside this PR, and left for a future implementation cycle rather than being fixed here.

Test plan

  • mvn test — all 19 tests pass (12 pre-existing + 7 new, across AddCommandTest and HelpCommandTest)
  • No production code was modified; only new test files were added

No tracking issue is closed by this PR — the cycle's backlog consisted of no open issues, so this cycle's work was selected from Phase 2's Stage B (unit-test expansion) rather than issue implementation. #10 was filed as a followup and is left open for a future cycle.

This PR description was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener).

The only two command classes with zero test coverage. Characterizes
the current uncaught IllegalArgumentException thrown by AddCommand
when invoked with no arguments (see #10) rather than fixing it, per
the test-expansion cycle's characterization-only scope.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@dmccoystephenson

Copy link
Copy Markdown
Member Author

Self-review rubric:

  • Scope: PASS — the diff touches only two new test files (AddCommandTest.java, HelpCommandTest.java); no production code, no unrelated formatting/renames.
  • Tests-new: PASS — every public method on AddCommand and HelpCommand (execute(CommandSender) and execute(CommandSender, String[])) is exercised by at least one test.
  • Tests-fix (empirical): N/A — this cycle is Stage B (test-expansion), not a bug-fix cycle. The one apparent bug found (AddCommand throwing IllegalArgumentException on empty args) is intentionally left unfixed per the characterization-only scope, filed as AddCommand throws uncaught exception instead of usage message when args are missing #10, and its test asserts the current throwing behavior rather than a fix.
  • Sibling structure: PASS — both new test files mirror the @BeforeEach mock-setup and per-branch @Test structure of EditCommandTest.java/RemoveCommandTest.java (same mock objects, same verify/assertTrue/assertFalse idioms).
  • Sibling renames: N/A — no identifiers were renamed.
  • Docs: PASS — no behavior changed, so HelpCommand.java, COMMANDS.md, USER_GUIDE.md, CONFIG.md, and CHANGELOG.md all still accurately describe the plugin; none required an update for this PR.
  • Issue resolution: N/A — no Closes #N in this PR. The cycle had an empty issue backlog, so work was pulled from Phase 2 Stage B instead. AddCommand throws uncaught exception instead of usage message when args are missing #10 was filed as a byproduct, not closed by this PR.
  • CI: PASS — build check green on the PR head SHA (mvn test, 19/19 passing).

Repo-specific rubric:

Summary: two new test files add coverage for the previously-untested AddCommand and HelpCommand; a latent AddCommand bug was found and characterized (not silently patched) with a companion issue (#10) for a future implementation cycle.

This comment was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener).

@dmccoystephenson
dmccoystephenson merged commit aa46794 into main Aug 3, 2026
1 check passed
@dmccoystephenson
dmccoystephenson deleted the feature/add-and-help-command-tests branch August 3, 2026 09:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant