FINERACT-2322: added e2e test with next payment data check
This commit is contained in:
committed by
Adam Saghy
parent
28043ce438
commit
9c37ef437d
+27
@@ -549,6 +549,33 @@ public class LoanDelinquencyStepDef extends AbstractStepDef {
|
||||
.isEqualTo(expectedValuesList);
|
||||
}
|
||||
|
||||
@Then("Loan has the following LOAN level next payment due data:")
|
||||
public void loanNextPaymentDataCheck(DataTable table) throws IOException {
|
||||
Response<PostLoansResponse> loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE);
|
||||
long loanId = loanResponse.body().getLoanId();
|
||||
|
||||
List<String> expectedValuesList = table.asLists().get(1);
|
||||
DelinquencyRange expectedDelinquencyRange = DelinquencyRange.valueOf(expectedValuesList.get(0));
|
||||
String expectedDelinquencyRangeValue = expectedDelinquencyRange.getValue();
|
||||
expectedValuesList.set(0, expectedDelinquencyRangeValue);
|
||||
|
||||
Response<GetLoansLoanIdResponse> loanDetails = loansApi.retrieveLoan(loanId, false, "", "", "").execute();
|
||||
ErrorHelper.checkSuccessfulApiCall(loanDetails);
|
||||
|
||||
String actualDelinquencyRangeValue = loanDetails.body().getDelinquencyRange() == null ? "NO_DELINQUENCY"
|
||||
: loanDetails.body().getDelinquencyRange().getClassification();
|
||||
GetLoansLoanIdDelinquencySummary delinquent = loanDetails.body().getDelinquent();
|
||||
|
||||
String delinquentAmount = delinquent.getNextPaymentAmount() == null ? null
|
||||
: new Utils.DoubleFormatter(delinquent.getNextPaymentAmount().doubleValue()).format();
|
||||
List<String> actualValuesList = List.of(actualDelinquencyRangeValue,
|
||||
delinquent.getNextPaymentDueDate() == null ? "null" : FORMATTER.format(delinquent.getNextPaymentDueDate()),
|
||||
delinquentAmount);
|
||||
|
||||
assertThat(actualValuesList).as(ErrorMessageHelper.wrongValueInLoanLevelDelinquencyData(actualValuesList, expectedValuesList))
|
||||
.isEqualTo(expectedValuesList);
|
||||
}
|
||||
|
||||
@Then("Loan has the following INSTALLMENT level delinquency data:")
|
||||
public void loanDelinquencyInstallmentLevelDataCheck(DataTable table) throws IOException {
|
||||
Response<PostLoansResponse> loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE);
|
||||
|
||||
Reference in New Issue
Block a user