oleksii-novikov-onix commented on code in PR #4518:
URL: https://github.com/apache/fineract/pull/4518#discussion_r2028302437


##########
fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/LoanStepDef.java:
##########
@@ -2378,6 +2380,27 @@ public void 
checkLoanChargeAdjustmentPostBusinessEvent(String date) throws IOExc
         
eventAssertion.assertEventRaised(LoanChargeAdjustmentPostBusinessEvent.class, 
loadTransaction.getId());
     }
 
+    @Then("BulkBusinessEvent is not raised on {string}")
+    public void checkLoanBulkBusinessEventNotCreatedBusinessEvent(String date) 
throws IOException {
+        Response<PostLoansResponse> loanCreateResponse = 
testContext().get(TestContextKey.LOAN_CREATE_RESPONSE);
+        long loanId = loanCreateResponse.body().getLoanId();
+
+        Response<GetLoansLoanIdResponse> loanDetailsResponse = 
loansApi.retrieveLoan(loanId, false, "transactions", "", "").execute();
+        ErrorHelper.checkSuccessfulApiCall(loanDetailsResponse);
+
+        List<GetLoansLoanIdTransactions> transactions = 
loanDetailsResponse.body().getTransactions();
+
+        // Filter transactions on the specified date
+        List<GetLoansLoanIdTransactions> transactionsOnDate = 
transactions.stream().filter(t -> date.equals(FORMATTER.format(t.getDate())))
+                .collect(Collectors.toList());
+
+        // For each transaction on the specified date, assert that no 
BulkBusinessEvent was raised
+        for (GetLoansLoanIdTransactions transaction : transactionsOnDate) {
+            Long transactionId = transaction.getId();
+            eventAssertion.assertEventNotRaised(BulkBusinessEvent.class, null);

Review Comment:
   This loop might be redundant - it runs the same check, 
assertEventNotRaised(BulkBusinessEvent.class, null), multiple times, which is 
not good.
   1. If the goal is to verify no BulkBusinessEvents exist at all, a single 
call outside the loop would be more efficient.
   2. If the goal is to check for specific transaction id, it should use 
transactionId instead of null in the assertion.



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