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


##########
integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanOriginationValidationTest.java:
##########
@@ -172,6 +172,83 @@ public void uc2() {
         });
     }
 
+    // uc3: Negative Test: Loan application without required parameters
+    // 1. Create a Loan product
+    // 2. Submit Loan application without required parameters
+    @Test
+    public void uc3() {
+        String operationDate = "15 August 2024";
+        runAt(operationDate, () -> {
+
+            LOG.info("------------------------------CREATING NEW LOAN PRODUCT 
---------------------------------------");
+            PostLoanProductsResponse loanProductResponse = loanProductHelper
+                    
.createLoanProduct(createOnePeriod30DaysLongNoInterestPeriodicAccrualProductWithAdvancedPaymentAllocation()
+                            
.loanScheduleType(LoanScheduleType.PROGRESSIVE.toString()));
+            final PostLoansRequest applicationRequest01 = 
applyLoanRequest(client.getClientId(), loanProductResponse.getResourceId(),
+                    operationDate, 100.0, 5).numberOfRepayments(6)//
+                    .loanTermFrequency(6)//
+                    .loanTermFrequencyType(2)//
+                    .transactionProcessingStrategyCode(null)//
+                    .repaymentEvery(1)//
+                    .repaymentFrequencyType(2)//
+            ;//
+
+            CallFailedRuntimeException callFailedRuntimeException = 
Assertions.assertThrows(CallFailedRuntimeException.class,
+                    () -> 
loanTransactionHelper.applyLoan(applicationRequest01));
+
+            // Client Id null
+            Assertions.assertTrue(
+                    callFailedRuntimeException.getMessage().contains("The 
parameter `transactionProcessingStrategyCode` is mandatory."));
+            final PostLoansRequest applicationRequest02 = 
applyLoanRequest(client.getClientId(), loanProductResponse.getResourceId(),
+                    operationDate, 100.0, 5).numberOfRepayments(6)//
+                    .clientId(null) //
+                    .loanTermFrequency(6)//
+                    .loanTermFrequencyType(2)//
+                    
.transactionProcessingStrategyCode(LoanProductTestBuilder.ADVANCED_PAYMENT_ALLOCATION_STRATEGY)//
+                    .repaymentEvery(1)//
+                    .repaymentFrequencyType(2)//
+            ;//
+
+            callFailedRuntimeException = 
Assertions.assertThrows(CallFailedRuntimeException.class,
+                    () -> 
loanTransactionHelper.applyLoan(applicationRequest02));
+
+            
Assertions.assertTrue(callFailedRuntimeException.getMessage().contains("The 
parameter `clientId` is mandatory."));
+
+            // Submitted Date null
+            final PostLoansRequest applicationRequest03 = 
applyLoanRequest(client.getClientId(), loanProductResponse.getResourceId(),
+                    operationDate, 100.0, 5).numberOfRepayments(6)//
+                    .submittedOnDate(null) //
+                    .loanTermFrequency(6)//
+                    .loanTermFrequencyType(2)//
+                    
.transactionProcessingStrategyCode(LoanProductTestBuilder.ADVANCED_PAYMENT_ALLOCATION_STRATEGY)//
+                    .repaymentEvery(1)//
+                    .repaymentFrequencyType(2)//
+            ;//
+
+            callFailedRuntimeException = 
Assertions.assertThrows(CallFailedRuntimeException.class,
+                    () -> 
loanTransactionHelper.applyLoan(applicationRequest03));
+
+            
Assertions.assertTrue(callFailedRuntimeException.getMessage().contains("The 
parameter `submittedOnDate` is mandatory."));

Review Comment:
   Would you mind checking the HTTP code?



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