Skip to content

Commit 01ca515

Browse files
MarianaDmytrivBinariksadamsaghy
authored andcommitted
FINERACT-2354: e2e test scenarios for re-aging preview
1 parent 3efafa7 commit 01ca515

File tree

9 files changed

+1487
-138
lines changed

9 files changed

+1487
-138
lines changed

fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/LoanReAgingStepDef.java

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -333,8 +333,7 @@ public void createReAgingPreview(DataTable table) throws IOException {
333333
loanId, frequencyNumber, frequencyType, startDate, numberOfInstallments);
334334
}
335335

336-
@When("Admin creates a Loan re-aging preview by Loan external ID with the following data:")
337-
public void createReAgingPreviewByLoanExternalId(DataTable table) throws IOException {
336+
public Response<LoanScheduleData> reAgingPreviewByLoanExternalId(DataTable table) throws IOException {
338337
Response<PostLoansResponse> loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE);
339338
String loanExternalId = loanResponse.body().getResourceExternalId();
340339

@@ -347,12 +346,39 @@ public void createReAgingPreviewByLoanExternalId(DataTable table) throws IOExcep
347346
Response<LoanScheduleData> response = loanTransactionsApi
348347
.previewReAgeSchedule1(loanExternalId, frequencyNumber, frequencyType, startDate, numberOfInstallments, DATE_FORMAT, "en")
349348
.execute();
349+
log.info(
350+
"Re-aging preview is requested to be created with loan external ID: {} with parameters: frequencyNumber={}, frequencyType={}, startDate={}, numberOfInstallments={}",
351+
loanExternalId, frequencyNumber, frequencyType, startDate, numberOfInstallments);
352+
return response;
353+
}
354+
355+
@When("Admin creates a Loan re-aging preview by Loan external ID with the following data:")
356+
public void createReAgingPreviewByLoanExternalId(DataTable table) throws IOException {
357+
Response<LoanScheduleData> response = reAgingPreviewByLoanExternalId(table);
350358
ErrorHelper.checkSuccessfulApiCall(response);
351359
testContext().set(TestContextKey.LOAN_REAGING_PREVIEW_RESPONSE, response);
352360

353-
log.info(
354-
"Re-aging preview created for loan external ID: {} with parameters: frequencyNumber={}, frequencyType={}, startDate={}, numberOfInstallments={}",
355-
loanExternalId, frequencyNumber, frequencyType, startDate, numberOfInstallments);
361+
log.info("Re-aging preview is created with loan externalId.");
362+
}
363+
364+
@Then("Admin fails to create a Loan re-aging preview with the following data because loan was charged-off:")
365+
public void reAgePreviewChargedOffLoanFailure(final DataTable table) throws IOException {
366+
Response<LoanScheduleData> response = reAgingPreviewByLoanExternalId(table);
367+
final ErrorResponse errorDetails = ErrorResponse.from(response);
368+
final String developerMessage = errorDetails.getSingleError().getDeveloperMessage();
369+
370+
assertThat(errorDetails.getHttpStatusCode()).as(ErrorMessageHelper.dateFailureErrorCodeMsg()).isEqualTo(403);
371+
assertThat(developerMessage).matches(ErrorMessageHelper.reAgeChargedOffLoanFailure());
372+
}
373+
374+
@Then("Admin fails to create a Loan re-aging preview with the following data because loan was contract terminated:")
375+
public void reAgePreviewContractTerminatedLoanFailure(final DataTable table) throws IOException {
376+
Response<LoanScheduleData> response = reAgingPreviewByLoanExternalId(table);
377+
final ErrorResponse errorDetails = ErrorResponse.from(response);
378+
final String developerMessage = errorDetails.getSingleError().getDeveloperMessage();
379+
380+
assertThat(errorDetails.getHttpStatusCode()).as(ErrorMessageHelper.dateFailureErrorCodeMsg()).isEqualTo(403);
381+
assertThat(developerMessage).matches(ErrorMessageHelper.reAgeContractTerminatedLoanFailure());
356382
}
357383

358384
@Then("Loan Repayment schedule preview has {int} periods, with the following data for periods:")

fineract-e2e-tests-runner/src/test/resources/features/Loan.feature

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7818,8 +7818,8 @@ Feature: Loan
78187818
| 01 January 2025 | 01 January 2025 | 700.0 | |
78197819
| 01 January 2025 | 01 January 2025 | 200.0 | |
78207820

