Add comprehensive unit tests for PatronProfileController #5
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.
Add comprehensive unit tests for PatronProfileController
Summary
Adds comprehensive
@WebMvcTestcoverage forPatronProfileController, which previously had zero test coverage despite being a critical 189-line Spring Boot REST controller. The test suite includes 17 test scenarios covering:@MockBeanAlso updates README.md with documentation of the new web layer testing approach, including code examples and integration with the project's BDD testing philosophy.
Review & Testing Checklist for Human
./mvnw test -Dtest=PatronProfileControllerTestto ensure no compilation or runtime errors_embedded.holdList/_embedded.checkoutList- verify this matches actual Spring HATEOAS output@WebMvcTestwith Spock Specification and mixed@MockBean/Spock stubbing (>>) works correctly/profiles/{patronId}/holds/{bookId}actually returns 404 when hold doesn't existNotes
Environment Issue: Maven compilation failed locally due to Java module system errors with Lombok annotation processing. The tests were written based on code analysis and existing patterns but couldn't be executed locally.
Testing Framework Mix: This PR combines
@WebMvcTest(typically JUnit-oriented) with Spock/Groovy, and uses@MockBean(Mockito) with Spock stubbing syntax (>>). This combination may need validation to ensure compatibility.No CI Validation: No automated tests ran on this PR, so compilation and runtime behavior are unverified.
Link to Devin run: https://app.devin.ai/sessions/8a17b2bdcbee467ba18e802293dce848
Requested by: @callummiles