josehernandezfintecheandomx commented on code in PR #2550:
URL: https://github.com/apache/fineract/pull/2550#discussion_r960691732


##########
integration-tests/src/test/java/org/apache/fineract/integrationtests/DelinquencyBucketsIntegrationTest.java:
##########
@@ -271,19 +282,41 @@ public void testLoanClassificationJob() {
         
loanTransactionHelper.disburseLoanWithNetDisbursalAmount(operationDate, loanId, 
principalAmount);
 
         // When
+        // Run first time the Job
         final String jobName = "Loan Delinquency Classification";
         schedulerJobHelper.executeAndAwaitJob(jobName);
 
-        final GetLoansLoanIdResponse getLoansLoanIdResponse = 
loanTransactionHelper.getLoan(requestSpec, responseSpec, loanId);
-        log.info("Loan Delinquency Range {}", 
getLoansLoanIdResponse.getDelinquencyRange().getClassification());
+        // Get loan details expecting to have not a delinquency classification
+        GetLoansLoanIdResponse getLoansLoanIdResponse = 
loanTransactionHelper.getLoan(requestSpec, responseSpec, loanId);
+        final GetDelinquencyRangesResponse firstTestCase = 
getLoansLoanIdResponse.getDelinquencyRange();
+        log.info("Loan Delinquency Range is null {}", (firstTestCase == null));
+        GetLoansLoanIdRepaymentSchedule getLoanRepaymentSchedule = 
getLoansLoanIdResponse.getRepaymentSchedule();
+        if (getLoanRepaymentSchedule != null) {
+            log.info("Loan with {} periods", 
getLoanRepaymentSchedule.getPeriods().size());
+            for (GetLoansLoanIdRepaymentPeriod period : 
getLoanRepaymentSchedule.getPeriods()) {
+                log.info("Period number {} for due date {}", 
period.getPeriod(), period.getDueDate());
+            }
+        }
+
+        // Move the Business date to get older the loan and to have an overdue 
loan
+        businessDate = businessDate.plusDays(40);
+        log.info("Current date {}", businessDate);
+        BusinessDateHelper.updateBusinessDate(requestSpec, responseSpec, 
BusinessDateType.COB_DATE, businessDate);
+        // Run Second time the Job
+        schedulerJobHelper.executeAndAwaitJob(jobName);
+
+        // Get loan details expecting to have a delinquency classification
+        getLoansLoanIdResponse = loanTransactionHelper.getLoan(requestSpec, 
responseSpec, loanId);
+        final GetDelinquencyRangesResponse secondTestCase = 
getLoansLoanIdResponse.getDelinquencyRange();
+        log.info("Loan Delinquency Range is {}", 
secondTestCase.getClassification());

Review Comment:
   In general the assertions are at the end of this method, there we validates 
null or not null even in this case to validate the expected classification too



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to