{{ message }}
Add unit tests for error handling and authorization checks#10
Closed
devin-ai-integration[bot] wants to merge 1 commit into
Closed
Add unit tests for error handling and authorization checks#10devin-ai-integration[bot] wants to merge 1 commit into
devin-ai-integration[bot] wants to merge 1 commit into
Conversation
- Add JUnit 5 and Mockito test dependencies to pom.xml - Add maven-surefire-plugin for running JUnit 5 tests - Create LoggingInterceptorTest with tests for: - Error handling (404, 400, 500, 503 status codes) - Authorization checks (401, 403 for invalid/expired tokens) - Private transaction access (403 Forbidden scenarios) - Create RequestExceptionTest with tests for: - Error message formatting for various HTTP error codes - Authorization error details (401, 403) - Transaction error scenarios - Create ApiTest with documentation tests for expected error behaviors Total: 47 tests covering error handling and authorization scenarios Co-Authored-By: Jack <jack.l.killian@gmail.com>
Author
Author
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
Adds unit test coverage for error handling and authorization scenarios that were previously missing. The tests cover:
Changes include:
pom.xmlmaven-surefire-pluginfor running JUnit 5 testsLoggingInterceptorTest.javawith mocked HTTP response testsRequestExceptionTest.javafor error message formatting verificationApiTest.javawith documentation-style testsTotal: 47 tests passing
Review & Testing Checklist for Human
ApiTest.javacritically - These tests verify string patterns against hardcoded sample messages rather than testing actual Api class behavior. This was a limitation due to Unirest's static methods being difficult to mock. Consider if this level of coverage is acceptable or if additional mocking infrastructure is needed.LoggingInterceptorTestcovers the intended scenarios - This is the primary test file that actually tests error handling behavior with mocked HTTP responsesmvn clean testlocally to confirm all 47 tests passRecommended test plan:
mvn clean testand verify all tests passNotes
Link to Devin run: https://app.devin.ai/sessions/37e2d4e3bc8149699d346c9dc4331ef7
Requested by: @jack-killian