FINERACT-2539: Add unit tests for MathUtil#5628
FINERACT-2539: Add unit tests for MathUtil#5628devi-pathak2263 wants to merge 2 commits intoapache:developfrom
Conversation
Add comprehensive unit tests for the StreamResponseUtil utility class. Tests cover: - ok(StreamResponseData) response creation - ok(AsyncResponse, StreamResponseData) asynchronous response handling - Content-Disposition header generation - StreamingOutput functionality - Async response execution These tests improve test coverage and help ensure correct behavior of response streaming utilities.
| @@ -0,0 +1,143 @@ | |||
| /** | |||
There was a problem hiding this comment.
Why is MathUtil needed? There are already functions on BigInteger/BigDecimal for add/subtract/mulitply/divide...
There was a problem hiding this comment.
This PR only adds unit tests for the existing MathUtil utility class. The implementation of MathUtil was already present in the codebase and is currently used in several parts of the project.
The goal of this PR is to improve test coverage and ensure the correctness of the helper methods already provided by MathUtil, especially around null handling, comparison helpers, and convenience wrappers used across the platform.
No changes were made to the implementation itself.
|
@devi-pathak2263 Can you please: Set the commit email address to match with your github account email address? |
|
I have updated the commit author email to match my GitHub account and added a signed commit using SSH. |
|
@devi-pathak2263 You need to amend the original commit to take effect, but before you do that, please use GPG instead of SSH. SSH would require to maintain |
Please let me know if anything else needs adjustment. |
Add comprehensive unit tests for MathUtil covering core behaviors including null handling, arithmetic operations, comparison helpers, BigDecimal operations, percentage calculations, and formatting helpers. The tests verify correct handling of: - null and default value behavior - negative and zero values - arithmetic operations (add, subtract, abs) - BigDecimal utilities - percentage calculations - trailing zero normalization These tests improve reliability and increase test coverage for shared mathematical utilities used across the platform.
e864e43 to
20ac44a
Compare
##Description
This PR adds unit tests for the MathUtil utility class located in fineract-core.
The MathUtil class contains several helper methods used across the platform for null handling, arithmetic operations, numeric comparisons, and BigDecimal utilities. These utilities are frequently used by different modules and therefore benefit from dedicated test coverage.
The added tests verify the behavior of multiple helper methods including:
The tests include validation of typical scenarios as well as important edge cases such as:
These tests improve reliability and increase the overall test coverage of shared mathematical utilities used throughout the system.
JIRA: https://issues.apache.org/jira/browse/FINERACT-2539
Testing
Executed locally:
./gradlew spotlessApply
./gradlew :fineract-core:test
Checklist
Please make sure these boxes are checked before submitting your pull request - thanks!
Your assigned reviewer(s) will follow our guidelines for code reviews.