adamsaghy commented on code in PR #3674:
URL: https://github.com/apache/fineract/pull/3674#discussion_r1450896392


##########
integration-tests/src/test/java/org/apache/fineract/integrationtests/DelinquencyBucketsIntegrationTest.java:
##########
@@ -1571,6 +1571,58 @@ public void 
testDelinquencyWithMultiplePausePeriodsWithInstallmentLevelDelinquen
         }
     }
 
+    @Test
+    public void testLoanClassificationOnyForActiveLoan() {
+
+        // Given
+        final LoanTransactionHelper loanTransactionHelper = new 
LoanTransactionHelper(this.requestSpec, this.responseSpec);
+
+        ArrayList<Integer> rangeIds = new ArrayList<>();
+        // First Range
+        String jsonRange = DelinquencyRangesHelper.getAsJSON(4, 30);
+        PostDelinquencyRangeResponse delinquencyRangeResponse = 
DelinquencyRangesHelper.createDelinquencyRange(requestSpec, responseSpec,
+                jsonRange);
+        rangeIds.add(delinquencyRangeResponse.getResourceId());
+
+        String jsonBucket = DelinquencyBucketsHelper.getAsJSON(rangeIds);
+        PostDelinquencyBucketResponse delinquencyBucketResponse = 
DelinquencyBucketsHelper.createDelinquencyBucket(requestSpec,
+                responseSpec, jsonBucket);
+        assertNotNull(delinquencyBucketResponse);
+        final GetDelinquencyBucketsResponse delinquencyBucket = 
DelinquencyBucketsHelper.getDelinquencyBucket(requestSpec, responseSpec,
+                delinquencyBucketResponse.getResourceId());
+
+        // Client and Loan account creation
+        final Integer clientId = ClientHelper.createClient(this.requestSpec, 
this.responseSpec, "01 January 2012");
+        final GetLoanProductsProductIdResponse getLoanProductsProductResponse 
= createLoanProduct(loanTransactionHelper,
+                Math.toIntExact(delinquencyBucket.getId()), null);
+        assertNotNull(getLoanProductsProductResponse);
+
+        final LocalDate todaysDate = Utils.getLocalDateOfTenant();
+        // Older date to have more than one overdue installment
+        LocalDate transactionDate = todaysDate.minusDays(37);
+        String operationDate = Utils.dateFormatter.format(transactionDate);
+
+        // Create Loan Application
+        final Integer loanId = createLoanApplication(loanTransactionHelper, 
clientId.toString(),
+                getLoanProductsProductResponse.getId().toString(), 
operationDate, null);
+
+        // Evaluate default delinquent values in No Active Loan
+        GetLoansLoanIdResponse getLoansLoanIdResponse = 
loanTransactionHelper.getLoan(requestSpec, responseSpec, loanId);
+        assertNotNull(getLoansLoanIdResponse);
+        assertNotNull(getLoansLoanIdResponse.getDelinquent());
+        assertEquals(0, 
getLoansLoanIdResponse.getDelinquent().getDelinquentDays());
+        assertEquals(0, 
getLoansLoanIdResponse.getDelinquent().getDelinquentAmount());
+
+        // Loan Disbursement
+        disburseLoanAccount(loanTransactionHelper, loanId, operationDate);
+        // Evaluate default delinquent values in No Active Loan
+        getLoansLoanIdResponse = loanTransactionHelper.getLoan(requestSpec, 
responseSpec, loanId);
+        assertNotNull(getLoansLoanIdResponse);
+        assertNotNull(getLoansLoanIdResponse.getDelinquent());
+        assertNotEquals(0, 
getLoansLoanIdResponse.getDelinquent().getDelinquentDays());

Review Comment:
   Would have been better if you match with the exact delinquent days instead 
of "not zero". 



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