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


##########
fineract-provider/src/test/java/org/apache/fineract/cob/loan/CheckLoanRepaymentOverdueBusinessStepTest.java:
##########
@@ -175,4 +182,53 @@ public void 
givenLoanWithInstallmentOverdueAfterConfiguredDaysInLoanProductWhenS
         assertEquals(repaymentInstallment, loanPayloadForEvent);
         assertEquals(processedLoan, loanForProcessing);
     }
+
+    @Test
+    public void 
givenActiveLoanWithZeroOutstandingWhenStepExecutionThenNoBusinessEventIsRaised()
 {
+        // given
+        
when(configurationDomainService.retrieveRepaymentOverdueDays()).thenReturn(2L);
+        LocalDate loanInstallmentRepaymentDueDateBefore5Days = 
DateUtils.getBusinessLocalDate().minusDays(1);
+        Loan loanForProcessing = Mockito.mock(Loan.class);
+        LoanProduct loanProduct = Mockito.mock(LoanProduct.class);
+        LoanSummary loanSummary = Mockito.mock(LoanSummary.class);
+        List<LoanRepaymentScheduleInstallment> 
loanRepaymentScheduleInstallments = Arrays
+                .asList(new 
LoanRepaymentScheduleInstallment(loanForProcessing, 1, 
LocalDate.now(ZoneId.systemDefault()),
+                        loanInstallmentRepaymentDueDateBefore5Days, 
BigDecimal.valueOf(0.0), BigDecimal.valueOf(0.0),
+                        BigDecimal.valueOf(0.0), BigDecimal.valueOf(0.0), 
false, new HashSet<>(), BigDecimal.valueOf(0.0)));
+        when(loanForProcessing.getLoanProduct()).thenReturn(loanProduct);
+        when(loanProduct.getOverDueDaysForRepaymentEvent()).thenReturn(1);
+        when(loanForProcessing.getLoanSummary()).thenReturn(loanSummary);
+        
when(loanForProcessing.getLoanSummary().getTotalOutstanding()).thenReturn(BigDecimal.ZERO);
+        
when(loanForProcessing.getRepaymentScheduleInstallments()).thenReturn(loanRepaymentScheduleInstallments);
+        // when
+        Loan processedLoan = underTest.execute(loanForProcessing);
+        // then - No Business Event raised
+        verify(businessEventNotifierService, 
times(0)).notifyPostBusinessEvent(any());
+        assertEquals(processedLoan, loanForProcessing);
+    }
+
+    @Test
+    public void 
givenActiveLoanWithNonZeroOutstandingWhenStepExecutionThenBusinessEventIsRaised()
 {

Review Comment:
   I dont see test case to check whether the event got not raised if the loan 
status is SUBMITTED or APPROVED



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