This is an automated email from the ASF dual-hosted git repository.
adamsaghy pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract.git
The following commit(s) were added to refs/heads/develop by this push:
new 6a381df78 FINERACT-2081: fix integrationtest init
6a381df78 is described below
commit 6a381df7843d6815489fbd58b4b282550447d3d1
Author: Marta Jankovics <[email protected]>
AuthorDate: Mon Oct 21 15:43:42 2024 +0200
FINERACT-2081: fix integrationtest init
---
.../fineract/integrationtests/BaseLoanIntegrationTest.java | 6 +++++-
.../LoanTransactionAccrualActivityPostingTest.java | 14 ++++++++++++--
.../common/funds/FundsResourceHandler.java | 6 ++++++
3 files changed, 23 insertions(+), 3 deletions(-)
diff --git
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/BaseLoanIntegrationTest.java
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/BaseLoanIntegrationTest.java
index 7d751155f..71dc80b44 100644
---
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/BaseLoanIntegrationTest.java
+++
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/BaseLoanIntegrationTest.java
@@ -94,6 +94,7 @@ import
org.apache.fineract.integrationtests.common.loans.LoanProductHelper;
import
org.apache.fineract.integrationtests.common.loans.LoanProductTestBuilder;
import
org.apache.fineract.integrationtests.common.loans.LoanTestLifecycleExtension;
import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
+import
org.apache.fineract.integrationtests.common.products.DelinquencyBucketsHelper;
import org.apache.fineract.integrationtests.common.system.CodeHelper;
import org.apache.fineract.integrationtests.inlinecob.InlineLoanCOBHelper;
import
org.apache.fineract.integrationtests.useradministration.users.UserHelper;
@@ -250,6 +251,9 @@ public abstract class BaseLoanIntegrationTest {
}
protected PostLoanProductsRequest create4IProgressive() {
+ final Integer delinquencyBucketId =
DelinquencyBucketsHelper.createDelinquencyBucket(requestSpec, responseSpec);
+ Assertions.assertNotNull(delinquencyBucketId);
+
return new
PostLoanProductsRequest().name(Utils.uniqueRandomStringGenerator("4I_PROGRESSIVE_",
6))//
.shortName(Utils.uniqueRandomStringGenerator("", 4))//
.description("4 installment product - progressive")//
@@ -342,7 +346,7 @@ public abstract class BaseLoanIntegrationTest {
.graceOnPrincipalAndInterestPayment(true)//
.graceOnArrearsAgeing(true)//
).isEqualAmortization(false)//
- .delinquencyBucketId(1L)//
+ .delinquencyBucketId(delinquencyBucketId.longValue())//
.enableDownPayment(false)//
.enableInstallmentLevelDelinquency(false)//
.loanScheduleType("PROGRESSIVE")//
diff --git
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanTransactionAccrualActivityPostingTest.java
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanTransactionAccrualActivityPostingTest.java
index 2598ead68..90bb85c33 100644
---
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanTransactionAccrualActivityPostingTest.java
+++
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanTransactionAccrualActivityPostingTest.java
@@ -18,6 +18,7 @@
*/
package org.apache.fineract.integrationtests;
+import static
org.apache.fineract.integrationtests.common.funds.FundsResourceHandler.createFund;
import static
org.apache.fineract.integrationtests.common.loans.LoanProductTestBuilder.ADVANCED_PAYMENT_ALLOCATION_STRATEGY;
import static
org.apache.fineract.integrationtests.common.loans.LoanProductTestBuilder.DEFAULT_STRATEGY;
import static org.junit.jupiter.api.Assertions.assertNotNull;
@@ -57,12 +58,14 @@ import org.apache.fineract.integrationtests.common.Utils;
import org.apache.fineract.integrationtests.common.charges.ChargesHelper;
import
org.apache.fineract.integrationtests.common.loans.LoanTestLifecycleExtension;
import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
+import
org.apache.fineract.integrationtests.common.products.DelinquencyBucketsHelper;
import org.apache.fineract.integrationtests.inlinecob.InlineLoanCOBHelper;
import org.apache.fineract.portfolio.charge.domain.ChargeCalculationType;
import org.apache.fineract.portfolio.charge.domain.ChargePaymentMode;
import org.apache.fineract.portfolio.charge.domain.ChargeTimeType;
import
org.apache.fineract.portfolio.loanaccount.loanschedule.domain.LoanScheduleType;
import org.apache.fineract.portfolio.loanproduct.domain.PaymentAllocationType;
+import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
@@ -980,13 +983,20 @@ public class LoanTransactionAccrualActivityPostingTest
extends BaseLoanIntegrati
loanPaymentChannelToFundSourceMappings.fundSourceAccountId(fundSource.getAccountID().longValue());
loanPaymentChannelToFundSourceMappings.paymentTypeId(1L);
paymentChannelToFundSourceMappings.add(loanPaymentChannelToFundSourceMappings);
+
+ final Integer fundId = createFund(requestSpec, responseSpec);
+ Assertions.assertNotNull(fundId);
+
+ final Integer delinquencyBucketId =
DelinquencyBucketsHelper.createDelinquencyBucket(requestSpec, responseSpec);
+ Assertions.assertNotNull(delinquencyBucketId);
+
return new PostLoanProductsRequest()//
.name(name)//
.enableAccrualActivityPosting(true)//
.shortName(shortName)//
.description(
"LP1 with 12% DECLINING BALANCE interest, interest
period: Daily, Interest recalculation-Daily, Compounding:none")//
- .fundId(1L)//
+ .fundId(fundId.longValue())//
.startDate(null)//
.closeDate(null)//
.includeInBorrowerCycle(false)//
@@ -1066,7 +1076,7 @@ public class LoanTransactionAccrualActivityPostingTest
extends BaseLoanIntegrati
.locale("en")//
.disallowExpectedDisbursements(false)//
.allowApprovedDisbursedAmountsOverApplied(false)//
- .delinquencyBucketId(1L)//
+ .delinquencyBucketId(delinquencyBucketId.longValue())//
.paymentChannelToFundSourceMappings(paymentChannelToFundSourceMappings)//
.penaltyToIncomeAccountMappings(penaltyToIncomeAccountMappings)//
.feeToIncomeAccountMappings(feeToIncomeAccountMappings)//
diff --git
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/funds/FundsResourceHandler.java
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/funds/FundsResourceHandler.java
index da98f258e..99f5386ce 100644
---
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/funds/FundsResourceHandler.java
+++
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/funds/FundsResourceHandler.java
@@ -24,6 +24,7 @@ import io.restassured.specification.RequestSpecification;
import io.restassured.specification.ResponseSpecification;
import java.util.HashMap;
import java.util.List;
+import java.util.UUID;
import org.apache.fineract.integrationtests.common.Utils;
public final class FundsResourceHandler {
@@ -40,6 +41,11 @@ public final class FundsResourceHandler {
return Utils.performServerPost(requestSpec, responseSpec,
CREATE_FUNDS_URL, fundJSON, "resourceId");
}
+ public static Integer createFund(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec) {
+ FundsHelper fh =
FundsHelper.create(Utils.uniqueRandomStringGenerator("",
10)).externalId(UUID.randomUUID().toString()).build();
+ return createFund(fh.toJSON(), requestSpec, responseSpec);
+ }
+
public static List<FundsHelper> retrieveAllFunds(final
RequestSpecification requestSpec, final ResponseSpecification responseSpec) {
final String URL = FUNDS_URL + "?" + Utils.TENANT_IDENTIFIER;
List<HashMap<String, Object>> list =
Utils.performServerGet(requestSpec, responseSpec, URL, "");