galovics commented on code in PR #2788:
URL: https://github.com/apache/fineract/pull/2788#discussion_r1039567356


##########
integration-tests/src/test/java/org/apache/fineract/integrationtests/DelinquencyAndChargebackIntegrationTest.java:
##########
@@ -281,6 +285,26 @@ public void 
testLoanClassificationStepAsPartOfCOBRepeated() {
         getLoansLoanIdResponse = loanTransactionHelper.getLoan(requestSpec, 
responseSpec, loanId);
         validateLoanAccount(getLoansLoanIdResponse, amountVal, "400.00", 7, 
Double.valueOf("400.00"));
 
+        // Pay the Loan to get this as Closed
+        loanIdTransactionsResponse = 
loanTransactionHelper.makeLoanRepayment(operationDate, transactionAmount, 
loanId);
+        assertNotNull(loanIdTransactionsResponse);
+        getLoansLoanIdResponse = loanTransactionHelper.getLoan(requestSpec, 
responseSpec, loanId);
+        assertEquals(LoanStatus.CLOSED_OBLIGATIONS_MET.getValue(), 
getLoansLoanIdResponse.getStatus().getId());
+        log.info("Loan id {} with status {}", loanId, 
getLoansLoanIdResponse.getStatus().getCode());
+
+        // Evaluate Installments
+        GetLoansLoanIdRepaymentSchedule getLoanRepaymentSchedule = 
getLoansLoanIdResponse.getRepaymentSchedule();
+        if (getLoanRepaymentSchedule != null) {
+            log.info("Loan with {} periods", 
getLoanRepaymentSchedule.getPeriods().size());
+            for (GetLoansLoanIdRepaymentPeriod period : 
getLoanRepaymentSchedule.getPeriods()) {
+                if (period.getPeriod() != null) {
+                    log.info("Period number {} completed on date {}", 
period.getPeriod(), period.getObligationsMetOnDate());
+                    assertNotNull(period.getObligationsMetOnDate());

Review Comment:
   Why checking only that it's not null. The exact date obligations were met is 
just as important.



##########
integration-tests/src/test/java/org/apache/fineract/integrationtests/DelinquencyAndChargebackIntegrationTest.java:
##########
@@ -281,6 +285,26 @@ public void 
testLoanClassificationStepAsPartOfCOBRepeated() {
         getLoansLoanIdResponse = loanTransactionHelper.getLoan(requestSpec, 
responseSpec, loanId);
         validateLoanAccount(getLoansLoanIdResponse, amountVal, "400.00", 7, 
Double.valueOf("400.00"));
 
+        // Pay the Loan to get this as Closed
+        loanIdTransactionsResponse = 
loanTransactionHelper.makeLoanRepayment(operationDate, transactionAmount, 
loanId);
+        assertNotNull(loanIdTransactionsResponse);
+        getLoansLoanIdResponse = loanTransactionHelper.getLoan(requestSpec, 
responseSpec, loanId);
+        assertEquals(LoanStatus.CLOSED_OBLIGATIONS_MET.getValue(), 
getLoansLoanIdResponse.getStatus().getId());
+        log.info("Loan id {} with status {}", loanId, 
getLoansLoanIdResponse.getStatus().getCode());
+
+        // Evaluate Installments
+        GetLoansLoanIdRepaymentSchedule getLoanRepaymentSchedule = 
getLoansLoanIdResponse.getRepaymentSchedule();
+        if (getLoanRepaymentSchedule != null) {
+            log.info("Loan with {} periods", 
getLoanRepaymentSchedule.getPeriods().size());
+            for (GetLoansLoanIdRepaymentPeriod period : 
getLoanRepaymentSchedule.getPeriods()) {
+                if (period.getPeriod() != null) {
+                    log.info("Period number {} completed on date {}", 
period.getPeriod(), period.getObligationsMetOnDate());
+                    assertNotNull(period.getObligationsMetOnDate());
+                    assertEquals(true, period.getComplete());

Review Comment:
   assertTrue



##########
integration-tests/src/test/java/org/apache/fineract/integrationtests/DelinquencyAndChargebackIntegrationTest.java:
##########
@@ -281,6 +285,26 @@ public void 
testLoanClassificationStepAsPartOfCOBRepeated() {
         getLoansLoanIdResponse = loanTransactionHelper.getLoan(requestSpec, 
responseSpec, loanId);
         validateLoanAccount(getLoansLoanIdResponse, amountVal, "400.00", 7, 
Double.valueOf("400.00"));
 
+        // Pay the Loan to get this as Closed
+        loanIdTransactionsResponse = 
loanTransactionHelper.makeLoanRepayment(operationDate, transactionAmount, 
loanId);
+        assertNotNull(loanIdTransactionsResponse);
+        getLoansLoanIdResponse = loanTransactionHelper.getLoan(requestSpec, 
responseSpec, loanId);
+        assertEquals(LoanStatus.CLOSED_OBLIGATIONS_MET.getValue(), 
getLoansLoanIdResponse.getStatus().getId());
+        log.info("Loan id {} with status {}", loanId, 
getLoansLoanIdResponse.getStatus().getCode());
+
+        // Evaluate Installments
+        GetLoansLoanIdRepaymentSchedule getLoanRepaymentSchedule = 
getLoansLoanIdResponse.getRepaymentSchedule();
+        if (getLoanRepaymentSchedule != null) {
+            log.info("Loan with {} periods", 
getLoanRepaymentSchedule.getPeriods().size());
+            for (GetLoansLoanIdRepaymentPeriod period : 
getLoanRepaymentSchedule.getPeriods()) {
+                if (period.getPeriod() != null) {

Review Comment:
   Null check again



##########
integration-tests/src/test/java/org/apache/fineract/integrationtests/DelinquencyAndChargebackIntegrationTest.java:
##########
@@ -281,6 +285,26 @@ public void 
testLoanClassificationStepAsPartOfCOBRepeated() {
         getLoansLoanIdResponse = loanTransactionHelper.getLoan(requestSpec, 
responseSpec, loanId);
         validateLoanAccount(getLoansLoanIdResponse, amountVal, "400.00", 7, 
Double.valueOf("400.00"));
 
+        // Pay the Loan to get this as Closed
+        loanIdTransactionsResponse = 
loanTransactionHelper.makeLoanRepayment(operationDate, transactionAmount, 
loanId);
+        assertNotNull(loanIdTransactionsResponse);
+        getLoansLoanIdResponse = loanTransactionHelper.getLoan(requestSpec, 
responseSpec, loanId);
+        assertEquals(LoanStatus.CLOSED_OBLIGATIONS_MET.getValue(), 
getLoansLoanIdResponse.getStatus().getId());
+        log.info("Loan id {} with status {}", loanId, 
getLoansLoanIdResponse.getStatus().getCode());
+
+        // Evaluate Installments
+        GetLoansLoanIdRepaymentSchedule getLoanRepaymentSchedule = 
getLoansLoanIdResponse.getRepaymentSchedule();
+        if (getLoanRepaymentSchedule != null) {

Review Comment:
   I don't like the fact that there's a null check here cause it can hide 
issues.



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