alberto-art3ch commented on code in PR #4035:
URL: https://github.com/apache/fineract/pull/4035#discussion_r1733078476
##########
integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanProductWithAdvancedPaymentAllocationIntegrationTests.java:
##########
@@ -364,6 +364,42 @@ public void
testCreateCumulativeLoanProductWithInterestRefund() {
loanProductError.get(0).get("userMessageGlobalisationCode"));
}
+ @Test
+ public void testCreateShouldFailWhenNoNumberOfRepaymentsIsProvided() {
+ // given
+ ResponseSpecification errorResponse = new
ResponseSpecBuilder().expectStatusCode(400).build();
+ LoanTransactionHelper validationErrorHelper = new
LoanTransactionHelper(REQUEST_SPEC, errorResponse);
+
+ String loanProduct = new
LoanProductTestBuilder().withPrincipal("15,000.00").withNumberOfRepayments(null)
+
.withRepaymentAfterEvery("1").withRepaymentTypeAsMonth().withinterestRatePerPeriod("1")
+ .withAccountingRulePeriodicAccrual(new Account[] {
ASSET_ACCOUNT, EXPENSE_ACCOUNT, INCOME_ACCOUNT, OVERPAYMENT_ACCOUNT })
+
.withInterestRateFrequencyTypeAsMonths().withAmortizationTypeAsEqualInstallments().withInterestTypeAsDecliningBalance()
+
.withFeeAndPenaltyAssetAccount(FEE_PENALTY_ACCOUNT).withRepaymentStrategy("advanced-payment-allocation-strategy").build();
+
+ // when
+ List<Map<String, String>> loanProductError =
validationErrorHelper.getLoanProductError(loanProduct, "errors");
Review Comment:
Done! Updated
##########
integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanProductWithAdvancedPaymentAllocationIntegrationTests.java:
##########
@@ -364,6 +364,42 @@ public void
testCreateCumulativeLoanProductWithInterestRefund() {
loanProductError.get(0).get("userMessageGlobalisationCode"));
}
+ @Test
+ public void testCreateShouldFailWhenNoNumberOfRepaymentsIsProvided() {
+ // given
+ ResponseSpecification errorResponse = new
ResponseSpecBuilder().expectStatusCode(400).build();
+ LoanTransactionHelper validationErrorHelper = new
LoanTransactionHelper(REQUEST_SPEC, errorResponse);
+
+ String loanProduct = new
LoanProductTestBuilder().withPrincipal("15,000.00").withNumberOfRepayments(null)
+
.withRepaymentAfterEvery("1").withRepaymentTypeAsMonth().withinterestRatePerPeriod("1")
+ .withAccountingRulePeriodicAccrual(new Account[] {
ASSET_ACCOUNT, EXPENSE_ACCOUNT, INCOME_ACCOUNT, OVERPAYMENT_ACCOUNT })
+
.withInterestRateFrequencyTypeAsMonths().withAmortizationTypeAsEqualInstallments().withInterestTypeAsDecliningBalance()
+
.withFeeAndPenaltyAssetAccount(FEE_PENALTY_ACCOUNT).withRepaymentStrategy("advanced-payment-allocation-strategy").build();
+
+ // when
+ List<Map<String, String>> loanProductError =
validationErrorHelper.getLoanProductError(loanProduct, "errors");
+ Assertions.assertEquals("Advanced-payment-allocation-strategy was
selected but no DEFAULT payment allocation was provided",
+ loanProductError.get(0).get("defaultUserMessage"));
+ }
+
+ @Test
+ public void testCreateShouldFailWhenNoInterestRateIsProvided() {
+ // given
+ ResponseSpecification errorResponse = new
ResponseSpecBuilder().expectStatusCode(400).build();
+ LoanTransactionHelper validationErrorHelper = new
LoanTransactionHelper(REQUEST_SPEC, errorResponse);
+
+ String loanProduct = new
LoanProductTestBuilder().withPrincipal("15,000.00").withNumberOfRepayments("4")
+
.withRepaymentAfterEvery("1").withRepaymentTypeAsMonth().withinterestRatePerPeriod(null)
+ .withAccountingRulePeriodicAccrual(new Account[] {
ASSET_ACCOUNT, EXPENSE_ACCOUNT, INCOME_ACCOUNT, OVERPAYMENT_ACCOUNT })
+
.withInterestRateFrequencyTypeAsMonths().withAmortizationTypeAsEqualInstallments().withInterestTypeAsDecliningBalance()
+
.withFeeAndPenaltyAssetAccount(FEE_PENALTY_ACCOUNT).withRepaymentStrategy("advanced-payment-allocation-strategy").build();
+
+ // when
Review Comment:
Done! Updated
--
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]