diff --git a/.github/workflows/build-mysql.yml b/.github/workflows/build-mysql.yml index 20db6655b..599844ea2 100644 --- a/.github/workflows/build-mysql.yml +++ b/.github/workflows/build-mysql.yml @@ -68,7 +68,7 @@ jobs: run: | ./gradlew --no-daemon --console=plain build -x cucumber -x test -x doc ./gradlew --no-daemon --console=plain cucumber -x :fineract-e2e-tests-runner:cucumber - ./gradlew --no-daemon --console=plain test -x :twofactor-tests:test -x :oauth2-test:test :fineract-e2e-tests-runner:test -PdbType=mysql + ./gradlew --no-daemon --console=plain test -x :twofactor-tests:test -x :oauth2-test:test -x :fineract-e2e-tests-runner:test -PdbType=mysql ./gradlew --no-daemon --console=plain :twofactor-tests:test -PdbType=mysql ./gradlew --no-daemon --console=plain :oauth2-tests:test -PdbType=mysql - name: Archive test results diff --git a/.github/workflows/build-postgresql.yml b/.github/workflows/build-postgresql.yml index ea75f4f32..ba054a885 100644 --- a/.github/workflows/build-postgresql.yml +++ b/.github/workflows/build-postgresql.yml @@ -69,7 +69,7 @@ jobs: run: | ./gradlew --no-daemon --console=plain build -x cucumber -x test -x doc ./gradlew --no-daemon --console=plain cucumber -x :fineract-e2e-tests-runner:cucumber - ./gradlew --no-daemon --console=plain test -x :twofactor-tests:test -x :oauth2-test:test :fineract-e2e-tests-runner:test -PdbType=postgresql + ./gradlew --no-daemon --console=plain test -x :twofactor-tests:test -x :oauth2-test:test -x :fineract-e2e-tests-runner:test -PdbType=postgresql ./gradlew --no-daemon --console=plain :twofactor-tests:test -PdbType=postgresql ./gradlew --no-daemon --console=plain :oauth2-tests:test -PdbType=postgresql - name: Archive test results diff --git a/build.gradle b/build.gradle index 9ff21e728..5b6371319 100644 --- a/build.gradle +++ b/build.gradle @@ -376,7 +376,7 @@ configure(project.fineractJavaProjects) { cacheDynamicVersionsFor 0, 'seconds' } } - + tasks.withType(JavaCompile).configureEach { options.incremental = true options.fork = true @@ -672,7 +672,7 @@ configure(project.fineractJavaProjects) { 'org.junit.jupiter:junit-jupiter-api', 'org.junit.jupiter:junit-jupiter-engine', 'org.junit.jupiter:junit-jupiter-params', - 'org.junit.platform:junit-platform-runner', // required to be able to run tests directly under Eclipse, see FINERACT-943 & FINERACT-1021 + 'org.junit.platform:junit-platform-suite', // required to be able to run tests directly under Eclipse, see FINERACT-943 & FINERACT-1021 'org.bouncycastle:bcpkix-jdk18on', 'org.bouncycastle:bcprov-jdk18on', 'org.bouncycastle:bcutil-jdk18on', @@ -783,7 +783,7 @@ configure(project.fineractCustomProjects) { 'org.mockito:mockito-junit-jupiter', 'org.junit.jupiter:junit-jupiter-api', 'org.junit.jupiter:junit-jupiter-engine', - 'org.junit.platform:junit-platform-runner', // required to be able to run tests directly under Eclipse, see FINERACT-943 & FINERACT-1021 + 'org.junit.platform:junit-platform-suite', // required to be able to run tests directly under Eclipse, see FINERACT-943 & FINERACT-1021 'org.bouncycastle:bcpkix-jdk18on', 'org.bouncycastle:bcprov-jdk18on', 'org.bouncycastle:bcutil-jdk18on', diff --git a/fineract-e2e-tests-core/build.gradle b/fineract-e2e-tests-core/build.gradle index 559426cc4..29d09e209 100644 --- a/fineract-e2e-tests-core/build.gradle +++ b/fineract-e2e-tests-core/build.gradle @@ -40,17 +40,17 @@ repositories { // Configure test compilation tasks.named('compileTestJava') { description = 'Compiles test Java source files' - + // Enable caching outputs.cacheIf { true } - + // Configure compiler options options.compilerArgs.add("-parameters") - + // Ensure proper output tracking outputs.dir(sourceSets.test.java.destinationDirectory) .withPropertyName("testClassesDir") - + // Track annotation processor outputs options.annotationProcessorGeneratedSourcesDirectory = layout.buildDirectory.dir('generated/sources/annotationProcessor/java/test').get().asFile @@ -69,12 +69,15 @@ dependencies { testImplementation 'com.squareup.retrofit2:retrofit:2.11.0' testImplementation 'org.apache.httpcomponents:httpclient:4.5.14' testImplementation 'org.apache.commons:commons-lang3:3.17.0' - testImplementation 'com.googlecode.json-simple:json-simple:1.1.1' + testImplementation ('com.googlecode.json-simple:json-simple:1.1.1') { + exclude group: 'junit', module: 'junit' + } testImplementation 'com.google.code.gson:gson:2.11.0' testImplementation 'io.cucumber:cucumber-java:7.20.1' testImplementation 'io.cucumber:cucumber-junit:7.20.1' testImplementation 'io.cucumber:cucumber-spring:7.20.1' + testImplementation 'io.cucumber:cucumber-junit-platform-engine:7.20.1' testImplementation 'io.qameta.allure:allure-cucumber7-jvm:2.29.1' diff --git a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/messaging/EventAssertion.java b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/messaging/EventAssertion.java index dd0632962..595abb2da 100644 --- a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/messaging/EventAssertion.java +++ b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/messaging/EventAssertion.java @@ -61,7 +61,7 @@ public class EventAssertion { } T event = eventFactory.create(eventClazz); try { - await().atMost(Duration.ofSeconds(eventProperties.getEventWaitTimeoutInSec())).until(() -> { + await().atMost(Duration.ofMillis(eventProperties.getWaitTimeoutInMillis())).until(() -> { if (removeEventIfFound) { return eventStore.removeEventById(event, id).isPresent(); } else { @@ -69,8 +69,8 @@ public class EventAssertion { } }); } catch (ConditionTimeoutException e) { - Assertions - .fail(event.getEventName() + " hasn't been received within " + eventProperties.getEventWaitTimeoutInSec() + " seconds"); + Assertions.fail( + event.getEventName() + " hasn't been received within " + eventProperties.getWaitTimeoutInMillis() / 1000 + " seconds"); } } @@ -80,7 +80,7 @@ public class EventAssertion { } T event = eventFactory.create(eventClazz); try { - await().atMost(Duration.ofSeconds(eventProperties.getEventWaitTimeoutInSec())).until(() -> { + await().atMost(Duration.ofMillis(eventProperties.getWaitTimeoutInMillis())).until(() -> { if (id == null) { return !eventStore.findByType(event).isEmpty(); } @@ -115,7 +115,7 @@ public class EventAssertion { } T event = eventFactory.create(eventClazz); try { - await().atMost(Duration.ofSeconds(eventProperties.getEventWaitTimeoutInSec())) + await().atMost(Duration.ofMillis(eventProperties.getWaitTimeoutInMillis())) .until(() -> eventStore.findByType(event).stream().anyMatch(filter)); String receivedEventsLogParam = eventStore.getReceivedEvents().stream().map(LoggedEvent::new).map(LoggedEvent::toString) diff --git a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/messaging/config/EventProperties.java b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/messaging/config/EventProperties.java index 8fa4d1c07..dcb5e0ef9 100644 --- a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/messaging/config/EventProperties.java +++ b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/messaging/config/EventProperties.java @@ -26,8 +26,14 @@ import org.springframework.stereotype.Component; @Getter public class EventProperties { - @Value("${fineract-test.event.wait-timeout-in-sec}") - private int eventWaitTimeoutInSec; + @Value("${fineract-test.event.wait-timeout-in-ms}") + private long waitTimeoutInMillis; + + @Value("${fineract-test.event.interval-in-ms}") + private long intervalInMillis; + + @Value("${fineract-test.event.delay-in-ms}") + private long delayInMillis; @Value("${fineract-test.event.verification-enabled}") private boolean eventVerificationEnabled; diff --git a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/messaging/config/JobPollingProperties.java b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/messaging/config/JobPollingProperties.java index 37f9d6d25..7f4cc9396 100644 --- a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/messaging/config/JobPollingProperties.java +++ b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/messaging/config/JobPollingProperties.java @@ -26,13 +26,13 @@ import org.springframework.stereotype.Component; @Getter public class JobPollingProperties { - @Value("${fineract-test.job.interval-in-sec}") - private long pollingIntervalInSec; + @Value("${fineract-test.job.interval-in-ms}") + private long intervalInMillis; - @Value("${fineract-test.job.delay-in-sec}") - private long pollingDelayInSec; + @Value("${fineract-test.job.delay-in-ms}") + private long delayInMillis; - @Value("${fineract-test.job.at-most-in-sec}") - private long pollingAtMostInSec; + @Value("${fineract-test.job.wait-timeout-in-ms}") + private long timeoutInMillis; } diff --git a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/service/JobService.java b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/service/JobService.java index 04c2fbd45..e8e26533c 100644 --- a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/service/JobService.java +++ b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/service/JobService.java @@ -66,10 +66,10 @@ public class JobService { private void waitUntilJobIsFinished(Job job) { String jobName = job.getName(); - await().atMost(Duration.ofSeconds(jobPollingProperties.getPollingAtMostInSec())) // + await().atMost(Duration.ofMillis(jobPollingProperties.getTimeoutInMillis())) // .alias("%s didn't finish on time".formatted(jobName)) // - .pollInterval(Duration.ofSeconds(jobPollingProperties.getPollingIntervalInSec())) // - .pollDelay(Duration.ofSeconds(jobPollingProperties.getPollingDelayInSec())) // + .pollInterval(Duration.ofMillis(jobPollingProperties.getIntervalInMillis())) // + .pollDelay(Duration.ofMillis(jobPollingProperties.getDelayInMillis())) // .until(() -> { log.info("Waiting for job {} to finish", jobName); Long jobId = jobResolver.resolve(job); diff --git a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/LoanStepDef.java b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/LoanStepDef.java index 5e36b786c..523bb042c 100644 --- a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/LoanStepDef.java +++ b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/LoanStepDef.java @@ -26,8 +26,8 @@ import static org.apache.fineract.test.data.loanproduct.DefaultLoanProduct.LP2_A import static org.apache.fineract.test.factory.LoanProductsRequestFactory.CHARGE_OFF_REASONS; import static org.assertj.core.api.Assertions.assertThat; import static org.awaitility.Awaitility.await; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertTrue; import com.google.gson.Gson; @@ -2453,8 +2453,10 @@ public class LoanStepDef extends AbstractStepDef { long loanId = loanResponse.body().getLoanId(); LoanStatusEnumDataV1 expectedStatus = getExpectedStatus(loanStatus); - await().pollDelay(Duration.ofSeconds(1L)).pollInterval(Duration.ofSeconds(1L)) - .atMost(Duration.ofSeconds(eventProperties.getEventWaitTimeoutInSec())).untilAsserted(() -> { + await().atMost(Duration.ofMillis(eventProperties.getWaitTimeoutInMillis()))// + .pollDelay(Duration.ofMillis(eventProperties.getDelayInMillis())) // + .pollInterval(Duration.ofMillis(eventProperties.getIntervalInMillis()))// + .untilAsserted(() -> { eventAssertion.assertEvent(LoanStatusChangedEvent.class, loanId).extractingData(LoanAccountDataV1::getStatus) .isEqualTo(expectedStatus); }); @@ -2479,7 +2481,7 @@ public class LoanStepDef extends AbstractStepDef { public void getLoanLastCOBDate(String date) throws IOException { Response loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); long loanId = loanResponse.body().getLoanId(); - + log.debug("Loan ID: {}", loanId); Response loanDetails = loansApi.retrieveLoan(loanId, false, "", "", "").execute(); ErrorHelper.checkSuccessfulApiCall(loanDetails); if ("null".equals(date)) { @@ -2497,9 +2499,16 @@ public class LoanStepDef extends AbstractStepDef { @When("Admin checks that Loan COB is running until the current business date") public void checkLoanCOBCatchUpRunningUntilCOBBusinessDate() { - await().atMost(Duration.ofSeconds(jobPollingProperties.getPollingAtMostInSec())) // - .pollInterval(Duration.ofSeconds(jobPollingProperties.getPollingIntervalInSec())) // - .pollDelay(Duration.ofSeconds(jobPollingProperties.getPollingDelayInSec())) // + await().atMost(Duration.ofMillis(jobPollingProperties.getTimeoutInMillis())) // + .pollInterval(Duration.ofMillis(jobPollingProperties.getIntervalInMillis())) // + .until(() -> { + Response isCatchUpRunningResponse = loanCobCatchUpApi.isCatchUpRunning().execute(); + ErrorHelper.checkSuccessfulApiCall(isCatchUpRunningResponse); + IsCatchUpRunningDTO isCatchUpRunning = isCatchUpRunningResponse.body(); + return isCatchUpRunning.getCatchUpRunning(); + }); + await().atMost(Duration.ofMillis(jobPollingProperties.getTimeoutInMillis())) // + .pollInterval(Duration.ofMillis(jobPollingProperties.getIntervalInMillis())) // .until(() -> { Response isCatchUpRunningResponse = loanCobCatchUpApi.isCatchUpRunning().execute(); ErrorHelper.checkSuccessfulApiCall(isCatchUpRunningResponse); @@ -2676,8 +2685,8 @@ public class LoanStepDef extends AbstractStepDef { Response originalTransaction = loanTransactionsApi .retrieveTransaction(loanId, originalTransactionId, "").execute(); - assertNull(String.format("Original transaction external id is not null %n%s", originalTransaction.body()), - originalTransaction.body().getExternalId()); + assertNull(originalTransaction.body().getExternalId(), + String.format("Original transaction external id is not null %n%s", originalTransaction.body())); } @Then("LoanTransactionAccrualActivityPostBusinessEvent is raised on {string}") diff --git a/fineract-e2e-tests-core/src/test/resources/fineract-test-application.properties b/fineract-e2e-tests-core/src/test/resources/fineract-test-application.properties index d2385b3f7..65727e143 100644 --- a/fineract-e2e-tests-core/src/test/resources/fineract-test-application.properties +++ b/fineract-e2e-tests-core/src/test/resources/fineract-test-application.properties @@ -36,10 +36,13 @@ fineract-test.messaging.jms.broker-username=${ACTIVEMQ_BROKER_USERNAME:} fineract-test.messaging.jms.broker-password=${ACTIVEMQ_BROKER_PASSWORD:} fineract-test.messaging.jms.topic-name=${ACTIVEMQ_TOPIC_NAME:} -fineract-test.event.wait-timeout-in-sec=${EVENT_WAIT_TIMEOUT_IN_SEC:5} fineract-test.event.verification-enabled=${EVENT_VERIFICATION_ENABLED:false} +fineract-test.event.wait-timeout-in-ms=${POLLING_EVENT_WAIT_TIMEOUT_IN_MS:5000} +fineract-test.event.delay-in-ms=${POLLING_EVENT_WAIT_TIMEOUT_IN_MS:100} +fineract-test.event.interval-in-ms=${POLLING_EVENT_WAIT_TIMEOUT_IN_MS:100} + +fineract-test.job.interval-in-ms=${POLLING_JOB_INTERVAL_IN_MS:100} +fineract-test.job.delay-in-ms=${POLLING_JOB_DELAY_IN_MS:3000} +fineract-test.job.wait-timeout-in-ms=${POLLING_JOB_WAIT_TIMEOUT_IN_MS:120000} fineract-test.client-read-timeout=${CLIENT_READ_TIMEOUT:60} -fineract-test.job.interval-in-sec=${POLLING_INTERVAL_IN_SEC:1} -fineract-test.job.delay-in-sec=${POLLING_DELAY_IN_SEC:3} -fineract-test.job.at-most-in-sec=${POLLING_AT_MOST_IN_SEC:120} diff --git a/fineract-e2e-tests-runner/build.gradle b/fineract-e2e-tests-runner/build.gradle index 4df87bf9f..9f233ccf7 100644 --- a/fineract-e2e-tests-runner/build.gradle +++ b/fineract-e2e-tests-runner/build.gradle @@ -41,18 +41,21 @@ dependencies { testImplementation 'com.squareup.retrofit2:retrofit:2.11.0' testImplementation 'org.apache.httpcomponents:httpclient:4.5.14' testImplementation 'org.apache.commons:commons-lang3:3.17.0' - testImplementation 'com.googlecode.json-simple:json-simple:1.1.1' + testImplementation ('com.googlecode.json-simple:json-simple:1.1.1') { + exclude group: 'junit', module: 'junit' + } testImplementation 'com.google.code.gson:gson:2.11.0' + testImplementation 'org.junit.platform:junit-platform-suite:1.11.4' + testImplementation 'org.junit.platform:junit-platform-console:1.11.4' testImplementation 'io.cucumber:cucumber-java:7.20.1' testImplementation 'io.cucumber:cucumber-junit:7.20.1' testImplementation 'io.cucumber:cucumber-spring:7.20.1' + testImplementation 'io.cucumber:cucumber-junit-platform-engine:7.20.1' testImplementation 'io.qameta.allure:allure-cucumber7-jvm:2.29.1' testImplementation 'org.assertj:assertj-core:3.26.3' - testImplementation 'org.junit.jupiter:junit-jupiter-api:5.11.3' - testImplementation 'org.junit.jupiter:junit-jupiter:5.11.3' testCompileOnly 'org.projectlombok:lombok:1.18.36' testAnnotationProcessor 'org.projectlombok:lombok:1.18.36' @@ -70,6 +73,7 @@ dependencies { tasks.named('test') { useJUnitPlatform() + systemProperty("cucumber.junit-platform.naming-strategy", "long") } tasks.named('cucumber').get().finalizedBy 'allureReport' @@ -89,3 +93,7 @@ cucumber { allure { version = '2.17.3' } + +test { + useJUnitPlatform() +} diff --git a/fineract-e2e-tests-runner/src/test/java/org/apache/fineract/test/TestRunner.java b/fineract-e2e-tests-runner/src/test/java/org/apache/fineract/test/TestRunner.java index c07c0349d..282273168 100644 --- a/fineract-e2e-tests-runner/src/test/java/org/apache/fineract/test/TestRunner.java +++ b/fineract-e2e-tests-runner/src/test/java/org/apache/fineract/test/TestRunner.java @@ -18,12 +18,21 @@ */ package org.apache.fineract.test; -import io.cucumber.junit.Cucumber; -import io.cucumber.junit.CucumberOptions; -import org.junit.runner.RunWith; +import static io.cucumber.junit.platform.engine.Constants.GLUE_PROPERTY_NAME; +import static io.cucumber.junit.platform.engine.Constants.PLUGIN_PROPERTY_NAME; -@RunWith(Cucumber.class) -@CucumberOptions(features = "src/test/resources/features", glue = { "org.apache.fineract.test.stepdef", - "org.apache.fineract.test.stepdef.common", "org.apache.fineract.test.stepdef.hook", "org.apache.fineract.test.stepdef.loan", - "org.apache.fineract.test.stepdef.saving", "org.apache.fineract.test.config" }) +import org.junit.platform.suite.api.ConfigurationParameter; +import org.junit.platform.suite.api.ExcludeTags; +import org.junit.platform.suite.api.IncludeEngines; +import org.junit.platform.suite.api.SelectDirectories; +import org.junit.platform.suite.api.SelectPackages; +import org.junit.platform.suite.api.Suite; + +@Suite +@IncludeEngines("cucumber") +@SelectPackages("org.apache.fineract.test") +@SelectDirectories("src/test/resources/features") +@ExcludeTags("Skip") +@ConfigurationParameter(key = PLUGIN_PROPERTY_NAME, value = "pretty") +@ConfigurationParameter(key = GLUE_PROPERTY_NAME, value = "org.apache.fineract.test.stepdef, org.apache.fineract.test.stepdef.common, org.apache.fineract.test.stepdef.hook, org.apache.fineract.test.stepdef.loan, org.apache.fineract.test.stepdef.saving, org.apache.fineract.test.config") public class TestRunner {} diff --git a/fineract-e2e-tests-runner/src/test/resources/features/LoanChargeOff.feature b/fineract-e2e-tests-runner/src/test/resources/features/LoanChargeOff.feature index 22d3580d7..a5c67fe39 100644 --- a/fineract-e2e-tests-runner/src/test/resources/features/LoanChargeOff.feature +++ b/fineract-e2e-tests-runner/src/test/resources/features/LoanChargeOff.feature @@ -1836,11 +1836,7 @@ Feature: Charge-off | 02 June 2024 | Accrual | 0.07 | 0.0 | 0.07 | 0.0 | 0.0 | 0.0 | false | false | And Admin does charge-off the loan on "03 June 2024" When Admin sets the business date to "05 June 2024" - And Admin runs the Accrual Activity Posting job - And Admin runs the Add Accrual Transactions job - And Admin runs the Add Accrual Transactions For Loans With Income Posted As Transactions job - And Admin runs the Add Periodic Accrual Transactions job - And Admin runs the Recalculate Interest for Loans job + And Admin runs inline COB job for Loan Then Loan Repayment schedule has 4 periods, with the following data for periods: | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | | | | 01 June 2024 | | 250.0 | | | 0.0 | | 0.0 | 0.0 | | | | @@ -1915,13 +1911,9 @@ Feature: Charge-off | 02 June 2024 | Accrual | 0.07 | 0.0 | 0.07 | 0.0 | 0.0 | 0.0 | false | false | | 03 June 2024 | Accrual | 0.07 | 0.0 | 0.07 | 0.0 | 0.0 | 0.0 | false | false | | 03 June 2024 | Charge-off | 255.23 | 250.0 | 5.23 | 0.0 | 0.0 | 0.0 | false | false | - When Admin sets the business date to "06 June 2024" + When Admin sets the business date to "07 June 2024" Then Admin does a charge-off undo the loan - And Admin runs the Accrual Activity Posting job - And Admin runs the Add Accrual Transactions job - And Admin runs the Add Accrual Transactions For Loans With Income Posted As Transactions job - And Admin runs the Add Periodic Accrual Transactions job - And Admin runs the Recalculate Interest for Loans job + And Admin runs inline COB job for Loan Then Loan Repayment schedule has 4 periods, with the following data for periods: | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | | | | 01 June 2024 | | 250.0 | | | 0.0 | | 0.0 | 0.0 | | | | @@ -1938,7 +1930,8 @@ Feature: Charge-off | 02 June 2024 | Accrual | 0.07 | 0.0 | 0.07 | 0.0 | 0.0 | 0.0 | false | false | | 03 June 2024 | Accrual | 0.07 | 0.0 | 0.07 | 0.0 | 0.0 | 0.0 | false | false | | 03 June 2024 | Charge-off | 255.23 | 250.0 | 5.23 | 0.0 | 0.0 | 0.0 | true | false | - | 06 June 2024 | Accrual | 0.21 | 0.0 | 0.21 | 0.0 | 0.0 | 0.0 | false | false | + | 05 June 2024 | Accrual | 0.14 | 0.0 | 0.14 | 0.0 | 0.0 | 0.0 | false | false | + | 06 June 2024 | Accrual | 0.07 | 0.0 | 0.07 | 0.0 | 0.0 | 0.0 | false | false | @TestRailId:C3326 @AdvancedPaymentAllocation Scenario: Verify the repayment schedule is updated before the Charge-off in case of interest recalculation = true @@ -1976,68 +1969,6 @@ Feature: Charge-off @TestRailId:C3337 @AdvancedPaymentAllocation Scenario: Verify charged off loans to be excluded from scheduled jobs - no interest is added for charged-off loans with 0 interest - When Admin sets the business date to "01 June 2024" - When Admin creates a client with random data - When Admin creates a fully customized loan with the following data: - | LoanProduct | submitted on date | with Principal | ANNUAL interest rate % | interest type | interest calculation period | amortization type | loanTermFrequency | loanTermFrequencyType | repaymentEvery | repaymentFrequencyType | numberOfRepayments | graceOnPrincipalPayment | graceOnInterestPayment | interest free period | Payment strategy | - | LP2_ADV_CUSTOM_PAYMENT_ALLOC_INTEREST_RECALCULATION_DAILY_EMI_360_30_MULTIDISBURSE | 01 June 2024 | 1000 | 10 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 4 | MONTHS | 1 | MONTHS | 4 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | - And Admin successfully approves the loan on "01 June 2024" with "1000" amount and expected disbursement date on "01 June 2024" - When Admin successfully disburse the loan on "01 June 2024" with "250" EUR transaction amount - Then Loan Repayment schedule has 4 periods, with the following data for periods: - | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | - | | | 01 June 2024 | | 250.0 | | | 0.0 | | 0.0 | 0.0 | | | | - | 1 | 30 | 01 July 2024 | | 188.27 | 61.73 | 2.08 | 0.0 | 0.0 | 63.81 | 0.0 | 0.0 | 0.0 | 63.81 | - | 2 | 31 | 01 August 2024 | | 126.03 | 62.24 | 1.57 | 0.0 | 0.0 | 63.81 | 0.0 | 0.0 | 0.0 | 63.81 | - | 3 | 31 | 01 September 2024 | | 63.27 | 62.76 | 1.05 | 0.0 | 0.0 | 63.81 | 0.0 | 0.0 | 0.0 | 63.81 | - | 4 | 30 | 01 October 2024 | | 0.0 | 63.27 | 0.53 | 0.0 | 0.0 | 63.8 | 0.0 | 0.0 | 0.0 | 63.8 | - Then Loan Repayment schedule has the following data in Total row: - | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | - | 250.0 | 5.23 | 0.0 | 0.0 | 255.23 | 0.0 | 0.0 | 0.0 | 255.23 | - Then Loan Transactions tab has the following data: - | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed | - | 01 June 2024 | Disbursement | 250.0 | 0.0 | 0.0 | 0.0 | 0.0 | 250.0 | false | false | - When Admin sets the business date to "03 June 2024" - And Admin runs inline COB job for Loan - Then Loan Repayment schedule has 4 periods, with the following data for periods: - | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | - | | | 01 June 2024 | | 250.0 | | | 0.0 | | 0.0 | 0.0 | | | | - | 1 | 30 | 01 July 2024 | | 188.27 | 61.73 | 2.08 | 0.0 | 0.0 | 63.81 | 0.0 | 0.0 | 0.0 | 63.81 | - | 2 | 31 | 01 August 2024 | | 126.03 | 62.24 | 1.57 | 0.0 | 0.0 | 63.81 | 0.0 | 0.0 | 0.0 | 63.81 | - | 3 | 31 | 01 September 2024 | | 63.27 | 62.76 | 1.05 | 0.0 | 0.0 | 63.81 | 0.0 | 0.0 | 0.0 | 63.81 | - | 4 | 30 | 01 October 2024 | | 0.0 | 63.27 | 0.53 | 0.0 | 0.0 | 63.8 | 0.0 | 0.0 | 0.0 | 63.8 | - Then Loan Repayment schedule has the following data in Total row: - | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | - | 250.0 | 5.23 | 0.0 | 0.0 | 255.23 | 0.0 | 0.0 | 0.0 | 255.23 | - Then Loan Transactions tab has the following data: - | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed | - | 01 June 2024 | Disbursement | 250.0 | 0.0 | 0.0 | 0.0 | 0.0 | 250.0 | false | false | - | 02 June 2024 | Accrual | 0.07 | 0.0 | 0.07 | 0.0 | 0.0 | 0.0 | false | false | - And Admin does charge-off the loan on "03 June 2024" - When Admin sets the business date to "05 June 2024" - And Admin runs the Accrual Activity Posting job - And Admin runs the Add Accrual Transactions job - And Admin runs the Add Accrual Transactions For Loans With Income Posted As Transactions job - And Admin runs the Add Periodic Accrual Transactions job - And Admin runs the Recalculate Interest for Loans job - Then Loan Repayment schedule has 4 periods, with the following data for periods: - | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | - | | | 01 June 2024 | | 250.0 | | | 0.0 | | 0.0 | 0.0 | | | | - | 1 | 30 | 01 July 2024 | | 188.27 | 61.73 | 2.08 | 0.0 | 0.0 | 63.81 | 0.0 | 0.0 | 0.0 | 63.81 | - | 2 | 31 | 01 August 2024 | | 126.03 | 62.24 | 1.57 | 0.0 | 0.0 | 63.81 | 0.0 | 0.0 | 0.0 | 63.81 | - | 3 | 31 | 01 September 2024 | | 63.27 | 62.76 | 1.05 | 0.0 | 0.0 | 63.81 | 0.0 | 0.0 | 0.0 | 63.81 | - | 4 | 30 | 01 October 2024 | | 0.0 | 63.27 | 0.53 | 0.0 | 0.0 | 63.8 | 0.0 | 0.0 | 0.0 | 63.8 | - Then Loan Repayment schedule has the following data in Total row: - | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | - | 250.0 | 5.23 | 0.0 | 0.0 | 255.23 | 0.0 | 0.0 | 0.0 | 255.23 | - Then Loan Transactions tab has the following data: - | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed | - | 01 June 2024 | Disbursement | 250.0 | 0.0 | 0.0 | 0.0 | 0.0 | 250.0 | false | false | - | 02 June 2024 | Accrual | 0.07 | 0.0 | 0.07 | 0.0 | 0.0 | 0.0 | false | false | - | 03 June 2024 | Accrual | 0.07 | 0.0 | 0.07 | 0.0 | 0.0 | 0.0 | false | false | - | 03 June 2024 | Charge-off | 255.23 | 250.0 | 5.23 | 0.0 | 0.0 | 0.0 | false | false | - - @TestRailId:C3338 @AdvancedPaymentAllocation - Scenario: Verify charged off loans to be excluded from scheduled jobs - accrual entries and interest are added when loan has reverted charged-off transaction When Admin sets the business date to "01 June 2024" When Admin creates a client with random data When Admin creates a fully customized loan with the following data: @@ -2093,30 +2024,6 @@ Feature: Charge-off | 02 June 2024 | Accrual | 0.07 | 0.0 | 0.07 | 0.0 | 0.0 | 0.0 | false | false | | 03 June 2024 | Accrual | 0.07 | 0.0 | 0.07 | 0.0 | 0.0 | 0.0 | false | false | | 03 June 2024 | Charge-off | 255.23 | 250.0 | 5.23 | 0.0 | 0.0 | 0.0 | false | false | - When Admin sets the business date to "06 June 2024" - Then Admin does a charge-off undo the loan - And Admin runs the Accrual Activity Posting job - And Admin runs the Add Accrual Transactions job - And Admin runs the Add Accrual Transactions For Loans With Income Posted As Transactions job - And Admin runs the Add Periodic Accrual Transactions job - And Admin runs the Recalculate Interest for Loans job - Then Loan Repayment schedule has 4 periods, with the following data for periods: - | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | - | | | 01 June 2024 | | 250.0 | | | 0.0 | | 0.0 | 0.0 | | | | - | 1 | 30 | 01 July 2024 | | 188.27 | 61.73 | 2.08 | 0.0 | 0.0 | 63.81 | 0.0 | 0.0 | 0.0 | 63.81 | - | 2 | 31 | 01 August 2024 | | 126.03 | 62.24 | 1.57 | 0.0 | 0.0 | 63.81 | 0.0 | 0.0 | 0.0 | 63.81 | - | 3 | 31 | 01 September 2024 | | 63.27 | 62.76 | 1.05 | 0.0 | 0.0 | 63.81 | 0.0 | 0.0 | 0.0 | 63.81 | - | 4 | 30 | 01 October 2024 | | 0.0 | 63.27 | 0.53 | 0.0 | 0.0 | 63.8 | 0.0 | 0.0 | 0.0 | 63.8 | - Then Loan Repayment schedule has the following data in Total row: - | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | - | 250.0 | 5.23 | 0.0 | 0.0 | 255.23 | 0.0 | 0.0 | 0.0 | 255.23 | - Then Loan Transactions tab has the following data: - | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed | - | 01 June 2024 | Disbursement | 250.0 | 0.0 | 0.0 | 0.0 | 0.0 | 250.0 | false | false | - | 02 June 2024 | Accrual | 0.07 | 0.0 | 0.07 | 0.0 | 0.0 | 0.0 | false | false | - | 03 June 2024 | Accrual | 0.07 | 0.0 | 0.07 | 0.0 | 0.0 | 0.0 | false | false | - | 03 June 2024 | Charge-off | 255.23 | 250.0 | 5.23 | 0.0 | 0.0 | 0.0 | true | false | - | 06 June 2024 | Accrual | 0.21 | 0.0 | 0.21 | 0.0 | 0.0 | 0.0 | false | false | @TestRailId:C3326 @AdvancedPaymentAllocation Scenario: Verify the repayment schedule is updated before the Charge-off in case of interest recalculation = true diff --git a/fineract-e2e-tests-runner/src/test/resources/junit-platform.properties b/fineract-e2e-tests-runner/src/test/resources/junit-platform.properties new file mode 100644 index 000000000..240141217 --- /dev/null +++ b/fineract-e2e-tests-runner/src/test/resources/junit-platform.properties @@ -0,0 +1,30 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +cucumber.execution.parallel.enabled=false +cucumber.execution.parallel.config.strategy=fixed +cucumber.execution.parallel.config.fixed.parallelism=3 +cucumber.execution.parallel.config.fixed.max-pool-size=3 +junit.jupiter.execution.parallel.config.fixed.parallelism=3 +junit.jupiter.execution.parallel.enabled = false +junit.jupiter.execution.parallel.config.strategy=fixed +cucumber.plugin=pretty +cucumber.filter.tags=not @Skip +cucumber.execution.exclusive-resources.isolated.read-write=org.junit.platform.engine.support.hierarchical.ExclusiveResource.GLOBAL_KEY +cucumber.execution.execution-mode.feature=same_thread diff --git a/fineract-investor/src/test/java/org/apache/fineract/investor/service/ExternalAssetOwnerLoanProductAttributesWriteServiceImplTest.java b/fineract-investor/src/test/java/org/apache/fineract/investor/service/ExternalAssetOwnerLoanProductAttributesWriteServiceImplTest.java index 7eecc64fd..4a9a80052 100644 --- a/fineract-investor/src/test/java/org/apache/fineract/investor/service/ExternalAssetOwnerLoanProductAttributesWriteServiceImplTest.java +++ b/fineract-investor/src/test/java/org/apache/fineract/investor/service/ExternalAssetOwnerLoanProductAttributesWriteServiceImplTest.java @@ -18,6 +18,7 @@ */ package org.apache.fineract.investor.service; +import static org.junit.jupiter.api.Assertions.assertThrows; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.ArgumentMatchers.eq; @@ -43,7 +44,6 @@ import org.apache.fineract.investor.exception.ExternalAssetOwnerLoanProductAttri import org.apache.fineract.investor.exception.ExternalAssetOwnerLoanProductAttributesException; import org.apache.fineract.portfolio.loanproduct.domain.LoanProductRepository; import org.apache.fineract.portfolio.loanproduct.exception.LoanProductNotFoundException; -import org.junit.Assert; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; @@ -150,7 +150,7 @@ public class ExternalAssetOwnerLoanProductAttributesWriteServiceImplTest { when(testContext.loanProductRepository.existsById(testContext.loanProductId)).thenReturn(true); when(testContext.externalAssetOwnerLoanProductAttributesRepository.findById(1L)).thenReturn(Optional.empty()); - ExternalAssetOwnerLoanProductAttributeNotFoundException thrownException = Assert.assertThrows( + ExternalAssetOwnerLoanProductAttributeNotFoundException thrownException = assertThrows( ExternalAssetOwnerLoanProductAttributeNotFoundException.class, () -> testContext.externalAssetOwnerLoanProductAttributesWriteService.updateExternalAssetOwnerLoanProductAttribute(command, testContext.attributeKey, testContext.attributeValue)); @@ -181,7 +181,7 @@ public class ExternalAssetOwnerLoanProductAttributesWriteServiceImplTest { when(testContext.externalAssetOwnerLoanProductAttributesRepository.findById(command.entityId())) .thenReturn(Optional.of(attributeInDB)); - ExternalAssetOwnerLoanProductAttributesException thrownException = Assert.assertThrows( + ExternalAssetOwnerLoanProductAttributesException thrownException = assertThrows( ExternalAssetOwnerLoanProductAttributesException.class, () -> testContext.externalAssetOwnerLoanProductAttributesWriteService.updateExternalAssetOwnerLoanProductAttribute(command, testContext.attributeKey, testContext.attributeValue)); @@ -233,7 +233,7 @@ public class ExternalAssetOwnerLoanProductAttributesWriteServiceImplTest { when(testContext.fromApiJsonHelper.extractStringNamed(ExternalAssetOwnerLoanProductAttributeRequestParameters.ATTRIBUTE_VALUE, jsonCommandElement)).thenReturn(attributeValue); - PlatformApiDataValidationException thrownException = Assert.assertThrows(PlatformApiDataValidationException.class, + PlatformApiDataValidationException thrownException = assertThrows(PlatformApiDataValidationException.class, () -> testContext.externalAssetOwnerLoanProductAttributesWriteService .createExternalAssetOwnerLoanProductAttribute(command)); @@ -250,7 +250,7 @@ public class ExternalAssetOwnerLoanProductAttributesWriteServiceImplTest { when(testContext.loanProductRepository.existsById(testContext.loanProductId)).thenReturn(false); - LoanProductNotFoundException thrownException = Assert.assertThrows(LoanProductNotFoundException.class, + LoanProductNotFoundException thrownException = assertThrows(LoanProductNotFoundException.class, () -> testContext.externalAssetOwnerLoanProductAttributesWriteService .createExternalAssetOwnerLoanProductAttribute(command)); @@ -270,7 +270,7 @@ public class ExternalAssetOwnerLoanProductAttributesWriteServiceImplTest { testContext.attributeKey)).thenReturn(true); when(testContext.loanProductRepository.existsById(testContext.loanProductId)).thenReturn(true); - ExternalAssetOwnerLoanProductAttributeAlreadyExistsException thrownException = Assert.assertThrows( + ExternalAssetOwnerLoanProductAttributeAlreadyExistsException thrownException = assertThrows( ExternalAssetOwnerLoanProductAttributeAlreadyExistsException.class, () -> testContext.externalAssetOwnerLoanProductAttributesWriteService .createExternalAssetOwnerLoanProductAttribute(command)); @@ -291,7 +291,7 @@ public class ExternalAssetOwnerLoanProductAttributesWriteServiceImplTest { final JsonElement jsonCommandElement = testContext.fromJsonHelper.parse(testContext.jsonCommandString); when(testContext.fromApiJsonHelper.extractStringNamed(ExternalAssetOwnerLoanProductAttributeRequestParameters.ATTRIBUTE_KEY, jsonCommandElement)).thenReturn("BAD_KEY"); - ExternalAssetOwnerLoanProductAttributeInvalidSettlementAttributeException thrownException = Assert.assertThrows( + ExternalAssetOwnerLoanProductAttributeInvalidSettlementAttributeException thrownException = assertThrows( ExternalAssetOwnerLoanProductAttributeInvalidSettlementAttributeException.class, () -> testContext.externalAssetOwnerLoanProductAttributesWriteService .createExternalAssetOwnerLoanProductAttribute(command)); @@ -311,7 +311,7 @@ public class ExternalAssetOwnerLoanProductAttributesWriteServiceImplTest { final JsonElement jsonCommandElement = testContext.fromJsonHelper.parse(testContext.jsonCommandString); when(testContext.fromApiJsonHelper.extractStringNamed(ExternalAssetOwnerLoanProductAttributeRequestParameters.ATTRIBUTE_VALUE, jsonCommandElement)).thenReturn("BAD_VALUE"); - ExternalAssetOwnerLoanProductAttributeInvalidSettlementAttributeException thrownException = Assert.assertThrows( + ExternalAssetOwnerLoanProductAttributeInvalidSettlementAttributeException thrownException = assertThrows( ExternalAssetOwnerLoanProductAttributeInvalidSettlementAttributeException.class, () -> testContext.externalAssetOwnerLoanProductAttributesWriteService .createExternalAssetOwnerLoanProductAttribute(command)); diff --git a/fineract-investor/src/test/java/org/apache/fineract/investor/service/ExternalAssetOwnersWriteServiceTest.java b/fineract-investor/src/test/java/org/apache/fineract/investor/service/ExternalAssetOwnersWriteServiceTest.java index 71d910266..fef26dd75 100644 --- a/fineract-investor/src/test/java/org/apache/fineract/investor/service/ExternalAssetOwnersWriteServiceTest.java +++ b/fineract-investor/src/test/java/org/apache/fineract/investor/service/ExternalAssetOwnersWriteServiceTest.java @@ -66,7 +66,6 @@ import org.apache.fineract.investor.exception.ExternalAssetOwnerInitiateTransfer import org.apache.fineract.portfolio.loanaccount.domain.LoanRepository; import org.apache.fineract.portfolio.loanaccount.domain.LoanStatus; import org.apache.fineract.portfolio.loanaccount.exception.LoanNotFoundException; -import org.junit.Assert; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -132,7 +131,7 @@ public class ExternalAssetOwnersWriteServiceTest { when(testContext.delayedSettlementAttributeService.isEnabled(testContext.loanProductId)).thenReturn(false); // when - ExternalAssetOwnerInitiateTransferException thrownException = Assert.assertThrows(ExternalAssetOwnerInitiateTransferException.class, + ExternalAssetOwnerInitiateTransferException thrownException = assertThrows(ExternalAssetOwnerInitiateTransferException.class, () -> testContext.externalAssetOwnersWriteServiceImpl.intermediarySaleLoanByLoanId(command)); // then @@ -160,7 +159,7 @@ public class ExternalAssetOwnersWriteServiceTest { any(LocalDate.class))).thenReturn(externalAssetOwnerTransferList); // when - ExternalAssetOwnerInitiateTransferException thrownException = Assert.assertThrows(ExternalAssetOwnerInitiateTransferException.class, + ExternalAssetOwnerInitiateTransferException thrownException = assertThrows(ExternalAssetOwnerInitiateTransferException.class, () -> testContext.externalAssetOwnersWriteServiceImpl.intermediarySaleLoanByLoanId(command)); // then @@ -356,7 +355,7 @@ public class ExternalAssetOwnersWriteServiceTest { when(testContext.delayedSettlementAttributeService.isEnabled(testContext.loanProductId)).thenReturn(true); // when - ExternalAssetOwnerInitiateTransferException thrownException = Assert.assertThrows(ExternalAssetOwnerInitiateTransferException.class, + ExternalAssetOwnerInitiateTransferException thrownException = assertThrows(ExternalAssetOwnerInitiateTransferException.class, () -> testContext.externalAssetOwnersWriteServiceImpl.intermediarySaleLoanByLoanId(command)); // then diff --git a/fineract-provider/src/test/java/org/apache/fineract/cob/listener/LoanItemListenerStepDefinitions.java b/fineract-provider/src/test/java/org/apache/fineract/cob/listener/LoanItemListenerStepDefinitions.java index 6899a21e5..ba559cbc8 100644 --- a/fineract-provider/src/test/java/org/apache/fineract/cob/listener/LoanItemListenerStepDefinitions.java +++ b/fineract-provider/src/test/java/org/apache/fineract/cob/listener/LoanItemListenerStepDefinitions.java @@ -18,8 +18,8 @@ */ package org.apache.fineract.cob.listener; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.spy; diff --git a/fineract-provider/src/test/java/org/apache/fineract/cob/loan/AddPeriodicAccrualEntriesBusinessStepTest.java b/fineract-provider/src/test/java/org/apache/fineract/cob/loan/AddPeriodicAccrualEntriesBusinessStepTest.java index 49fa70b45..e1a87c785 100644 --- a/fineract-provider/src/test/java/org/apache/fineract/cob/loan/AddPeriodicAccrualEntriesBusinessStepTest.java +++ b/fineract-provider/src/test/java/org/apache/fineract/cob/loan/AddPeriodicAccrualEntriesBusinessStepTest.java @@ -20,6 +20,7 @@ package org.apache.fineract.cob.loan; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertThrows; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.doThrow; @@ -41,7 +42,6 @@ import org.apache.fineract.infrastructure.core.exception.MultiException; import org.apache.fineract.infrastructure.core.service.ThreadLocalContextUtil; import org.apache.fineract.portfolio.loanaccount.domain.Loan; import org.apache.fineract.portfolio.loanaccount.service.LoanAccrualsProcessingService; -import org.junit.Assert; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -92,7 +92,7 @@ public class AddPeriodicAccrualEntriesBusinessStepTest { doThrow(new MultiException(Collections.singletonList(new RuntimeException()))).when(loanAccrualsProcessingService) .addPeriodicAccruals(any(LocalDate.class), eq(loanForProcessing)); // when - final BusinessStepException businessStepException = Assert.assertThrows(BusinessStepException.class, + final BusinessStepException businessStepException = assertThrows(BusinessStepException.class, () -> underTest.execute(loanForProcessing)); // then verify(loanAccrualsProcessingService, times(1)).addPeriodicAccruals(any(LocalDate.class), eq(loanForProcessing)); diff --git a/fineract-provider/src/test/java/org/apache/fineract/cob/loan/LoanItemReaderStepDefinitions.java b/fineract-provider/src/test/java/org/apache/fineract/cob/loan/LoanItemReaderStepDefinitions.java index 26d2be8b4..0e3981375 100644 --- a/fineract-provider/src/test/java/org/apache/fineract/cob/loan/LoanItemReaderStepDefinitions.java +++ b/fineract-provider/src/test/java/org/apache/fineract/cob/loan/LoanItemReaderStepDefinitions.java @@ -18,8 +18,8 @@ */ package org.apache.fineract.cob.loan; -import static org.junit.Assert.assertNull; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.lenient; diff --git a/fineract-provider/src/test/java/org/apache/fineract/cob/loan/SetLoanDelinquencyTagsBusinessStepTest.java b/fineract-provider/src/test/java/org/apache/fineract/cob/loan/SetLoanDelinquencyTagsBusinessStepTest.java index 6976991ce..8683f89ad 100644 --- a/fineract-provider/src/test/java/org/apache/fineract/cob/loan/SetLoanDelinquencyTagsBusinessStepTest.java +++ b/fineract-provider/src/test/java/org/apache/fineract/cob/loan/SetLoanDelinquencyTagsBusinessStepTest.java @@ -18,11 +18,11 @@ */ package org.apache.fineract.cob.loan; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyList; import static org.mockito.Mockito.doNothing; diff --git a/fineract-provider/src/test/java/org/apache/fineract/infrastructure/businessdate/data/BusinessDataSerialized.java b/fineract-provider/src/test/java/org/apache/fineract/infrastructure/businessdate/data/BusinessDataSerialized.java index b142fc83b..620aee6e0 100644 --- a/fineract-provider/src/test/java/org/apache/fineract/infrastructure/businessdate/data/BusinessDataSerialized.java +++ b/fineract-provider/src/test/java/org/apache/fineract/infrastructure/businessdate/data/BusinessDataSerialized.java @@ -18,7 +18,7 @@ */ package org.apache.fineract.infrastructure.businessdate.data; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import java.time.LocalDate; import java.time.ZoneId; diff --git a/fineract-provider/src/test/java/org/apache/fineract/infrastructure/businessdate/data/BusinessDataTypeTest.java b/fineract-provider/src/test/java/org/apache/fineract/infrastructure/businessdate/data/BusinessDataTypeTest.java index 958a12dbe..f0e944ee3 100644 --- a/fineract-provider/src/test/java/org/apache/fineract/infrastructure/businessdate/data/BusinessDataTypeTest.java +++ b/fineract-provider/src/test/java/org/apache/fineract/infrastructure/businessdate/data/BusinessDataTypeTest.java @@ -18,7 +18,7 @@ */ package org.apache.fineract.infrastructure.businessdate.data; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import org.apache.fineract.infrastructure.businessdate.domain.BusinessDateType; import org.junit.jupiter.api.Test; diff --git a/fineract-provider/src/test/java/org/apache/fineract/infrastructure/businessdate/mapper/BusinessDateMapperTest.java b/fineract-provider/src/test/java/org/apache/fineract/infrastructure/businessdate/mapper/BusinessDateMapperTest.java index 5f6639453..a028ea472 100644 --- a/fineract-provider/src/test/java/org/apache/fineract/infrastructure/businessdate/mapper/BusinessDateMapperTest.java +++ b/fineract-provider/src/test/java/org/apache/fineract/infrastructure/businessdate/mapper/BusinessDateMapperTest.java @@ -18,7 +18,7 @@ */ package org.apache.fineract.infrastructure.businessdate.mapper; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import java.time.LocalDate; import java.time.ZoneId; diff --git a/fineract-provider/src/test/java/org/apache/fineract/infrastructure/businessdate/validator/BusinessDateValidatorTest.java b/fineract-provider/src/test/java/org/apache/fineract/infrastructure/businessdate/validator/BusinessDateValidatorTest.java index 4b9e03f76..5177bbcda 100644 --- a/fineract-provider/src/test/java/org/apache/fineract/infrastructure/businessdate/validator/BusinessDateValidatorTest.java +++ b/fineract-provider/src/test/java/org/apache/fineract/infrastructure/businessdate/validator/BusinessDateValidatorTest.java @@ -18,8 +18,8 @@ */ package org.apache.fineract.infrastructure.businessdate.validator; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertThrows; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; import java.time.LocalDate; import org.apache.fineract.infrastructure.businessdate.data.BusinessDateData; diff --git a/fineract-provider/src/test/java/org/apache/fineract/infrastructure/core/config/EnableFineractEventListenerConditionTest.java b/fineract-provider/src/test/java/org/apache/fineract/infrastructure/core/config/EnableFineractEventListenerConditionTest.java index fad1d7b8d..414380181 100644 --- a/fineract-provider/src/test/java/org/apache/fineract/infrastructure/core/config/EnableFineractEventListenerConditionTest.java +++ b/fineract-provider/src/test/java/org/apache/fineract/infrastructure/core/config/EnableFineractEventListenerConditionTest.java @@ -18,8 +18,8 @@ */ package org.apache.fineract.infrastructure.core.config; -import static org.junit.Assert.assertTrue; import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.mock; diff --git a/fineract-provider/src/test/java/org/apache/fineract/infrastructure/dataqueries/service/DatatableExportUtilTest.java b/fineract-provider/src/test/java/org/apache/fineract/infrastructure/dataqueries/service/DatatableExportUtilTest.java index d6ea10e35..bb55aada0 100644 --- a/fineract-provider/src/test/java/org/apache/fineract/infrastructure/dataqueries/service/DatatableExportUtilTest.java +++ b/fineract-provider/src/test/java/org/apache/fineract/infrastructure/dataqueries/service/DatatableExportUtilTest.java @@ -18,13 +18,16 @@ */ package org.apache.fineract.infrastructure.dataqueries.service; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; + import java.util.Collections; import java.util.Map; import java.util.TreeMap; import org.apache.fineract.infrastructure.core.domain.FineractPlatformTenant; import org.apache.fineract.infrastructure.core.service.ThreadLocalContextUtil; import org.apache.fineract.infrastructure.dataqueries.service.export.DatatableExportUtil; -import org.junit.Assert; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -43,27 +46,27 @@ public class DatatableExportUtilTest { @Test public void emptyFolderTest() { - Assert.assertEquals("", DatatableExportUtil.normalizeFolderName("")); - Assert.assertEquals("", DatatableExportUtil.normalizeFolderName("/")); - Assert.assertEquals("", DatatableExportUtil.normalizeFolderName(null)); + assertEquals("", DatatableExportUtil.normalizeFolderName("")); + assertEquals("", DatatableExportUtil.normalizeFolderName("/")); + assertEquals("", DatatableExportUtil.normalizeFolderName(null)); } @Test public void specialCharacterFolderTest() { - Assert.assertEquals("_", DatatableExportUtil.normalizeFolderName("Á")); - Assert.assertEquals("_", DatatableExportUtil.normalizeFolderName("=")); - Assert.assertEquals("_", DatatableExportUtil.normalizeFolderName("\\")); - Assert.assertEquals("_", DatatableExportUtil.normalizeFolderName("@")); + assertEquals("_", DatatableExportUtil.normalizeFolderName("Á")); + assertEquals("_", DatatableExportUtil.normalizeFolderName("=")); + assertEquals("_", DatatableExportUtil.normalizeFolderName("\\")); + assertEquals("_", DatatableExportUtil.normalizeFolderName("@")); } @Test public void normalizedFolderNameTest() { - Assert.assertEquals("$", DatatableExportUtil.normalizeFolderName("$")); - Assert.assertEquals("reports", DatatableExportUtil.normalizeFolderName("reports")); - Assert.assertEquals("reports", DatatableExportUtil.normalizeFolderName("reports/")); - Assert.assertEquals("reports", DatatableExportUtil.normalizeFolderName("/reports/")); - Assert.assertEquals("reports/content", DatatableExportUtil.normalizeFolderName("reports/content")); - Assert.assertEquals("reports/content", DatatableExportUtil.normalizeFolderName("reports/////content")); + assertEquals("$", DatatableExportUtil.normalizeFolderName("$")); + assertEquals("reports", DatatableExportUtil.normalizeFolderName("reports")); + assertEquals("reports", DatatableExportUtil.normalizeFolderName("reports/")); + assertEquals("reports", DatatableExportUtil.normalizeFolderName("/reports/")); + assertEquals("reports/content", DatatableExportUtil.normalizeFolderName("reports/content")); + assertEquals("reports/content", DatatableExportUtil.normalizeFolderName("reports/////content")); } @Test @@ -71,41 +74,40 @@ public class DatatableExportUtilTest { String reportName = "reportName"; Map reportParams = Collections.synchronizedSortedMap(new TreeMap<>(Map.of("param1", "value1", "param2", "value2"))); String fileName = DatatableExportUtil.generateS3DatatableExportFileName(1024, "folder", "csv", reportName, reportParams); - Assert.assertTrue(fileName.matches("folder/reportName\\(param1_value1;param2_value2\\)_\\d{14}.csv")); + assertTrue(fileName.matches("folder/reportName\\(param1_value1;param2_value2\\)_\\d{14}.csv")); } @Test public void generateDatatableExportFileNameComplexTest() { String reportName = "reportName"; Map reportParams = Collections.synchronizedSortedMap(new TreeMap<>(Map.of("param1", "value1", "param2", "value2"))); - Assert.assertTrue(DatatableExportUtil.generateS3DatatableExportFileName(1024, "folder///name///", "csv", reportName, reportParams) + assertTrue(DatatableExportUtil.generateS3DatatableExportFileName(1024, "folder///name///", "csv", reportName, reportParams) .matches("folder/name/reportName\\(param1_value1;param2_value2\\)_\\d{14}.csv")); - IllegalArgumentException folderTooLongException = Assert.assertThrows(IllegalArgumentException.class, () -> { + IllegalArgumentException folderTooLongException = assertThrows(IllegalArgumentException.class, () -> { DatatableExportUtil.generateS3DatatableExportFileName(30, "too_long_folder_name_test", "csv", reportName, reportParams); }); - Assert.assertEquals("The folder name is too long", folderTooLongException.getMessage()); + assertEquals("The folder name is too long", folderTooLongException.getMessage()); - IllegalArgumentException maximumLengthException = Assert.assertThrows(IllegalArgumentException.class, () -> { + IllegalArgumentException maximumLengthException = assertThrows(IllegalArgumentException.class, () -> { DatatableExportUtil.generateS3DatatableExportFileName(29, "folder///name/", "csv", reportName, reportParams); }); - Assert.assertEquals("The maximum length must be greater than 30", maximumLengthException.getMessage()); + assertEquals("The maximum length must be greater than 30", maximumLengthException.getMessage()); - IllegalArgumentException extensionRequired = Assert.assertThrows(IllegalArgumentException.class, () -> { + IllegalArgumentException extensionRequired = assertThrows(IllegalArgumentException.class, () -> { DatatableExportUtil.generateS3DatatableExportFileName(30, "too_long_folder_name_test", null, reportName, reportParams); }); - Assert.assertEquals("The extension is required", extensionRequired.getMessage()); + assertEquals("The extension is required", extensionRequired.getMessage()); - IllegalArgumentException reportNameRequired = Assert.assertThrows(IllegalArgumentException.class, () -> { + IllegalArgumentException reportNameRequired = assertThrows(IllegalArgumentException.class, () -> { DatatableExportUtil.generateS3DatatableExportFileName(30, "too_long_folder_name_test", "csv", null, reportParams); }); - Assert.assertEquals("The report name is required", reportNameRequired.getMessage()); + assertEquals("The report name is required", reportNameRequired.getMessage()); - Assert.assertTrue(DatatableExportUtil.generateS3DatatableExportFileName(1024, "folder///name/", ".csv", reportName, null) + assertTrue(DatatableExportUtil.generateS3DatatableExportFileName(1024, "folder///name/", ".csv", reportName, null) .matches("folder/name/reportName_\\d{14}.csv")); - Assert.assertTrue( - DatatableExportUtil.generateS3DatatableExportFileName(1024, "folder///name/", "csv", "report/with/slash", reportParams) - .matches("folder/name/report_with_slash\\(param1_value1;param2_value2\\)_\\d{14}.csv")); + assertTrue(DatatableExportUtil.generateS3DatatableExportFileName(1024, "folder///name/", "csv", "report/with/slash", reportParams) + .matches("folder/name/report_with_slash\\(param1_value1;param2_value2\\)_\\d{14}.csv")); } } diff --git a/fineract-provider/src/test/java/org/apache/fineract/infrastructure/event/external/service/message/MessageFactoryTest.java b/fineract-provider/src/test/java/org/apache/fineract/infrastructure/event/external/service/message/MessageFactoryTest.java index 420d7d826..f1006a848 100644 --- a/fineract-provider/src/test/java/org/apache/fineract/infrastructure/event/external/service/message/MessageFactoryTest.java +++ b/fineract-provider/src/test/java/org/apache/fineract/infrastructure/event/external/service/message/MessageFactoryTest.java @@ -18,7 +18,7 @@ */ package org.apache.fineract.infrastructure.event.external.service.message; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; diff --git a/fineract-provider/src/test/java/org/apache/fineract/infrastructure/jobs/service/increasedateby1day/increasebusinessdateby1day/IncreaseBusinessDateBy1DayTaskletTest.java b/fineract-provider/src/test/java/org/apache/fineract/infrastructure/jobs/service/increasedateby1day/increasebusinessdateby1day/IncreaseBusinessDateBy1DayTaskletTest.java index ce86ea33f..4ede71b68 100644 --- a/fineract-provider/src/test/java/org/apache/fineract/infrastructure/jobs/service/increasedateby1day/increasebusinessdateby1day/IncreaseBusinessDateBy1DayTaskletTest.java +++ b/fineract-provider/src/test/java/org/apache/fineract/infrastructure/jobs/service/increasedateby1day/increasebusinessdateby1day/IncreaseBusinessDateBy1DayTaskletTest.java @@ -18,7 +18,7 @@ */ package org.apache.fineract.infrastructure.jobs.service.increasedateby1day.increasebusinessdateby1day; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; diff --git a/fineract-provider/src/test/java/org/apache/fineract/infrastructure/jobs/service/increasedateby1day/increasecobdateby1day/IncreaseCobDateBy1DayTaskletTest.java b/fineract-provider/src/test/java/org/apache/fineract/infrastructure/jobs/service/increasedateby1day/increasecobdateby1day/IncreaseCobDateBy1DayTaskletTest.java index d7b394cc7..1c684ad45 100644 --- a/fineract-provider/src/test/java/org/apache/fineract/infrastructure/jobs/service/increasedateby1day/increasecobdateby1day/IncreaseCobDateBy1DayTaskletTest.java +++ b/fineract-provider/src/test/java/org/apache/fineract/infrastructure/jobs/service/increasedateby1day/increasecobdateby1day/IncreaseCobDateBy1DayTaskletTest.java @@ -18,7 +18,7 @@ */ package org.apache.fineract.infrastructure.jobs.service.increasedateby1day.increasecobdateby1day; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; diff --git a/fineract-provider/src/test/java/org/apache/fineract/portfolio/loanaccount/domain/LoanChargeEffectiveDueDateComparatorTest.java b/fineract-provider/src/test/java/org/apache/fineract/portfolio/loanaccount/domain/LoanChargeEffectiveDueDateComparatorTest.java index cafa4620b..623df4929 100644 --- a/fineract-provider/src/test/java/org/apache/fineract/portfolio/loanaccount/domain/LoanChargeEffectiveDueDateComparatorTest.java +++ b/fineract-provider/src/test/java/org/apache/fineract/portfolio/loanaccount/domain/LoanChargeEffectiveDueDateComparatorTest.java @@ -18,7 +18,7 @@ */ package org.apache.fineract.portfolio.loanaccount.domain; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import java.time.LocalDate; import java.util.ArrayList; diff --git a/fineract-provider/src/test/java/org/apache/fineract/portfolio/loanproduct/LoanProductValidationStepDefinitions.java b/fineract-provider/src/test/java/org/apache/fineract/portfolio/loanproduct/LoanProductValidationStepDefinitions.java index 77ef912cc..35c071523 100644 --- a/fineract-provider/src/test/java/org/apache/fineract/portfolio/loanproduct/LoanProductValidationStepDefinitions.java +++ b/fineract-provider/src/test/java/org/apache/fineract/portfolio/loanproduct/LoanProductValidationStepDefinitions.java @@ -20,8 +20,8 @@ package org.apache.fineract.portfolio.loanproduct; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.is; -import static org.junit.Assert.assertThrows; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; import io.cucumber.java8.En; import org.apache.commons.lang3.StringUtils; diff --git a/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanTransactionChargebackTest.java b/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanTransactionChargebackTest.java index a928a1fb2..bbcfaf550 100644 --- a/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanTransactionChargebackTest.java +++ b/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanTransactionChargebackTest.java @@ -68,7 +68,6 @@ import org.apache.fineract.integrationtests.common.products.DelinquencyBucketsHe import org.apache.fineract.portfolio.loanaccount.domain.LoanStatus; import org.apache.fineract.portfolio.loanaccount.loanschedule.domain.LoanScheduleType; import org.apache.fineract.portfolio.loanproduct.domain.PaymentAllocationType; -import org.junit.experimental.runners.Enclosed; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Named; import org.junit.jupiter.api.Nested; @@ -76,9 +75,7 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; -import org.junit.runner.RunWith; -@RunWith(Enclosed.class) @Slf4j public class LoanTransactionChargebackTest extends BaseLoanIntegrationTest { diff --git a/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanTransactionTest.java b/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanTransactionTest.java index e159f2b84..838ad1180 100644 --- a/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanTransactionTest.java +++ b/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanTransactionTest.java @@ -18,8 +18,8 @@ */ package org.apache.fineract.integrationtests; -import static org.junit.Assert.assertNotNull; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; import java.math.BigDecimal; import java.util.List; diff --git a/integration-tests/src/test/java/org/apache/fineract/integrationtests/SearchResourcesTest.java b/integration-tests/src/test/java/org/apache/fineract/integrationtests/SearchResourcesTest.java index 39355ea35..59be82bb2 100644 --- a/integration-tests/src/test/java/org/apache/fineract/integrationtests/SearchResourcesTest.java +++ b/integration-tests/src/test/java/org/apache/fineract/integrationtests/SearchResourcesTest.java @@ -18,8 +18,8 @@ */ package org.apache.fineract.integrationtests; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; import io.restassured.builder.RequestSpecBuilder; import io.restassured.builder.ResponseSpecBuilder; @@ -88,7 +88,7 @@ public class SearchResourcesTest { getResources(resources)); assertNotNull(searchResponse); assertEquals(1, searchResponse.size()); - assertEquals("Client name comparation", getClientResponse.getDisplayName(), searchResponse.get(0).getEntityName()); + assertEquals(getClientResponse.getDisplayName(), searchResponse.get(0).getEntityName(), "Client name comparation"); } @Test diff --git a/integration-tests/src/test/java/org/apache/fineract/integrationtests/investor/externalassetowner/SearchExternalAssetOwnerTransferTest.java b/integration-tests/src/test/java/org/apache/fineract/integrationtests/investor/externalassetowner/SearchExternalAssetOwnerTransferTest.java index de7790404..29d5aec6f 100644 --- a/integration-tests/src/test/java/org/apache/fineract/integrationtests/investor/externalassetowner/SearchExternalAssetOwnerTransferTest.java +++ b/integration-tests/src/test/java/org/apache/fineract/integrationtests/investor/externalassetowner/SearchExternalAssetOwnerTransferTest.java @@ -20,9 +20,9 @@ package org.apache.fineract.integrationtests.investor.externalassetowner; import static org.apache.fineract.client.models.ExternalTransferData.StatusEnum.CANCELLED; import static org.apache.fineract.client.models.ExternalTransferData.StatusEnum.PENDING; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.math.BigDecimal; import java.time.LocalDate; @@ -114,21 +114,21 @@ public class SearchExternalAssetOwnerTransferTest extends ExternalAssetOwnerTran .buildExternalAssetOwnerSearchRequest(textToSearch, "", null, null, 0, 10); PageExternalTransferData response = EXTERNAL_ASSET_OWNER_HELPER.searchExternalAssetOwnerTransfer(searchRequest); assertNotNull(response); - assertEquals("Expecting none result", 0, response.getContent().size()); + assertEquals(0, response.getContent().size(), "Expecting none result"); // Search over the current Asset Transfers and get just the first five textToSearch = ""; searchRequest = EXTERNAL_ASSET_OWNER_HELPER.buildExternalAssetOwnerSearchRequest(textToSearch, "", null, null, 0, 5); response = EXTERNAL_ASSET_OWNER_HELPER.searchExternalAssetOwnerTransfer(searchRequest); assertNotNull(response); - assertEquals("Expecting first five results", 5, response.getContent().size()); + assertEquals(5, response.getContent().size(), "Expecting first five results"); textToSearch = response.getContent().iterator().next().getOwner().getExternalId(); searchRequest = EXTERNAL_ASSET_OWNER_HELPER.buildExternalAssetOwnerSearchRequest(textToSearch, "", null, null, 0, 5); response = EXTERNAL_ASSET_OWNER_HELPER.searchExternalAssetOwnerTransfer(searchRequest); assertNotNull(response); - assertTrue("Expecting only two results", response.getContent().size() >= 2); - assertEquals("External Id is different", textToSearch, response.getContent().iterator().next().getOwner().getExternalId()); + assertTrue(response.getContent().size() >= 2, "Expecting only two results"); + assertEquals(textToSearch, response.getContent().iterator().next().getOwner().getExternalId(), "External Id is different"); } @Test @@ -146,7 +146,7 @@ public class SearchExternalAssetOwnerTransferTest extends ExternalAssetOwnerTran searchRequest = EXTERNAL_ASSET_OWNER_HELPER.buildExternalAssetOwnerSearchRequest(null, attribute, fromDate, toDate, 0, null); response = EXTERNAL_ASSET_OWNER_HELPER.searchExternalAssetOwnerTransfer(searchRequest); validateResponse(response, 1); - assertTrue("Transfers were not found", response.getContent().size() > 0); + assertTrue(response.getContent().size() > 0, "Transfers were not found"); } @Test @@ -164,7 +164,7 @@ public class SearchExternalAssetOwnerTransferTest extends ExternalAssetOwnerTran searchRequest = EXTERNAL_ASSET_OWNER_HELPER.buildExternalAssetOwnerSearchRequest(null, attribute, fromDate, toDate, 0, null); response = EXTERNAL_ASSET_OWNER_HELPER.searchExternalAssetOwnerTransfer(searchRequest); validateResponse(response, 1); - assertTrue("Transfers were not found", response.getContent().size() > 0); + assertTrue(response.getContent().size() > 0, "Transfers were not found"); } @Test @@ -192,11 +192,11 @@ public class SearchExternalAssetOwnerTransferTest extends ExternalAssetOwnerTran assertEquals(isEmpty, response.getEmpty()); assertEquals(true, response.getFirst()); if (isEmpty) { - assertTrue("Transfers size difference", response.getContent().size() == size); - assertTrue("Total pages difference", response.getTotalPages() == 0); + assertTrue(response.getContent().size() == size, "Transfers size difference"); + assertTrue(response.getTotalPages() == 0, "Total pages difference"); } else { - assertTrue("Total pages difference", response.getTotalPages() > 0); - assertTrue("Total number of elements difference", response.getNumberOfElements() > 0); + assertTrue(response.getTotalPages() > 0, "Total pages difference"); + assertTrue(response.getNumberOfElements() > 0, "Total number of elements difference"); } assertEquals(true, response.getFirst()); }