adamsaghy commented on code in PR #6271:
URL: https://github.com/apache/fineract/pull/6271#discussion_r3795246717


##########
integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanManualInterestRefundResponseStructureTest.java:
##########
@@ -59,48 +61,53 @@ public static void beforeAll() {
     @Test
     public void testManualInterestRefundResponseStructureWithoutExternalIds() {
         AtomicReference<Long> loanIdRef = new AtomicReference<>();
-        AtomicReference<Long> targetTransactionIdRef = new AtomicReference<>();
 
-        runAt("01 January 2024", () -> {
-            Long loanProductId = createLoanProduct(
-                    
create4IProgressive().daysInMonthType(DaysInMonthType.ACTUAL).daysInYearType(DaysInYearType.ACTUAL)
-                            
.addSupportedInterestRefundTypesItem(SupportedInterestRefundTypesItem.MERCHANT_ISSUED_REFUND)
-                            
.recalculationRestFrequencyType(RecalculationRestFrequencyType.DAILY));
+        try {
+            
globalConfigurationHelper.updateGlobalConfiguration(GlobalConfigurationConstants.ENABLE_AUTO_GENERATED_EXTERNAL_ID,
+                    new PutGlobalConfigurationsRequest().enabled(false));
+            runAt("01 January 2024", () -> {
+                Long loanProductId = createLoanProduct(
+                        
create4IProgressive().daysInMonthType(DaysInMonthType.ACTUAL).daysInYearType(DaysInYearType.ACTUAL)
+                                
.addSupportedInterestRefundTypesItem(SupportedInterestRefundTypesItem.MERCHANT_ISSUED_REFUND)
+                                
.recalculationRestFrequencyType(RecalculationRestFrequencyType.DAILY));
 
-            Long loanId = applyAndApproveProgressiveLoan(client.getClientId(), 
loanProductId, "01 January 2024", 1000.0, 9.9, 12, null);
-            assertNotNull(loanId);
-            loanIdRef.set(loanId);
+                Long loanId = 
applyAndApproveProgressiveLoan(client.getClientId(), loanProductId, "01 January 
2024", 1000.0, 9.9, 12, null);
+                assertNotNull(loanId);
+                loanIdRef.set(loanId);
 
-            disburseLoan(loanId, BigDecimal.valueOf(1000), "01 January 2024");
-        });
+                disburseLoan(loanId, BigDecimal.valueOf(1000), "01 January 
2024");
+            });
 
-        runAt("15 January 2024", () -> {
-            Long loanId = loanIdRef.get();
+            runAt("15 January 2024", () -> {
+                Long loanId = loanIdRef.get();
 
-            PostLoansLoanIdTransactionsResponse refundResponse = 
makeLoanMerchantIssuedRefund(loanId, "15 January 2024", 100.0);
-            assertNotNull(refundResponse);
-            assertNotNull(refundResponse.getResourceId());
-            targetTransactionIdRef.set(refundResponse.getResourceId());
+                PostLoansLoanIdTransactionsResponse refundResponse = 
makeLoanMerchantIssuedRefund(loanId, "15 January 2024", 100.0);
+                assertNotNull(refundResponse);
+                assertNotNull(refundResponse.getResourceId());
 
-            PostLoansLoanIdTransactionsResponse interestRefundResponse = 
createManualInterestRefund(loanId, refundResponse.getResourceId(),
-                    "15 January 2024", 5.0, null);
+                PostLoansLoanIdTransactionsResponse interestRefundResponse = 
createManualInterestRefund(loanId,
+                        refundResponse.getResourceId(), "15 January 2024", 
5.0, null);
 
-            assertNotNull(interestRefundResponse, "Interest refund response 
should not be null");
-            assertNotNull(interestRefundResponse.getResourceId(), "Interest 
refund resource ID should not be null");
+                assertNotNull(interestRefundResponse, "Interest refund 
response should not be null");
+                assertNotNull(interestRefundResponse.getResourceId(), 
"Interest refund resource ID should not be null");
 
-            GetLoansLoanIdResponse loanDetails = getLoanDetails(loanId);
-            GetLoansLoanIdTransactions interestRefundTransaction = 
findTransactionByType(loanDetails, "Interest Refund");
-            assertNotNull(interestRefundTransaction, "Interest Refund 
transaction should exist");
+                GetLoansLoanIdResponse loanDetails = getLoanDetails(loanId);
+                GetLoansLoanIdTransactions interestRefundTransaction = 
findTransactionByType(loanDetails, "Interest Refund");
+                assertNotNull(interestRefundTransaction, "Interest Refund 
transaction should exist");
 
-            assertEquals(interestRefundTransaction.getId(), 
interestRefundResponse.getResourceId(),
-                    "Response entityId should be the Interest Refund 
transaction ID");
+                assertEquals(interestRefundTransaction.getId(), 
interestRefundResponse.getResourceId(),
+                        "Response entityId should be the Interest Refund 
transaction ID");
 
-            assertNull(interestRefundResponse.getResourceExternalId(), 
"entityExternalId should be null when no external ID provided");
+                assertNull(interestRefundResponse.getResourceExternalId(), 
"entityExternalId should be null when no external ID provided");
 
-            assertNull(interestRefundResponse.getSubResourceId(), "subEntityId 
should be null");
+                assertNull(interestRefundResponse.getSubResourceId(), 
"subEntityId should be null");
 
-            assertNull(interestRefundResponse.getSubResourceExternalId(), 
"subEntityExternalId should be null");
-        });
+                assertNull(interestRefundResponse.getSubResourceExternalId(), 
"subEntityExternalId should be null");
+            });
+        } finally {
+            
globalConfigurationHelper.updateGlobalConfiguration(GlobalConfigurationConstants.ENABLE_AUTO_GENERATED_EXTERNAL_ID,

Review Comment:
   You are right.



-- 
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]

Reply via email to