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_r306668048
 
 

 ##########
 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:
   > In fact, this check should be there in all the tests which rely on jobs to 
be completed.
   
   I agree,, in this case this the only way that loan penalty charges can be 
created,, but the job running time is something we should be concerned, by 
personal experience I can tell you that a loan penalty charge with daily  
frequency could take forever specially if the overdue date is very old. 

----------------------------------------------------------------
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