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


##########
integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanApplicationApprovalTest.java:
##########
@@ -67,6 +68,40 @@ public void setup() {
         this.loanTransactionHelper = new 
LoanTransactionHelper(this.requestSpec, this.responseSpec);
     }
 
+    /*
+     * Equal test case: Approved amount non zero is equal to proposed amount
+     */
+    @Test
+    public void loanApplicationApprovedAmountEqualToProposedAmount() {
+
+        final String proposedAmount = "8000";
+        final String approvalAmount = "8000";
+        final String approveDate = "20 September 2012";
+
+        final Integer clientID = ClientHelper.createClient(this.requestSpec, 
this.responseSpec, "01 January 2012");
+        final Integer loanProductID = 
this.loanTransactionHelper.getLoanProductId(new 
LoanProductTestBuilder().build(null));
+        final Integer loanID = applyForLoanApplication(clientID, 
loanProductID, proposedAmount);
+
+        HashMap loanStatusHashMap = 
LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
+        LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
+
+        final String expectedDisbursementDate = null;
+        List<HashMap> approveTranches = null;
+        loanStatusHashMap = 
this.loanTransactionHelper.approveLoanWithApproveAmount(approveDate, 
expectedDisbursementDate, approvalAmount,
+                loanID, approveTranches);
+        LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
+
+    }
+
+    /*
+    * Loan Product Rejection: Negative interest rate
+    */
+    @Test
+    public void NewLoanProductRejectedNegativeInterestRate(){
+        assertThrows(AssertionError.class, ()->{
+                    this.loanTransactionHelper.getLoanProductId(new 
LoanProductTestBuilder().withinterestRatePerPeriod("-6").build(null));});

Review Comment:
   I think this is not necessarily the best idea because you can't be sure why 
the system is throwing an error. Is it because of the negative interest rate 
period or is it because nothing else is filled in the Loan Product.
   
   Let's make a proper loan product that would pass the validations and would 
get created, and spice it up with the negative interest rate period and then 
validate that the API fails.



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