7821-
When Loan Pay-off is made on "1 January 2025"
7822-
Then Loan's all installments have obligations met
7821+
When Loan Pay-off is made on "01 January 2025"
7822+
Then Loan is closed with zero outstanding balance and it's all installments have obligations met
78237823

78247824
@TestRailId:C4029
78257825
Scenario: Verify tranche interest bearing progressive loan that expects two tranches at the same date with over expected disb amount in expected order - UC2
@@ -7892,7 +7892,7 @@ Feature: Loan
78927892
| 01 January 2025 | 01 January 2025 | 250.0 | |
78937893

78947894
When Loan Pay-off is made on "1 January 2025"
7895-
Then Loan's all installments have obligations met
7895+
Then Loan is closed with zero outstanding balance and it's all installments have obligations met
78967896

78977897
@TestRailId:C4030
78987898
Scenario: Verify tranche interest bearing progressive loan that expects two tranches at the same date with over expected disb amount in not expected order - UC3
@@ -7966,6 +7966,9 @@ Feature: Loan
79667966
| 01 January 2025 | 01 January 2025 | 300.0 | |
79677967
| 01 January 2025 | 01 January 2025 | 600.0 | |
79687968

7969+
When Loan Pay-off is made on "01 January 2025"
7970+
Then Loan is closed with zero outstanding balance and it's all installments have obligations met
7971+
79697972
@TestRailId:C4031
79707973
Scenario: Verify tranche interest bearing progressive loan that expects two tranches at the same date with diff expected disb amounts in diff order - UC4
79717974
When Admin sets the business date to "01 January 2025"
@@ -8038,7 +8041,7 @@ Feature: Loan
80388041
| 01 January 2025 | 01 January 2025 | 300.0 | |
80398042

80408043
When Loan Pay-off is made on "1 January 2025"
8041-
Then Loan's all installments have obligations met
8044+
Then Loan is closed with zero outstanding balance and it's all installments have obligations met
80428045

80438046
@TestRailId:C4032
80448047
Scenario: Verify tranche interest bearing progressive loan that expects two tranches at the same date in defined order with over expected 2nd disb amount - UC5
@@ -8111,7 +8114,7 @@ Feature: Loan
81118114
| 01 January 2025 | 01 January 2025 | 800.0 | |
81128115

81138116
When Loan Pay-off is made on "1 January 2025"
8114-
Then Loan's all installments have obligations met
8117+
Then Loan is closed with zero outstanding balance and it's all installments have obligations met
81158118

81168119
@TestRailId:C4033
81178120
Scenario: Verify tranche interest bearing progressive loan that expects tranche with added 2nd tranche at the same date and undo disbursement - UC6
@@ -8246,7 +8249,7 @@ Feature: Loan
82468249
Then Admin fails to disburse the loan on "01 February 2025" with "50" amount
82478250

82488251
When Loan Pay-off is made on "1 February 2025"
8249-
Then Loan's all installments have obligations met
8252+
Then Loan is closed with zero outstanding balance and it's all installments have obligations met
82508253

82518254
@TestRailId:C4034
82528255
Scenario: Verify tranche interest bearing progressive loan that expects tranches at the same date with repayment and undo last disbursement - UC7
@@ -8357,7 +8360,7 @@ Feature: Loan
83578360
Then Admin fails to disburse the loan on "01 January 2025" with "200" amount
83588361

83598362
When Loan Pay-off is made on "1 January 2025"
8360-
Then Loan's all installments have obligations met
8363+
Then Loan is closed with zero outstanding balance and it's all installments have obligations met
83618364

83628365
@TestRailId:C4035
83638366
Scenario: Verify tranche interest bearing progressive loan that expects tranche with added 2 tranches at the same date - UC8
@@ -8485,7 +8488,7 @@ Feature: Loan
84858488
Then Admin fails to disburse the loan on "01 February 2025" with "50" amount
84868489

84878490
When Loan Pay-off is made on "1 February 2025"
8488-
Then Loan's all installments have obligations met
8491+
Then Loan is closed with zero outstanding balance and it's all installments have obligations met
84898492

84908493
@TestRailId:C4118
84918494
Scenario: Verify cumulative multidisb loan with 2nd disb at 1st installment with flat interest type and same_as_repeyment interest calculation period - UC1

0 commit comments

Comments
 (0)