FINERACT-2389: Automatically close loans at the end of test executions
This commit is contained in:
+3
@@ -40,8 +40,11 @@ import org.apache.fineract.integrationtests.client.feign.modules.LoanTestAccount
|
||||
import org.apache.fineract.integrationtests.client.feign.modules.LoanTestData;
|
||||
import org.apache.fineract.integrationtests.client.feign.modules.LoanTestValidators;
|
||||
import org.apache.fineract.integrationtests.common.FineractFeignClientHelper;
|
||||
import org.apache.fineract.integrationtests.common.loans.LoanTestLifecycleExtension;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
|
||||
@ExtendWith(LoanTestLifecycleExtension.class)
|
||||
public abstract class FeignLoanTestBase extends FeignIntegrationTest implements LoanProductTemplates {
|
||||
|
||||
protected static FeignAccountHelper accountHelper;
|
||||
|
||||
+11
-1
@@ -36,9 +36,10 @@ import org.apache.fineract.integrationtests.common.BusinessDateHelper;
|
||||
import org.apache.fineract.integrationtests.common.FineractClientHelper;
|
||||
import org.apache.fineract.integrationtests.common.Utils;
|
||||
import org.junit.jupiter.api.extension.AfterEachCallback;
|
||||
import org.junit.jupiter.api.extension.BeforeEachCallback;
|
||||
import org.junit.jupiter.api.extension.ExtensionContext;
|
||||
|
||||
public class LoanTestLifecycleExtension implements AfterEachCallback {
|
||||
public class LoanTestLifecycleExtension implements AfterEachCallback, BeforeEachCallback {
|
||||
|
||||
private LoanTransactionHelper loanTransactionHelper;
|
||||
public static final String DATE_FORMAT = "dd MMMM yyyy";
|
||||
@@ -46,6 +47,15 @@ public class LoanTestLifecycleExtension implements AfterEachCallback {
|
||||
|
||||
@Override
|
||||
public void afterEach(ExtensionContext context) {
|
||||
closeOpenLoans();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeEach(ExtensionContext context) {
|
||||
closeOpenLoans();
|
||||
}
|
||||
|
||||
private void closeOpenLoans() {
|
||||
BusinessDateHelper.runAt(DateTimeFormatter.ofPattern(DATE_FORMAT).format(Utils.getLocalDateOfTenant()), () -> {
|
||||
this.loanTransactionHelper = new LoanTransactionHelper(null, null);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user