This is an automated email from the ASF dual-hosted git repository.

adamsaghy pushed a commit to branch release/1.13.1
in repository https://gitbox.apache.org/repos/asf/fineract.git

commit c181490dda5b4b08345a918db6ba4f8fbad7b73f
Author: Adam Saghy <[email protected]>
AuthorDate: Wed Oct 22 20:15:10 2025 +0200

    FINERACT-2389: Automatically close loans at the end of test executions
---
 .../integrationtests/client/feign/FeignLoanTestBase.java     |  3 +++
 .../common/loans/LoanTestLifecycleExtension.java             | 12 +++++++++++-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git 
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/client/feign/FeignLoanTestBase.java
 
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/client/feign/FeignLoanTestBase.java
index 0a4155ca8a..a0806cae80 100644
--- 
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/client/feign/FeignLoanTestBase.java
+++ 
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/client/feign/FeignLoanTestBase.java
@@ -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;
diff --git 
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/loans/LoanTestLifecycleExtension.java
 
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/loans/LoanTestLifecycleExtension.java
index d10508569b..76e9c49ba7 100644
--- 
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/loans/LoanTestLifecycleExtension.java
+++ 
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/loans/LoanTestLifecycleExtension.java
@@ -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);
 

Reply via email to