angelboxes commented on a change in pull request #614: Stop creating 
unnecessary overdue charge when amount is 0.
URL: https://github.com/apache/fineract/pull/614#discussion_r306506927
 
 

 ##########
 File path: 
fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/SchedulerJobsTestResults.java
 ##########
 @@ -724,6 +724,59 @@ public void testApplyPenaltyForOverdueLoansJobOutcome() 
throws InterruptedExcept
 
     }
 
+    @Test
+    public void 
testAvoidUnncessaryPenaltyWhenAmountZeroForOverdueLoansJobOutcome() throws 
InterruptedException {
+        this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, 
this.responseSpec);
+        this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec, 
this.responseSpec);
+        this.loanTransactionHelper = new 
LoanTransactionHelper(this.requestSpec, this.responseSpec);
+
+        final Integer clientID = ClientHelper.createClient(this.requestSpec, 
this.responseSpec);
+        Assert.assertNotNull(clientID);
+
+        Integer overdueFeeChargeId = ChargesHelper
+                .createCharges(this.requestSpec, this.responseSpec, 
ChargesHelper.getLoanOverdueFeeJSONWithCalculattionTypePercentage("0.000001"));
+        Assert.assertNotNull(overdueFeeChargeId);
+
+        final Integer loanProductID = 
createLoanProduct(overdueFeeChargeId.toString());
+        Assert.assertNotNull(loanProductID);
+
+        final Integer loanID = applyForLoanApplication(clientID.toString(), 
loanProductID.toString(), null);
+        Assert.assertNotNull(loanID);
+
+        HashMap loanStatusHashMap = 
LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
+        LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
+
+        loanStatusHashMap = 
this.loanTransactionHelper.approveLoan(AccountTransferTest.LOAN_APPROVAL_DATE, 
loanID);
+        LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
+
+        loanStatusHashMap = 
this.loanTransactionHelper.disburseLoan(AccountTransferTest.LOAN_APPROVAL_DATE_PLUS_ONE,
 loanID);
+        LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
+
+        ArrayList<HashMap> repaymentScheduleDataBefore = 
this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec,
+                this.responseSpec, loanID);
+
+        String JobName = "Apply penalty to overdue loans";
+        this.schedulerJobHelper.executeJob(JobName);
+
 
 Review comment:
   Executing the "Apply penalties" job doesn't guarantee you that the created 
loan is processed by the time this test finishes its run. It will only start 
the job. Before checking the loan charges, you should check either if the job 
finished or if the loan was processed. This job will also check penalties for 
any other active loan with charges and depending on loan configuration and  the 
date it was created, this could take some time.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to