You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by "galovics (via GitHub)" <gi...@apache.org> on 2023/05/23 12:13:00 UTC

[GitHub] [fineract] galovics commented on a diff in pull request #3194: Adding two test cases in LoanApplicationApprovalTest.java

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: commits-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org