DeathGun44 commented on code in PR #6158:
URL: https://github.com/apache/fineract/pull/6158#discussion_r3782989296
##########
integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanChargeTaxIntegrationTest.java:
##########
@@ -352,202 +286,137 @@ public void testTaxGroup_appearsInRetrieveAllList() {
// 8. Multiple loans – tax applied independently per loan charge
// -----------------------------------------------------------------------
- /**
- * Adding the same taxed charge definition to two different loans must
result in independent charge records each
- * keeping the original base amount. Verifies that per-loan charge state
is isolated.
- */
@Test
public void testLoanChargeTax_appliedIndependentlyToEachLoan() {
runAt(LOAN_DATE, () -> {
- // Given – shared charge definition with 10 % tax
PostTaxesComponentsResponse taxComponent =
createTaxComponent(10.0f);
PostTaxesGroupResponse taxGroup =
createTaxGroup(taxComponent.getResourceId());
PostChargesResponse chargeResponse = createFlatLoanCharge(100.0,
taxGroup.getResourceId());
Long chargeDefinitionId = chargeResponse.getResourceId();
- // Given – two separate loans
- Long clientId =
ClientHelper.createClient(ClientHelper.defaultClientCreationRequest()).getClientId();
- Long loanProductId =
loanProductHelper.createLoanProduct(createOnePeriod30DaysLongNoInterestPeriodicAccrualProduct())
- .getResourceId();
+ Long clientId = createClient();
+ Long loanProductId =
createLoanProduct(createOnePeriod30DaysLongNoInterestPeriodicAccrualProduct());
Long loanId1 = applyAndApproveLoan(clientId, loanProductId,
LOAN_DATE, 1000.0);
disburseLoan(loanId1, BigDecimal.valueOf(1000.0), LOAN_DATE);
Long loanId2 = applyAndApproveLoan(clientId, loanProductId,
LOAN_DATE, 1000.0);
disburseLoan(loanId2, BigDecimal.valueOf(1000.0), LOAN_DATE);
- // When – the same charge is added to both loans
- PostLoansLoanIdChargesResponse add1 =
loanTransactionHelper.addChargesForLoan(loanId1, new
PostLoansLoanIdChargesRequest()
-
.chargeId(chargeDefinitionId).amount(100.0).dueDate(DUE_DATE).dateFormat(DATE_FORMAT).locale(LOCALE));
- PostLoansLoanIdChargesResponse add2 =
loanTransactionHelper.addChargesForLoan(loanId2, new
PostLoansLoanIdChargesRequest()
-
.chargeId(chargeDefinitionId).amount(100.0).dueDate(DUE_DATE).dateFormat(DATE_FORMAT).locale(LOCALE));
+ PostLoansLoanIdChargesResponse add1 = addChargesForLoan(loanId1,
new PostLoansLoanIdChargesRequest()
+
.chargeId(chargeDefinitionId).amount(100.0).dueDate(DUE_DATE).dateFormat(DATE_FORMAT).locale(LoanTestData.LOCALE));
+ PostLoansLoanIdChargesResponse add2 = addChargesForLoan(loanId2,
new PostLoansLoanIdChargesRequest()
+
.chargeId(chargeDefinitionId).amount(100.0).dueDate(DUE_DATE).dateFormat(DATE_FORMAT).locale(LoanTestData.LOCALE));
- // Then – both loan charges must independently show the original
base amount (tax stored separately)
- GetLoansLoanIdChargesChargeIdResponse charge1 =
loanTransactionHelper.getLoanCharge(loanId1, add1.getResourceId());
- GetLoansLoanIdChargesChargeIdResponse charge2 =
loanTransactionHelper.getLoanCharge(loanId2, add2.getResourceId());
+ GetLoansLoanIdChargesChargeIdResponse charge1 =
getLoanCharge(loanId1, add1.getResourceId());
+ GetLoansLoanIdChargesChargeIdResponse charge2 =
getLoanCharge(loanId2, add2.getResourceId());
assertEquals(100.0, charge1.getAmount(), 0.01, "Loan 1 charge
amount must remain 100; tax stored separately");
assertEquals(100.0, charge2.getAmount(), 0.01, "Loan 2 charge
amount must remain 100; tax stored separately");
});
}
// -----------------------------------------------------------------------
- // 10. Cash-based accounting: fee with tax splits income vs. tax liability
+ // 9. Full charge list on a loan reflects tax-inflated amounts
// -----------------------------------------------------------------------
- /**
Review Comment:
The file now diffs as a pure migration - zero comment lines added or removed
against develop, original section ordering included. I swept the other migrated
files too; what's left are labels whose statement no longer exists, e.g. in
BatchApiTest // Create a createClient Request sat over a single
BatchHelper.createClientRequest(...) call that's now a request-id constant plus
a BatchRequestBuilders entry.
--
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]