FINERACT-2421: Add pastDueDate to loan summary and event - E2E test
This commit is contained in:
committed by
Adam Saghy
parent
41d859e68a
commit
0904c4f530
+23
@@ -19,6 +19,7 @@
|
||||
package org.apache.fineract.test.stepdef.loan;
|
||||
|
||||
import static org.apache.fineract.client.feign.util.FeignCalls.ok;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import io.cucumber.java.en.Then;
|
||||
import io.cucumber.java.en.When;
|
||||
@@ -30,10 +31,12 @@ import org.apache.fineract.client.models.InlineJobRequest;
|
||||
import org.apache.fineract.client.models.PostLoansResponse;
|
||||
import org.apache.fineract.test.messaging.EventAssertion;
|
||||
import org.apache.fineract.test.messaging.event.assetexternalization.LoanAccountCustomSnapshotEvent;
|
||||
import org.apache.fineract.test.messaging.event.loan.LoanBalanceChangedEvent;
|
||||
import org.apache.fineract.test.messaging.event.loan.repayment.LoanRepaymentDueEvent;
|
||||
import org.apache.fineract.test.messaging.event.loan.repayment.LoanRepaymentOverdueEvent;
|
||||
import org.apache.fineract.test.stepdef.AbstractStepDef;
|
||||
import org.apache.fineract.test.support.TestContextKey;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
public class InlineCOBStepDef extends AbstractStepDef {
|
||||
@@ -49,6 +52,7 @@ public class InlineCOBStepDef extends AbstractStepDef {
|
||||
@When("Admin runs inline COB job for Loan")
|
||||
public void runInlineCOB() throws IOException {
|
||||
PostLoansResponse loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE);
|
||||
Assertions.assertNotNull(loanResponse);
|
||||
long loanId = loanResponse.getLoanId();
|
||||
|
||||
InlineJobRequest inlineJobRequest = new InlineJobRequest().addLoanIdsItem(loanId);
|
||||
@@ -59,6 +63,7 @@ public class InlineCOBStepDef extends AbstractStepDef {
|
||||
@Then("Loan Repayment Due Business Event is created")
|
||||
public void checkLoanRepaymentDueBusinessEventCreated() {
|
||||
PostLoansResponse loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE);
|
||||
Assertions.assertNotNull(loanResponse);
|
||||
long loanId = loanResponse.getLoanId();
|
||||
|
||||
eventAssertion.assertEventRaised(LoanRepaymentDueEvent.class, loanId);
|
||||
@@ -67,6 +72,7 @@ public class InlineCOBStepDef extends AbstractStepDef {
|
||||
@Then("Loan Repayment Overdue Business Event is created")
|
||||
public void checkLoanRepaymentOverdueBusinessEventCreated() {
|
||||
PostLoansResponse loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE);
|
||||
Assertions.assertNotNull(loanResponse);
|
||||
long loanId = loanResponse.getLoanId();
|
||||
|
||||
eventAssertion.assertEventRaised(LoanRepaymentOverdueEvent.class, loanId);
|
||||
@@ -75,9 +81,26 @@ public class InlineCOBStepDef extends AbstractStepDef {
|
||||
@Then("LoanAccountCustomSnapshotBusinessEvent is created with business date {string}")
|
||||
public void checkLoanRepaymentDueBusinessEventCreatedWithBusinessDate(String expectedBusinessDate) {
|
||||
PostLoansResponse loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE);
|
||||
Assertions.assertNotNull(loanResponse);
|
||||
long loanId = loanResponse.getLoanId();
|
||||
|
||||
LocalDate expectedBusinessDateParsed = LocalDate.parse(expectedBusinessDate, FORMATTER);
|
||||
eventAssertion.assertEvent(LoanAccountCustomSnapshotEvent.class, loanId).isRaisedOnBusinessDate(expectedBusinessDateParsed);
|
||||
}
|
||||
|
||||
@Then("LoanBalanceChangedBusinessEvent has pastDueDate {string}")
|
||||
public void checkLoanBalanceChangedBusinessEventHasPastDueDate(final String expectedPastDueDate) {
|
||||
final PostLoansResponse loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE);
|
||||
Assertions.assertNotNull(loanResponse);
|
||||
final long loanId = loanResponse.getLoanId();
|
||||
|
||||
final String expectedPastDueDateValue = "null".equals(expectedPastDueDate) ? null : expectedPastDueDate;
|
||||
|
||||
eventAssertion.assertEvent(LoanBalanceChangedEvent.class, loanId).extractingData(loanAccountDataV1 -> {
|
||||
final String actualPastDueDate = loanAccountDataV1.getDelinquent() == null ? null
|
||||
: loanAccountDataV1.getDelinquent().getPastDueDate();
|
||||
assertThat(actualPastDueDate).as("pastDueDate in LoanBalanceChangedBusinessEvent").isEqualTo(expectedPastDueDateValue);
|
||||
return null;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
+1
@@ -1622,6 +1622,7 @@ public class LoanStepDef extends AbstractStepDef {
|
||||
.isEqualTo(statusExpected);//
|
||||
eventCheckHelper.disburseLoanEventCheck(loanId);
|
||||
eventCheckHelper.loanDisbursalTransactionEventCheck(loanDisburseResponse);
|
||||
eventCheckHelper.loanBalanceChangedEventCheck(loanId);
|
||||
}
|
||||
|
||||
@And("Admin successfully add disbursement detail to the loan on {string} with {double} EUR transaction amount")
|
||||
|
||||
Reference in New Issue
Block a user