[ 
https://issues.apache.org/jira/browse/FINERACT-855?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17123363#comment-17123363
 ] 

Petri Tuomola commented on FINERACT-855:
----------------------------------------

[~vorburger] so as far as I can see, this boils down to the difference on how 
the interest from 1st May to 1st June is calculated:
 * The test does a simple "interest rate per day * number of days" calculation 
(i.e. 31 * 1/360 * interest per day)
 * The API does "the right thing" ie: works out the interest for 1-31st May, 
assumes that was paid out on 31st May, and then works out one day of interest 
for the new balance (principal + 1 month)

Then there are also smaller differences: the test is using Doubles to 
calculate, whereas the API code is using BigDecimal etc. 

Long story short: I don't think there's any way of guaranteeing they will be 
exactly the same down to a rounding error - which is why I suppose the test is 
only comparing the digit part, not the fraction.

So the simplest way to fix would be to change the comparison code in the test 
not to do any rounding. This may have been what was attempted anyway with 
DecimalFormat. Let me see if I can send a pull request for this...

> RecurringDepositTest.testRecurringDepositAccountWithClosureTypeTransferToSavings_WITH_HOLD_TAX
> ----------------------------------------------------------------------------------------------
>
>                 Key: FINERACT-855
>                 URL: https://issues.apache.org/jira/browse/FINERACT-855
>             Project: Apache Fineract
>          Issue Type: Sub-task
>            Reporter: Michael Vorburger
>            Priority: Major
>
> while attempting to understand FINERACT-852, and locally pulling and running 
> https://github.com/apache/fineract/pull/719, it failed for me, and we have a 
> note about a similar failure in https://github.com/apache/fineract/pull/642, 
> this may be  another flaky one?
> {code}> Task :integrationTest                                                 
>                                                                               
>                                                                               
>                                                                               
>                                                                               
>                                           
> org.apache.fineract.integrationtests.RecurringDepositTest > 
> testRecurringDepositAccountWithClosureTypeTransferToSavings_WITH_HOLD_TAX 
> FAILED                                                                        
>      java.lang.AssertionError at RecurringDepositTest.java:836{code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to