test: add direct unit test for ProjectRepository - #53
Merged
Merged
Conversation
Construct ProjectRepository with a mocked ProjectJsonReaderWriter and assert seeding from readJson, the defensive copy from findAll, duplicate and unknown-name failures leaving state unpersisted, and exactly one writeJson per successful add/remove/clear. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Mockito.* already brings ArgumentMatchers.anyList into scope. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
Author
|
Self-review rubric (head
Findings:
Characterization-only PR; ready to merge once no further review comments arrive. This review was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener). drafted by Claude on behalf of Daniel Stephenson |
1 of 2 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.
Summary
ProjectRepositoryTestis added undersrc/test/java/com/preponderous/parpt/repo/, constructingProjectRepositorydirectly with a Mockito-mockedProjectJsonReaderWriter(no Spring context, no filesystem).readJson()and does not write;findAll()returns a defensive copy;add(...)on a duplicate name throwsNameTakenException, leaves the list unchanged and never callswriteJson;remove(...)on an unknown name throwsProjectNotFoundException(message asserted) and never callswriteJson;add,removeandcleareach persist exactly once, with the persisted contents asserted.findByNamehit/miss cases are also covered.writeJsonreceives the repository's own mutable list, each call's contents are snapshotted in adoAnswerso that the assertions reflect the list at call time rather than at verification time.Test plan
./gradlew test -Dorg.gradle.java.home=/usr/lib/jvm/java-21-openjdk-amd64: 114 tests executed, 0 failures, 0 errors (9 inProjectRepositoryTest), counted frombuild/test-results/test/*.xmlBuild and Test,CI Pipeline) green on this branchDeferred issues (skip reasons)
application.yaml, a do-not-auto-merge path that needs a human decision.build.gradledependency change (do-not-auto-merge path).Closes #51
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