Add offline unit tests for GitHubService.getPublicRepositories - #29
Merged
Merged
Conversation
getPublicRepositories was covered only by a test that calls the live GitHub API. The new tests build the service against a mocked GitHub client (GitHub.connectAnonymously and GitHubBuilder are stubbed, so the anonymous and GITHUB_TOKEN paths both get the mock) and pin down the current behaviour: private repositories are filtered out, a name that is not an organization falls back to the user lookup, a 404 from the user lookup is rewrapped with the "not found" message and the original as cause, and any other failure, including one with no message, is rethrown unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
Author
|
Self-review rubric (scored against the diff and CI run 36829323434):
Judgment notes (folded in from the review, none blocking):
Summary: an additive, test-only change. CI is green and the mutation check confirms the new tests detect regressions. This review comment was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener). drafted by Claude on behalf of Daniel Stephenson |
2 of 3 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
Stage B (unit-test expansion) cycle targeting
GitHubService.getPublicRepositories, the one piece of behavior-bearing logic inGitHubService. Until now it was exercised only bytestGetPublicRepositories_InvalidUser, which calls the live GitHub API and asserts nothing beyond "someIOException".GitHubServiceTest, run against a mockedGitHubclient. A helper stubsGitHub.connectAnonymously()(viamockStatic) andGitHubBuilder(viamockConstruction), so the mock is used whether or notGITHUB_TOKENis set in the environment. No production code is changed.404is rewrapped as'<name>' not found as GitHub organization or user. Please verify the name is correct., with the original exception kept as the cause.nullmessage, is rethrown as the same instance.@Mock+MockitoAnnotations.openMocks(this)pattern, and are kept unchanged.CHANGELOG.md[Unreleased]→Addedentry is included, matching howDocumentationVersionTestwas recorded.No tracking issue: this gap was found during triage. Open issue #8 (missing
LICENSEfile) was skipped this cycle because, as the issue itself states, it needs a maintainer decision on the copyright holder and year.Test plan
mvn verifyran locally: 118 tests run, 0 failures, 1 skipped (the existingGITHUB_TOKEN-gated test)!repo.isPrivate()filter and the"404"check temporarily changed inGitHubService,testGetPublicRepositories_OrganizationFiltersPrivateRepositoriesandtestGetPublicRepositories_NotFoundAsOrganizationOrUserboth failed. Both passed again once the change was reverted.Buildworkflow green on the PR headThis 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