FINERACT-2081: fix integrationtest init

This commit is contained in:
Marta Jankovics
2024-10-22 18:46:21 +02:00
committed by Adam Saghy
parent a9ecdf97a4
commit 6a381df784
3 changed files with 23 additions and 3 deletions
@@ -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")//
@@ -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)//
@@ -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, "");