DeathGun44 commented on code in PR #6158:
URL: https://github.com/apache/fineract/pull/6158#discussion_r3795711375
##########
integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanAccrualTransactionOnChargeSubmittedDateTest.java:
##########
@@ -22,892 +22,456 @@
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
-import io.restassured.builder.RequestSpecBuilder;
-import io.restassured.builder.ResponseSpecBuilder;
-import io.restassured.http.ContentType;
-import io.restassured.specification.RequestSpecification;
-import io.restassured.specification.ResponseSpecification;
+import java.math.BigDecimal;
import java.time.LocalDate;
-import java.time.format.DateTimeFormatter;
-import java.time.format.DateTimeFormatterBuilder;
-import java.util.ArrayList;
-import java.util.HashMap;
import java.util.List;
import java.util.UUID;
-import org.apache.fineract.client.models.GetLoanProductsProductIdResponse;
import org.apache.fineract.client.models.GetLoansLoanIdRepaymentPeriod;
import org.apache.fineract.client.models.GetLoansLoanIdResponse;
-import org.apache.fineract.client.models.PostCreateRescheduleLoansRequest;
-import org.apache.fineract.client.models.PostCreateRescheduleLoansResponse;
+import org.apache.fineract.client.models.GetLoansLoanIdTransactions;
+import org.apache.fineract.client.models.PostLoanProductsRequest;
+import org.apache.fineract.client.models.PostLoansLoanIdChargesRequest;
import org.apache.fineract.client.models.PostLoansLoanIdTransactionsRequest;
import org.apache.fineract.client.models.PostLoansLoanIdTransactionsResponse;
+import org.apache.fineract.client.models.PostLoansRequest;
import org.apache.fineract.client.models.PutGlobalConfigurationsRequest;
-import org.apache.fineract.infrastructure.businessdate.domain.BusinessDateType;
import
org.apache.fineract.infrastructure.configuration.api.GlobalConfigurationConstants;
-import org.apache.fineract.infrastructure.core.service.DateUtils;
-import org.apache.fineract.integrationtests.common.BusinessDateHelper;
-import org.apache.fineract.integrationtests.common.ClientHelper;
-import org.apache.fineract.integrationtests.common.LoanRescheduleRequestHelper;
-import org.apache.fineract.integrationtests.common.SchedulerJobHelper;
+import org.apache.fineract.integrationtests.client.feign.FeignLoanTestBase;
+import
org.apache.fineract.integrationtests.client.feign.modules.LoanRequestBuilders;
+import org.apache.fineract.integrationtests.client.feign.modules.LoanTestData;
import org.apache.fineract.integrationtests.common.Utils;
-import org.apache.fineract.integrationtests.common.accounting.Account;
-import org.apache.fineract.integrationtests.common.accounting.AccountHelper;
-import
org.apache.fineract.integrationtests.common.accounting.PeriodicAccrualAccountingHelper;
-import org.apache.fineract.integrationtests.common.charges.ChargesHelper;
-import
org.apache.fineract.integrationtests.common.loans.LoanApplicationTestBuilder;
-import
org.apache.fineract.integrationtests.common.loans.LoanProductTestBuilder;
-import
org.apache.fineract.integrationtests.common.loans.LoanRescheduleRequestTestBuilder;
-import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
-import org.apache.fineract.integrationtests.inlinecob.InlineLoanCOBHelper;
-import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
-public class LoanAccrualTransactionOnChargeSubmittedDateTest extends
BaseLoanIntegrationTest {
-
- private ResponseSpecification responseSpec;
- private RequestSpecification requestSpec;
- private LoanTransactionHelper loanTransactionHelper;
- private ClientHelper clientHelper;
- private DateTimeFormatter dateFormatter = new
DateTimeFormatterBuilder().appendPattern("dd MMMM yyyy").toFormatter();
- private AccountHelper accountHelper;
- private InlineLoanCOBHelper inlineLoanCOBHelper;
-
- @BeforeEach
- public void setup() {
- Utils.initializeRESTAssured();
- this.requestSpec = new
RequestSpecBuilder().setContentType(ContentType.JSON).build();
- this.requestSpec.header("Authorization", "Basic " +
Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
- this.requestSpec.header("Fineract-Platform-TenantId", "default");
- this.responseSpec = new
ResponseSpecBuilder().expectStatusCode(200).build();
- this.loanTransactionHelper = new
LoanTransactionHelper(this.requestSpec, this.responseSpec);
- this.clientHelper = new ClientHelper(this.requestSpec,
this.responseSpec);
- this.accountHelper = new AccountHelper(this.requestSpec,
this.responseSpec);
- this.inlineLoanCOBHelper = new InlineLoanCOBHelper(this.requestSpec,
this.responseSpec);
- }
+public class LoanAccrualTransactionOnChargeSubmittedDateTest extends
FeignLoanTestBase {
+
+ private static final String STRATEGY = "mifos-standard-strategy";
+ private static final String CHARGE_ACCRUAL_DATE_SUBMITTED =
"submitted-date";
+ private static final String CHARGE_ACCRUAL_DATE_DUE = "due-date";
@Test
public void
loanAccrualTransactionOnChargeSubmittedTest_Accrual_Accounting_Api() {
try {
+ enableSubmittedDateChargeAccrual(LocalDate.of(2023, 3, 3));
+ String loanExternalIdStr = UUID.randomUUID().toString();
+ final Long clientId = createClient();
+ final Long loanProductId =
createLoanProduct(singleRepaymentAccrualProduct());
+ final Long loanId = createSingleRepaymentLoan(clientId,
loanProductId, loanExternalIdStr);
+ addPenaltyCharge(loanId, "10 March 2023", 10.0);
// Accounts oof periodic accrual
- final Account assetAccount =
this.accountHelper.createAssetAccount();
- final Account incomeAccount =
this.accountHelper.createIncomeAccount();
- final Account expenseAccount =
this.accountHelper.createExpenseAccount();
- final Account overpaymentAccount =
this.accountHelper.createLiabilityAccount();
+ addFeeCharge(loanId, "14 March 2023", 10.0);
+ runPeriodicAccrualAccounting("03 March 2023");
// Set business date
- LocalDate currentDate = LocalDate.of(2023, 3, 3);
- final String accrualRunTillDate =
dateFormatter.format(currentDate);
+ checkAccrualTransaction(LocalDate.of(2023, 3, 3), 0.0, 10.0, 10.0,
loanId);
-
globalConfigurationHelper.updateGlobalConfiguration(GlobalConfigurationConstants.ENABLE_BUSINESS_DATE,
- new PutGlobalConfigurationsRequest().enabled(true));
-
BusinessDateHelper.updateBusinessDate(BusinessDateType.BUSINESS_DATE,
currentDate);
-
globalConfigurationHelper.updateGlobalConfiguration(GlobalConfigurationConstants.CHARGE_ACCRUAL_DATE,
- new
PutGlobalConfigurationsRequest().stringValue("submitted-date"));
+ updateBusinessDate("04 March 2023");
+ makeLoanRepayment(loanExternalIdStr, repaymentRequest("4 March
2023", 100.0));
// Loan ExternalId
- String loanExternalIdStr = UUID.randomUUID().toString();
+ addFeeCharge(loanId, "21 March 2023", 10.0);
+ runPeriodicAccrualAccounting("04 March 2023");
// Client and Loan account creation
-
Review Comment:
Nothing was removed here - that comment is just in the wrong place, and I'm
sorry it read that way.
When I restored the comments after the last review, they were re-inserted
mechanically and landed
away from the code they describe. So `// Client and Loan account creation`
ended up with no statement
under it, which makes it look like the step was deleted.
All the steps are still in the test, a few lines higher!
--
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]