-
Notifications
You must be signed in to change notification settings - Fork 0
Add extensive tests for phoenixd-rest #46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add extensive tests for phoenixd-rest #46
Conversation
|
This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Adds comprehensive testing coverage for the phoenixd-rest module, expanding test suites to validate HTTP operations, request handling, parameter validation, and error scenarios.
- Enhances existing test classes with additional test methods and better documentation
- Adds new comprehensive test suites for operations, requests, and AbstractRequest functionality
- Introduces proper error handling tests and null argument validation across the codebase
Reviewed Changes
Copilot reviewed 32 out of 32 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| PayRequestFactoryTest.java (phoenixd-test) | Added comprehensive comments and additional validation tests |
| PayLightningAddressTest.java | Added error port constant and improved URI inspection via AbstractOperation |
| PayBolt11InvoiceRequestTest.java | Added descriptive comment for constructor test |
| CreateBolt11InvoiceRequestTest.java | Added error port constant and improved URI inspection |
| PatchOperationTest.java | Modified to allow header additions instead of throwing exceptions |
| AddHeaderOperationTest.java | Added setup method and test for PATCH operations |
| app.properties | New configuration file for phoenixd-rest tests |
| PayRequestFactoryTest.java (phoenixd-rest) | New comprehensive factory test with null validation |
| RequestTest.java | New extensive test suite for request constructors and validation |
| AbstractRequestTest.java | New test suite for JSON parsing and response handling |
| OperationsTest.java | New comprehensive test suite for all HTTP operation types |
| AbstractOperationTest.java | Enhanced with error handling and header management tests |
| Multiple model test files | Added descriptive comments to existing test methods |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| errorServer.start(); | ||
| try { | ||
| TestUtils.setBaseUrl("http://localhost:" + ERROR_PORT); | ||
| TestUtils.setBaseUrl("http://localhost:" + ERROR_SERVER_PORT); |
Copilot
AI
Aug 21, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line references ERROR_SERVER_PORT but the variable being used should be consistent with the declaration on line 27. The code shows ERROR_PORT was used in the original line but should be ERROR_SERVER_PORT to match the constant.
| assertNotNull(request.getOperation().getHeader("Authorization")); | ||
| assertThrows(UnsupportedOperationException.class, () -> request.getOperation().addHeader("x", "y")); | ||
| assertDoesNotThrow(() -> request.getOperation().addHeader("x", "y")); | ||
| assertEquals("y", request.getOperation().getHeader("x")); |
Copilot
AI
Aug 21, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The change from throwing UnsupportedOperationException to allowing header additions represents a significant behavioral change in the PatchOperation. This should be documented in the commit message or PR description to explain why this operation is now supported.
Summary
Testing
mvn -q verifyhttps://chatgpt.com/codex/tasks/task_b_68a68284e27c8331af7f0f50858da57a