FINERACT-1724: Enhance LoanCatchUpIntegrationTest

This commit is contained in:
Adam Saghy
2023-05-10 07:50:22 +02:00
committed by Arnold Gálovics
parent d15fc994e3
commit b86a70397f
2 changed files with 9 additions and 9 deletions
@@ -114,19 +114,19 @@ public class LoanCatchUpIntegrationTest {
BusinessDateHelper.updateBusinessDate(requestSpec, responseSpec, BusinessDateType.COB_DATE, LocalDate.of(2020, 3, 2));
loanAccountLockHelper.placeSoftLockOnLoanAccount(loanID, "LOAN_INLINE_COB_PROCESSING", "Sample error");
BusinessDateHelper.updateBusinessDate(requestSpec, responseSpec, BusinessDateType.BUSINESS_DATE, LocalDate.of(2020, 3, 10));
BusinessDateHelper.updateBusinessDate(requestSpec, responseSpec, BusinessDateType.BUSINESS_DATE, LocalDate.of(2020, 3, 5));
loanTransactionHelper = new LoanTransactionHelper(requestSpec, responseSpec);
loanCOBCatchUpHelper.executeLoanCOBCatchUp();
Utils.conditionalSleepWithMaxWait(30, 1000, () -> loanCOBCatchUpHelper.isLoanCOBCatchUpRunning());
Utils.conditionalSleepWithMaxWait(30, 5, () -> loanCOBCatchUpHelper.isLoanCOBCatchUpRunning());
GetLoansLoanIdResponse loan = loanTransactionHelper.getLoan(requestSpec, responseSpec, loanID);
Assertions.assertEquals(LocalDate.of(2020, 3, 9), loan.getLastClosedBusinessDate());
Assertions.assertEquals(LocalDate.of(2020, 3, 4), loan.getLastClosedBusinessDate());
requestSpec = UserHelper.getSimpleUserWithoutBypassPermission(requestSpec, responseSpec);
final BatchRequest br1 = BatchHelper.repayLoanRequestWithGivenLoanId(4730L, loanID, "10", LocalDate.of(2020, 3, 10));
final BatchRequest br1 = BatchHelper.repayLoanRequestWithGivenLoanId(4730L, loanID, "10", LocalDate.of(2020, 3, 5));
final List<BatchRequest> batchRequests = new ArrayList<>();
@@ -139,7 +139,7 @@ public class LoanCatchUpIntegrationTest {
Assertions.assertEquals(HttpStatus.SC_OK, (long) response.get(0).getStatusCode(), "Verify Status Code 200 for Repayment");
loan = loanTransactionHelper.getLoan(requestSpec, responseSpec, loanID);
Assertions.assertEquals(LocalDate.of(2020, 3, 9), loan.getLastClosedBusinessDate());
Assertions.assertEquals(LocalDate.of(2020, 3, 4), loan.getLastClosedBusinessDate());
} finally {
requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
requestSpec.header("Authorization", "Basic " + Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
@@ -150,14 +150,14 @@ public final class Utils {
*
* @param maxRun
* max number of times to run the condition
* @param waitInMs
* wait time between evaluation in milliseconds
* @param seconds
* wait time between evaluation in seconds
* @param waitCondition
* condition to evaluate
*/
public static void conditionalSleepWithMaxWait(int maxRun, int waitInMs, Supplier<Boolean> waitCondition) {
public static void conditionalSleepWithMaxWait(int maxRun, int seconds, Supplier<Boolean> waitCondition) {
do {
sleep(waitInMs);
sleep(seconds);
maxRun--;
} while (maxRun > 0 && waitCondition.get());
}