budaidev commented on code in PR #6542:
URL: https://github.com/apache/fineract/pull/6542#discussion_r4341170683


##########
fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/WorkingCapitalBatchApiStepDef.java:
##########
@@ -289,6 +291,39 @@ public void 
batchApiAddDiscountFeeAdjustmentWithRelatedExternalResourceId(final
         testContext().set(TestContextKey.BATCH_API_CALL_RESPONSE, responses);
     }
 
+    @When("Batch API adjusts by delta {string}th {string} transaction made on 
{string} on the working capital loan with amount {string}")
+    public void batchApiAdjustByDeltaNthWorkingCapitalLoanTransaction(final 
String nthItemStr, final String transactionType,
+            final String transactionDate, final String amount) throws 
IOException {
+        final Long loanId = getCreatedWCLoanId();
+        final TransactionType resolvedType = 
TransactionType.valueOf(transactionType.toUpperCase(Locale.ROOT).replace(' ', 
'_'));
+        final String expectedCode = "loanTransactionType." + 
resolvedType.getValue();
+        final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd 
MMMM yyyy", Locale.ENGLISH);
+        final List<GetWorkingCapitalLoanTransactionIdResponse> transactions = 
ok(
+                () -> 
fineractFeignClient.workingCapitalLoanTransactions().retrieveWorkingCapitalLoanTransactionsById(loanId)).getContent();
+        final int nthItem = Integer.parseInt(nthItemStr) - 1;
+        final GetWorkingCapitalLoanTransactionIdResponse target = 
transactions.stream().filter(t -> {
+            if (t.getType() == null || 
!expectedCode.equals(t.getType().getCode())) {
+                return false;
+            }
+            assert t.getTransactionDate() != null;

Review Comment:
   I wonder if it runs on the CI, usually assert commands are turned off on 
production. Can't we use junit alternative



##########
fineract-working-capital-loan/src/main/java/org/apache/fineract/batch/command/internal/ExecuteWorkingCapitalLoanTransactionCommandByLoanIdTransactionIdCommandStrategy.java:
##########
@@ -0,0 +1,68 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.fineract.batch.command.internal;
+
+import static 
org.apache.fineract.batch.command.CommandStrategyUtils.relativeUrlWithoutVersion;
+
+import com.google.common.base.Splitter;
+import jakarta.ws.rs.core.UriInfo;
+import java.util.List;
+import lombok.RequiredArgsConstructor;
+import org.apache.fineract.batch.command.CommandStrategy;
+import org.apache.fineract.batch.command.CommandStrategyUtils;
+import org.apache.fineract.batch.domain.BatchRequest;
+import org.apache.fineract.batch.domain.BatchResponse;
+import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
+import 
org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer;
+import 
org.apache.fineract.portfolio.workingcapitalloan.api.WorkingCapitalLoanTransactionsApiResource;
+import org.apache.http.HttpStatus;
+import org.springframework.stereotype.Component;
+
+@Component
+@RequiredArgsConstructor
+public class 
ExecuteWorkingCapitalLoanTransactionCommandByLoanIdTransactionIdCommandStrategy 
implements CommandStrategy {

Review Comment:
   URL parsing, command extraction, response setup, serialization, and status 
handling are duplicated four times in the other strategies, consider template 
methods here



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