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


##########
integration-tests/src/test/java/org/apache/fineract/integrationtests/InstallmentLevelDelinquencyAPIIntegrationTests.java:
##########
@@ -410,6 +411,55 @@ public void 
tesInstallmentLevelSettingForLoanWithLoanProductWithoutDelinquencyBu
 
     }
 
+    @Test
+    public void 
tesInstallmentLevelSettingForLoanProductWithoutDelinquencyBucketValidation() {
+
+        runAt("31 May 2023", () -> {
+            // Create Client
+            Long clientId = 
clientHelper.createClient(ClientHelper.defaultClientCreationRequest()).getClientId();
+
+            // Create Loan Product without delinquency bucket
+            PostLoanProductsRequest loanProductsRequest = 
create1InstallmentAmountInMultiplesOf4Period1MonthLongWithInterestAndAmortizationProduct(
+                    InterestType.FLAT, AmortizationType.EQUAL_INSTALLMENTS);
+            // set installment level delinquency as true
+            loanProductsRequest.setEnableInstallmentLevelDelinquency(true);
+
+            // Create loan product with installment level delinquency setting
+            CallFailedRuntimeException callFailedRuntimeException = 
Assertions.assertThrows(CallFailedRuntimeException.class,
+                    () -> 
loanProductHelper.createLoanProduct(loanProductsRequest));
+
+            Assertions.assertTrue(callFailedRuntimeException.getMessage()
+                    .contains("Installment level delinquency cannot be enabled 
if Delinquency bucket is not configured for loan product"));
+
+        });
+
+    }
+
+    @Test
+    public void 
tesUpdateInstallmentLevelSettingForLoanProductWithoutDelinquencyBucketValidation()
 {
+
+        runAt("31 May 2023", () -> {
+            // Create Client
+            Long clientId = 
clientHelper.createClient(ClientHelper.defaultClientCreationRequest()).getClientId();
+
+            // Create Loan Product without delinquency bucket
+            PostLoanProductsRequest loanProductsRequest = 
create1InstallmentAmountInMultiplesOf4Period1MonthLongWithInterestAndAmortizationProduct(
+                    InterestType.FLAT, AmortizationType.EQUAL_INSTALLMENTS);
+
+            PostLoanProductsResponse loanProductResponse = 
loanProductHelper.createLoanProduct(loanProductsRequest);
+
+            // Update loan product with installment level delinquency setting
+            CallFailedRuntimeException callFailedRuntimeException = 
Assertions.assertThrows(CallFailedRuntimeException.class,
+                    () -> 
loanProductHelper.updateLoanProductById(loanProductResponse.getResourceId(),
+                            new 
PutLoanProductsProductIdRequest().enableInstallmentLevelDelinquency(true).locale("en")));
+
+            Assertions.assertTrue(callFailedRuntimeException.getMessage()
+                    .contains("Installment level delinquency cannot be enabled 
if Delinquency bucket is not configured for loan product"));
+
+        });
+
+    }
+

Review Comment:
   Dont we need a test case when delinquency bucket was set, but installment 
level delinquency was not enable on the loan product, but during loan submit we 
enable it or after loan submit we modifiy the loan application and enable it?



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