test: add direct unit test for ProjectService - #54
Merged
Merged
Conversation
ProjectService had no test class of its own; it was only exercised indirectly through command tests. Pin its delegation to ProjectRepository, field mapping in createProject, and the rule that usage is reported only after a project is successfully added. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
Author
|
Self-review rubric for PR #54:
Findings:
Summary: a test-only addition that is green locally and in CI, with no blocking findings. This review was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener). drafted by Claude on behalf of Daniel Stephenson |
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.
Summary
ProjectServiceTestis added as a direct Mockito unit test forProjectService, which previously had no test class of its own and was only exercised indirectly through the command tests. This continues the per-layer coverage started forProjectRepositoryin test: add direct unit test for ProjectRepository #53.ProjectServiceis pinned:createProjectmaps every argument onto the builtProject. Distinct score values 1–5 are used, so a transposed argument would be caught. The same instance is passed toProjectRepository.addand returned.usageReporter.projectCreated()is called only afteraddsucceeds (verified withInOrder). It is not called whenaddthrowsNameTakenException, which is propagated to the caller.getProjects,getProjectanddeleteProjectdelegate to the repository.ProjectNotFoundExceptionis propagated unchanged, and deleting a project reports no usage.isNameTakenreturnstruewhen the lookup succeeds andfalsewhen it throwsProjectNotFoundException.No tracking issue: the gap was found during triage (Stage B, unit-test expansion). No bug was found while the tests were being written.
Test plan
./gradlew teston JDK 21 ran 124 tests with 0 failures, 0 errors and 0 skipped (counted frombuild/test-results/test/*.xml). 10 of them are the newProjectServiceTesttests.Build and Test,CI Pipeline) is green on the PR head.Deferred issues
These open issues were left out of this cycle:
CreateProjectCommand. Moving it into anInputValidatoris a refactor that should be decided on its own.app.projects.fileinapplication.yaml, which is on the do-not-auto-merge list, so it needs human review.This PR description was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener).
🤖 Generated with Claude Code
drafted by Claude on behalf of Daniel Stephenson