FINERACT-2576: Add unit test for MoneyTest in fineract-core - #5730
Merged
adamsaghy merged 1 commit intoApr 2, 2026
Conversation
paultofunmi
force-pushed
the
FINERACT-2576/add-unit-tests-for-moneytests-fineract-core
branch
from
April 2, 2026 01:23
8b56ccc to
45088f9
Compare
Aman-Mittal
approved these changes
Apr 2, 2026
Aman-Mittal
left a comment
Member
There was a problem hiding this comment.
LGTM, only unit tests are added.
budaidev
reviewed
Apr 2, 2026
budaidev
reviewed
Apr 2, 2026
paultofunmi
force-pushed
the
FINERACT-2576/add-unit-tests-for-moneytests-fineract-core
branch
from
April 2, 2026 06:52
45088f9 to
6d7743f
Compare
FINERACT-2576: Add unit test for MoneyTest in fineract-core Code Review Reactions FINERACT-2576: Code Review formatting
paultofunmi
force-pushed
the
FINERACT-2576/add-unit-tests-for-moneytests-fineract-core
branch
from
April 2, 2026 09:08
6d7743f to
86e9ec8
Compare
budaidev
approved these changes
Apr 2, 2026
Contributor
|
LGTM |
Member
|
@adamsaghy can you look at this PR. Me and attilia have given our reviews. |
paultofunmi
deleted the
FINERACT-2576/add-unit-tests-for-moneytests-fineract-core
branch
April 2, 2026 13:03
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.
Description
This PR adds a comprehensive
MoneyTestsuite covering all major operations on theMoneyclass, including parameterized edge cases for floating-point precision.Test coverage added:
plus(double)— parameterized cases including negative values and floating-point precision edge casestotal(Money...)varargs — aggregation of multipleMoneyinstances, and exception thrown on empty inputtotal(Iterable<Money>)— iterable aggregation including single-element and empty-list exception casesroundToMultiplesOf(double, int)— parameterized cases plus NaN return for negative valuesroundToMultiplesOf(BigDecimal, Integer)— parameterized cases including zero and negative multiplesroundToMultiplesOf(Money, int)— with and withoutMathContext, including zero-multiple passthroughceiling(double, double)— NaN cases and valid cases covering zero, exact multiples, and rounding upfloor(double, double)— NaN cases and valid cases covering negative step sizes and floating-point stepsgetAmountDefaultedToNullIfZero()— null for zero, non-null with correct value for non-zerodividedBy(BigDecimal/double/long)— identity optimisation (returns same instance when dividing by 1), correct results for division by 2multipliedBy(BigDecimal/double/long)— with and withoutMathContext, identity optimisation for multiplier of 1multiplyRetainScale(BigDecimal/double)— scale preservation at currency decimal placespercentageOf(BigDecimal)— 50%, 100%, and 0% casesnegated()— positive, negative, and zero (returns same instance for zero)abs()— positive, negative, zero, and withMathContextzero()— instance method with and withoutMathContextgetMc()— non-nullMathContextassertioncopy()— value equality, same currency, different instance; copy withBigDecimalanddoubleoverridesAll tests are pure unit tests with no Spring context or database dependencies.
Fixes: https://issues.apache.org/jira/browse/FINERACT-2576
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.