From f2624b584c39aa6a4400c486a6a14491a93db553 Mon Sep 17 00:00:00 2001 From: xurror Date: Tue, 9 Jun 2020 14:24:37 +0100 Subject: [PATCH] FINERACT-1021 - Update to JUnit 5 --- README.md | 2 +- fineract-provider/build.gradle | 2 +- fineract-provider/dependencies.gradle | 6 +- .../AccountNumberPreferencesTest.java | 36 +- .../integrationtests/AccountTransferTest.java | 100 +-- .../AccountingScenarioIntegrationTest.java | 38 +- .../ActuatorIntegrationTest.java | 4 +- .../integrationtests/ApiDocsTest.java | 6 +- .../integrationtests/BatchApiTest.java | 48 +- .../BatchRequestsIntegrationTest.java | 12 +- .../CenterIntegrationTest.java | 110 +-- .../integrationtests/ChargesTest.java | 102 +-- .../ClientLoanIntegrationTest.java | 487 +++++++------ .../ClientSavingsIntegrationTest.java | 354 +++++----- .../integrationtests/ClientStatusChecker.java | 2 +- .../fineract/integrationtests/ClientTest.java | 14 +- ...ndoRejectAndWithdrawalIntegrationTest.java | 30 +- .../ConcurrencyIntegrationTest.java | 6 +- .../integrationtests/CurrenciesTest.java | 28 +- .../CurrencyIntegrationTest.java | 4 +- .../DisbursalAndRepaymentScheduleTest.java | 36 +- .../ExternalServicesConfigurationTest.java | 28 +- .../FinancialActivityAccountsTest.java | 36 +- .../integrationtests/FixedDepositTest.java | 268 +++---- ...SavingsInterestPostingIntegrationTest.java | 32 +- .../FundsIntegrationTest.java | 68 +- ...hargedFromDateSameAsDisbursalDateTest.java | 16 +- .../GlobalConfigurationTest.java | 52 +- .../GroupLoanIntegrationTest.java | 64 +- .../GroupSavingsIntegrationTest.java | 180 ++--- .../fineract/integrationtests/GroupTest.java | 28 +- .../integrationtests/HookIntegrationTest.java | 16 +- .../LoanApplicationApprovalTest.java | 8 +- .../LoanApplicationUndoLastTrancheTest.java | 10 +- .../LoanDisbursalDateValidationTest.java | 12 +- ...oanDisbursementDetailsIntegrationTest.java | 8 +- ...RepaymentRescheduleAtDisbursementTest.java | 8 +- .../LoanRescheduleRequestTest.java | 10 +- .../LoanReschedulingWithinCenterTest.java | 24 +- ...iveInterestAndWriteOffIntegrationTest.java | 32 +- ...anWithdrawnByApplicantIntegrationTest.java | 6 +- ...BetweenDisbursalAndFirstRepaymentTest.java | 12 +- .../integrationtests/NotificationApiTest.java | 10 +- .../OfficeIntegrationTest.java | 12 +- .../PasswordPreferencesIntegrationTest.java | 12 +- .../PaymentTypeIntegrationTest.java | 28 +- .../fineract/integrationtests/RatesTest.java | 16 +- .../RecurringDepositTest.java | 322 ++++----- .../fineract/integrationtests/RolesTest.java | 34 +- .../integrationtests/SchedulerJobsTest.java | 22 +- .../SchedulerJobsTestResults.java | 250 ++++--- .../SkipRepaymentOnMonthFirstTest.java | 34 +- .../integrationtests/StaffImageApiTest.java | 26 +- .../fineract/integrationtests/StaffTest.java | 46 +- .../SurveyIntegrationTest.java | 4 +- .../integrationtests/SystemCodeTest.java | 107 +-- .../TemplateIntegrationTest.java | 16 +- .../UserAdministrationTest.java | 54 +- .../integrationtests/WorkingDaysTest.java | 16 +- .../integrationtests/XBRLIntegrationTest.java | 10 +- .../client/ClientEntityImportHandlerTest.java | 16 +- .../loan/LoanImportHandlerTest.java | 32 +- .../office/OfficeImportHandlerTest.java | 12 +- .../savings/SavingsImportHandlerTest.java | 26 +- .../ClientEntityWorkbookPopulatorTest.java | 16 +- .../loan/LoanWorkbookPopulatorTest.java | 34 +- .../office/OfficeWorkBookPopulatorTest.java | 12 +- .../savings/SavingsWorkbookPopulateTest.java | 28 +- .../integrationtests/common/BatchHelper.java | 8 +- .../common/CalendarHelper.java | 4 +- .../integrationtests/common/CenterHelper.java | 6 +- .../common/ClientChargesTest.java | 38 +- .../integrationtests/common/ClientHelper.java | 4 +- .../common/GlobalConfigurationHelper.java | 16 +- .../integrationtests/common/GroupHelper.java | 18 +- .../integrationtests/common/HookHelper.java | 2 +- .../common/LoanRescheduleRequestHelper.java | 4 +- .../common/PaymentTypeHelper.java | 4 +- .../common/ProvisioningIntegrationTest.java | 38 +- .../common/SchedulerJobHelper.java | 14 +- .../integrationtests/common/SurveyHelper.java | 4 +- .../integrationtests/common/Utils.java | 2 +- .../common/accounting/JournalEntryHelper.java | 8 +- .../FixedDepositAccountStatusChecker.java | 32 +- .../common/loans/LoanStatusChecker.java | 6 +- .../common/loans/LoanTransactionHelper.java | 26 +- .../common/organisation/CampaignsHelper.java | 4 +- .../common/organisation/CampaignsTest.java | 12 +- .../EntityDatatableChecksIntegrationTest.java | 86 +-- .../RecurringDepositAccountStatusChecker.java | 26 +- .../common/savings/SavingsAccountHelper.java | 6 +- .../common/savings/SavingsProductHelper.java | 4 +- .../common/savings/SavingsStatusChecker.java | 34 +- .../shares/DividendsIntegrationTests.java | 64 +- .../shares/ShareAccountIntegrationTests.java | 652 +++++++++--------- .../common/shares/ShareProductHelper.java | 38 +- .../common/system/DatatableHelper.java | 2 +- .../interoperation/InteropTest.java | 70 +- .../loanaccount/guarantor/GuarantorTest.java | 64 +- .../VariableInstallmentsIntegrationTest.java | 22 +- .../common/AccountingConstantsTest.java | 2 +- .../apache/fineract/batch/BatchBuilder.java | 6 +- .../provider/CommandHandlerProviderTest.java | 19 +- .../org/apache/fineract/common/Utils.java | 2 +- ...lasspathHellDuplicatesCheckExtension.java} | 16 +- .../ClasspathHellDuplicatesCheckRuleTest.java | 8 +- .../spring/SpringConfigurationTest.java | 8 +- ...pringBootWithMariaDB4jIntegrationTest.java | 6 +- ...mbeddedTomcatWithSSLConfigurationTest.java | 4 +- .../boot/tests/SpringBootServerLoginTest.java | 8 +- .../core/exception/MultiExceptionTest.java | 2 +- .../security/utils/SQLBuilderTest.java | 62 +- .../ReadTaxonomyMappingServiceImplTest.java | 14 +- .../mix/report/service/XBRLBuilderTest.java | 16 +- .../fineract/notification/ListenerTest.java | 12 +- .../fineract/notification/StorageTest.java | 18 +- .../fineract/notification/TopicTest.java | 10 +- ...ymentScheduleTransactionProcessorTest.java | 12 +- ...ymentScheduleTransactionProcessorTest.java | 12 +- .../template/TemplateMergeServiceTest.java | 8 +- 120 files changed, 2599 insertions(+), 2504 deletions(-) rename fineract-provider/src/test/java/org/apache/fineract/infrastructure/classdupes/{ClasspathHellDuplicatesCheckRule.java => ClasspathHellDuplicatesCheckExtension.java} (82%) diff --git a/README.md b/README.md index 61da0412e..57af875c1 100644 --- a/README.md +++ b/README.md @@ -311,7 +311,7 @@ If your PR is failing to pass our CI build due to a test failure, then: 1. If you suspect it is because of a "flaky" test, and not due to a change in your PR, then please do not simply wait for an active maintainer to come and help you, but instead be a proactive contributor to the project - see next steps. Do understand that we may not review PRs that are not green - it is the contributor's (that's you!) responsability to get a proposed PR to pass the build, not primarily the maintainers. 1. Search for the name of the failed test on https://issues.apache.org/jira/, e.g. for `AccountingScenarioIntegrationTest` you would find [FINERACT-899](https://issues.apache.org/jira/browse/FINERACT-899). 1. If you happen to read in such bugs that tests were just recently fixed, or ignored, then rebase your PR to pick up that change. -1. If you find previous comments "proving" that the same test has arbitrarily failed in at least 3 past PRs, then please do yourself raise a small separate new PR proposing to add an `@Ignore // TODO FINERACT-123` to the respective unstable test (e.g. [#774](https://github.com/apache/fineract/pull/774)) with the commit message mentioning said JIRA, as always. (Please do NOT just `@Ignore` any existing tests mixed in as part of your larger PR.) +1. If you find previous comments "proving" that the same test has arbitrarily failed in at least 3 past PRs, then please do yourself raise a small separate new PR proposing to add an `@Disabled // TODO FINERACT-123` to the respective unstable test (e.g. [#774](https://github.com/apache/fineract/pull/774)) with the commit message mentioning said JIRA, as always. (Please do NOT just `@Disabled` any existing tests mixed in as part of your larger PR.) 1. If there is no existing JIRA for the test, then first please evaluate whether the failure couldn't be a (perhaps strange) impact of the change you are proposing after all. If it's not, then please raise a new JIRA to document the suspected Flaky Test, and link it to [FINERACT-850](https://issues.apache.org/jira/browse/FINERACT-850). This will allow the next person coming along hitting the same test failure to easily find it, and eventually propose to ignore the unstable test. 1. Then (only) Close and Reopen your PR, which will cause a new build, to see if it passes. 1. Of course, we very much appreciate you then jumping onto any such bugs and helping us figure out how to fix all ignored tests! diff --git a/fineract-provider/build.gradle b/fineract-provider/build.gradle index 9ea26c0ad..9b31cca8b 100644 --- a/fineract-provider/build.gradle +++ b/fineract-provider/build.gradle @@ -105,8 +105,8 @@ dependencyManagement { dependency 'jakarta.xml.bind:jakarta.xml.bind-api:2.3.3' dependency 'org.apache.activemq:activemq-broker:5.15.13' dependency 'org.apache.bval:org.apache.bval.bundle:2.0.3' - dependency 'junit:junit:4.13' // TODO FINERACT-1018?? dependency 'org.mockito:mockito-core:3.3.3' + dependency 'org.mockito:mockito-junit-jupiter:3.3.3' dependency 'io.github.classgraph:classgraph:4.8.86' dependency 'org.awaitility:awaitility:4.0.3' dependency 'com.github.spotbugs:spotbugs-annotations:4.0.4' diff --git a/fineract-provider/dependencies.gradle b/fineract-provider/dependencies.gradle index 81ae52b25..5d77ed0d9 100644 --- a/fineract-provider/dependencies.gradle +++ b/fineract-provider/dependencies.gradle @@ -117,9 +117,8 @@ dependencies { // testCompile dependencies are ONLY used in src/test and/or src/integrationTest, not src/main. // Do NOT repeat dependencies which are ALREADY in implementation or runtimeOnly! // - testImplementation( 'junit:junit', - 'org.junit.platform:junit-platform-runner', // FINERACT-943 - 'org.mockito:mockito-core', + testImplementation( 'org.mockito:mockito-core', + 'org.mockito:mockito-junit-jupiter', 'io.github.classgraph:classgraph', 'org.awaitility:awaitility' ) @@ -129,5 +128,6 @@ dependencies { } testImplementation ('org.springframework.boot:spring-boot-starter-test') { exclude group: 'com.jayway.jsonpath', module: 'json-path' + exclude group: 'org.junit.vintage', module: 'junit-vintage-engine' } } diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/AccountNumberPreferencesTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/AccountNumberPreferencesTest.java index d236bde0b..299f4519a 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/AccountNumberPreferencesTest.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/AccountNumberPreferencesTest.java @@ -40,9 +40,9 @@ import org.apache.fineract.integrationtests.common.savings.SavingsAccountHelper; import org.apache.fineract.integrationtests.common.savings.SavingsProductHelper; import org.apache.fineract.integrationtests.common.system.AccountNumberPreferencesHelper; import org.apache.fineract.integrationtests.common.system.CodeHelper; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -88,7 +88,7 @@ public class AccountNumberPreferencesTest { private Integer centerId; private String groupAccountNo; - @Before + @BeforeEach public void setup() { Utils.initializeRESTAssured(); this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build(); @@ -159,7 +159,7 @@ public class AccountNumberPreferencesTest { HashMap deletionError = this.accountNumberPreferencesHelper.deleteAccountNumberPreference(10, this.responseNotFoundError, ""); - Assert.assertEquals("error.msg.resource.not.found", deletionError.get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE)); + Assertions.assertEquals("error.msg.resource.not.found", deletionError.get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE)); } private void validateDefaultAccountNumberGeneration() { @@ -216,7 +216,7 @@ public class AccountNumberPreferencesTest { HashMap creationError = this.accountNumberPreferencesHelper.createAccountNumberPreferenceWithInvalidData( this.responseForbiddenError, accountType, prefixType, ""); - Assert.assertEquals("error.msg.account.number.format.duplicate.account.type", + Assertions.assertEquals("error.msg.account.number.format.duplicate.account.type", creationError.get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE)); } @@ -231,11 +231,11 @@ public class AccountNumberPreferencesTest { if (creationError.get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE).equals( "validation.msg.accountNumberFormat.accountType.is.not.within.expected.range")) { - Assert.assertEquals("validation.msg.accountNumberFormat.accountType.is.not.within.expected.range", + Assertions.assertEquals("validation.msg.accountNumberFormat.accountType.is.not.within.expected.range", creationError.get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE)); } else if (creationError.get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE).equals( "validation.msg.accountNumberFormat.prefixType.is.not.one.of.expected.enumerations")) { - Assert.assertEquals("validation.msg.accountNumberFormat.prefixType.is.not.one.of.expected.enumerations", + Assertions.assertEquals("validation.msg.accountNumberFormat.prefixType.is.not.one.of.expected.enumerations", creationError.get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE)); } } @@ -257,13 +257,13 @@ public class AccountNumberPreferencesTest { HashMap updationError = this.accountNumberPreferencesHelper.updateAccountNumberPreference(9999, "101", this.responseNotFoundError, ""); if (updationError.get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE).equals("error.msg.resource.not.found")) { - Assert.assertEquals("error.msg.resource.not.found", updationError.get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE)); + Assertions.assertEquals("error.msg.resource.not.found", updationError.get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE)); } /* Invalid Prefix Type */ HashMap updationError1 = this.accountNumberPreferencesHelper.updateAccountNumberPreference( this.clientAccountNumberPreferenceId, "103", this.responseValidationError, ""); - Assert.assertEquals("validation.msg.validation.errors.exist", updationError1.get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE)); + Assertions.assertEquals("validation.msg.validation.errors.exist", updationError1.get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE)); } @@ -309,8 +309,8 @@ public class AccountNumberPreferencesTest { String name = "CenterCreation" + new Timestamp(new java.util.Date().getTime()); this.centerId = CenterHelper.createCenter(name, officeId, requestSpec, responseSpec); CenterDomain center = CenterHelper.retrieveByID(centerId, requestSpec, responseSpec); - Assert.assertNotNull(center); - Assert.assertTrue(center.getName().equals(name)); + Assertions.assertNotNull(center); + Assertions.assertTrue(center.getName().equals(name)); if (isAccountPreferenceSetUp) { String centerPrefixName = (String) this.accountNumberPreferencesHelper.getAccountNumberPreference( @@ -329,7 +329,7 @@ public class AccountNumberPreferencesTest { private void createAndValidateClientWithoutAccountPreference() { this.clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(this.clientId); + Assertions.assertNotNull(this.clientId); String clientAccountNo = (String) ClientHelper.getClient(requestSpec, responseSpec, this.clientId.toString(), "accountNo"); validateAccountNumberLengthAndStartsWithPrefix(clientAccountNo, null); } @@ -356,14 +356,14 @@ public class AccountNumberPreferencesTest { this.clientId = ClientHelper.createClientForAccountPreference(this.requestSpec, this.responseSpec, this.clientCodeValueId, "clientId"); - Assert.assertNotNull(clientId); + Assertions.assertNotNull(clientId); clientAccountNo = (String) ClientHelper.getClient(this.requestSpec, this.responseSpec, this.clientId.toString(), "accountNo"); this.validateAccountNumberLengthAndStartsWithPrefix(clientAccountNo, this.clientCodeValueName); } else if (clientPrefixName.equals(this.officeName)) { this.clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientId); + Assertions.assertNotNull(clientId); clientAccountNo = (String) ClientHelper.getClient(requestSpec, responseSpec, this.clientId.toString(), "accountNo"); String officeName = (String) ClientHelper.getClient(requestSpec, responseSpec, this.clientId.toString(), "officeName"); this.validateAccountNumberLengthAndStartsWithPrefix(clientAccountNo, officeName); @@ -373,10 +373,10 @@ public class AccountNumberPreferencesTest { private void validateAccountNumberLengthAndStartsWithPrefix(final String accountNumber, String prefix) { if (prefix != null) { prefix = prefix.substring(0, Math.min(prefix.length(), 10)); - Assert.assertEquals(accountNumber.length(), prefix.length() + 9); - Assert.assertTrue(accountNumber.startsWith(prefix)); + Assertions.assertEquals(accountNumber.length(), prefix.length() + 9); + Assertions.assertTrue(accountNumber.startsWith(prefix)); } else { - Assert.assertEquals(9, accountNumber.length()); + Assertions.assertEquals(9, accountNumber.length()); } } diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/AccountTransferTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/AccountTransferTest.java index 2e9ce9a6b..e8a38d431 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/AccountTransferTest.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/AccountTransferTest.java @@ -18,7 +18,7 @@ */ package org.apache.fineract.integrationtests; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import io.restassured.builder.RequestSpecBuilder; import io.restassured.builder.ResponseSpecBuilder; @@ -45,10 +45,10 @@ import org.apache.fineract.integrationtests.common.savings.AccountTransferHelper import org.apache.fineract.integrationtests.common.savings.SavingsAccountHelper; import org.apache.fineract.integrationtests.common.savings.SavingsProductHelper; import org.apache.fineract.integrationtests.common.savings.SavingsStatusChecker; -import org.junit.After; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -87,7 +87,7 @@ public class AccountTransferTest { private Integer financialActivityAccountId; private Account liabilityTransferAccount; - @Before + @BeforeEach public void setup() { Utils.initializeRESTAssured(); this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build(); @@ -102,13 +102,13 @@ public class AccountTransferTest { /** Setup liability transfer account **/ /** Create a Liability and an Asset Transfer Account **/ liabilityTransferAccount = accountHelper.createLiabilityAccount(); - Assert.assertNotNull(liabilityTransferAccount); + Assertions.assertNotNull(liabilityTransferAccount); /*** Create A Financial Activity to Account Mapping **/ financialActivityAccountId = (Integer) financialActivityAccountHelper.createFinancialActivityAccount( FinancialActivityAccountsTest.LIABILITY_TRANSFER_FINANCIAL_ACTIVITY_ID, liabilityTransferAccount.getAccountID(), responseSpec, CommonConstants.RESPONSE_RESOURCE_ID); - Assert.assertNotNull(financialActivityAccountId); + Assertions.assertNotNull(financialActivityAccountId); } else { for (HashMap financialActivity : financialActivities) { HashMap financialActivityData = (HashMap) financialActivity.get("financialActivityData"); @@ -125,12 +125,12 @@ public class AccountTransferTest { /** * Delete the Liability transfer account */ - @After + @AfterEach public void tearDown() { Integer deletedFinancialActivityAccountId = financialActivityAccountHelper.deleteFinancialActivityAccount( financialActivityAccountId, responseSpec, CommonConstants.RESPONSE_RESOURCE_ID); - Assert.assertNotNull(deletedFinancialActivityAccountId); - Assert.assertEquals(financialActivityAccountId, deletedFinancialActivityAccountId); + Assertions.assertNotNull(deletedFinancialActivityAccountId); + Assertions.assertEquals(financialActivityAccountId, deletedFinancialActivityAccountId); } @Test @@ -145,20 +145,20 @@ public class AccountTransferTest { OfficeHelper officeHelper = new OfficeHelper(this.requestSpec, this.responseSpec); Integer toOfficeId = officeHelper.createOffice("01 January 2011"); - Assert.assertNotNull(toOfficeId); + Assertions.assertNotNull(toOfficeId); // Creating Savings Account to which fund to be Transferred final Integer toClientID = ClientHelper.createClient(this.requestSpec, this.responseSpec, "01 January 2011", String.valueOf(toOfficeId)); - Assert.assertNotNull(toClientID); + Assertions.assertNotNull(toClientID); final Integer toSavingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE, assetAccount, incomeAccount, expenseAccount, liabilityAccount); - Assert.assertNotNull(toSavingsProductID); + Assertions.assertNotNull(toSavingsProductID); final Integer toSavingsID = this.savingsAccountHelper.applyForSavingsApplication(toClientID, toSavingsProductID, ACCOUNT_TYPE_INDIVIDUAL); - Assert.assertNotNull(toSavingsProductID); + Assertions.assertNotNull(toSavingsProductID); HashMap toSavingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, toSavingsID); SavingsStatusChecker.verifySavingsIsPending(toSavingsStatusHashMap); @@ -172,20 +172,20 @@ public class AccountTransferTest { final HashMap toSavingsSummaryBefore = this.savingsAccountHelper.getSavingsSummary(toSavingsID); Integer fromOfficeId = officeHelper.createOffice("01 January 2011"); - Assert.assertNotNull(fromOfficeId); + Assertions.assertNotNull(fromOfficeId); // Creating Savings Account from which the Fund has to be Transferred final Integer fromClientID = ClientHelper.createClient(this.requestSpec, this.responseSpec, "01 January 2011", String.valueOf(fromOfficeId)); - Assert.assertNotNull(fromClientID); + Assertions.assertNotNull(fromClientID); final Integer fromSavingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE, assetAccount, incomeAccount, expenseAccount, liabilityAccount); - Assert.assertNotNull(fromSavingsProductID); + Assertions.assertNotNull(fromSavingsProductID); final Integer fromSavingsID = this.savingsAccountHelper.applyForSavingsApplication(fromClientID, fromSavingsProductID, ACCOUNT_TYPE_INDIVIDUAL); - Assert.assertNotNull(fromSavingsID); + Assertions.assertNotNull(fromSavingsID); HashMap fromSavingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, fromSavingsID); SavingsStatusChecker.verifySavingsIsPending(fromSavingsStatusHashMap); @@ -208,12 +208,12 @@ public class AccountTransferTest { toSavingsBalance += Float.valueOf(ACCOUNT_TRANSFER_AMOUNT); HashMap fromSavingsSummaryAfter = this.savingsAccountHelper.getSavingsSummary(fromSavingsID); - assertEquals("Verifying From Savings Account Balance after Account Transfer", fromSavingsBalance, - fromSavingsSummaryAfter.get("accountBalance")); + assertEquals(fromSavingsBalance, fromSavingsSummaryAfter.get("accountBalance"), + "Verifying From Savings Account Balance after Account Transfer"); HashMap toSavingsSummaryAfter = this.savingsAccountHelper.getSavingsSummary(toSavingsID); - assertEquals("Verifying To Savings Account Balance after Account Transfer", toSavingsBalance, - toSavingsSummaryAfter.get("accountBalance")); + assertEquals(toSavingsBalance, toSavingsSummaryAfter.get("accountBalance"), + "Verifying To Savings Account Balance after Account Transfer"); final JournalEntry[] office1LiabilityEntries = { new JournalEntry(Float.valueOf(ACCOUNT_TRANSFER_AMOUNT), JournalEntry.TransactionType.CREDIT) }; final JournalEntry[] office2LiabilityEntries = { new JournalEntry(Float.valueOf(ACCOUNT_TRANSFER_AMOUNT), @@ -244,21 +244,21 @@ public class AccountTransferTest { OfficeHelper officeHelper = new OfficeHelper(this.requestSpec, this.responseSpec); Integer toOfficeId = officeHelper.createOffice("01 January 2011"); - Assert.assertNotNull(toOfficeId); + Assertions.assertNotNull(toOfficeId); // Creating Loan Account to which fund to be Transferred final Integer toClientID = ClientHelper.createClient(this.requestSpec, this.responseSpec, "01 January 2011", String.valueOf(toOfficeId)); - Assert.assertNotNull(toClientID); + Assertions.assertNotNull(toClientID); Account toTransferAccount = accountHelper.createLiabilityAccount(); - Assert.assertNotNull(toTransferAccount); + Assertions.assertNotNull(toTransferAccount); final Integer toLoanProductID = createLoanProduct(loanAssetAccount, loanIncomeAccount, loanExpenseAccount, overpaymentAccount); - Assert.assertNotNull(toLoanProductID); + Assertions.assertNotNull(toLoanProductID); final Integer toLoanID = applyForLoanApplication(toClientID, toLoanProductID); - Assert.assertNotNull(toLoanID); + Assertions.assertNotNull(toLoanID); HashMap toLoanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, toLoanID); LoanStatusChecker.verifyLoanIsPending(toLoanStatusHashMap); @@ -270,20 +270,20 @@ public class AccountTransferTest { LoanStatusChecker.verifyLoanIsActive(toLoanStatusHashMap); Integer fromOfficeId = officeHelper.createOffice("01 January 2011"); - Assert.assertNotNull(fromOfficeId); + Assertions.assertNotNull(fromOfficeId); // Creating Savings Account from which the Fund has to be Transferred final Integer fromClientID = ClientHelper.createClient(this.requestSpec, this.responseSpec, "01 January 2011", String.valueOf(fromOfficeId)); - Assert.assertNotNull(fromClientID); + Assertions.assertNotNull(fromClientID); final Integer fromSavingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE, assetAccount, incomeAccount, expenseAccount, liabilityAccount); - Assert.assertNotNull(fromSavingsProductID); + Assertions.assertNotNull(fromSavingsProductID); final Integer fromSavingsID = this.savingsAccountHelper.applyForSavingsApplication(fromClientID, fromSavingsProductID, ACCOUNT_TYPE_INDIVIDUAL); - Assert.assertNotNull(fromSavingsID); + Assertions.assertNotNull(fromSavingsID); HashMap fromSavingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, fromSavingsID); SavingsStatusChecker.verifySavingsIsPending(fromSavingsStatusHashMap); @@ -304,12 +304,12 @@ public class AccountTransferTest { fromSavingsBalance -= TRANSFER_AMOUNT_ADJUST; HashMap fromSavingsSummaryAfter = this.savingsAccountHelper.getSavingsSummary(fromSavingsID); - assertEquals("Verifying From Savings Account Balance after Account Transfer", fromSavingsBalance, - fromSavingsSummaryAfter.get("accountBalance")); + assertEquals(fromSavingsBalance, fromSavingsSummaryAfter.get("accountBalance"), + "Verifying From Savings Account Balance after Account Transfer"); HashMap toLoanSummaryAfter = this.loanTransactionHelper.getLoanSummary(requestSpec, responseSpec, toLoanID); - assertEquals("Verifying To Loan Repayment Amount after Account Transfer", TRANSFER_AMOUNT_ADJUST, - toLoanSummaryAfter.get("totalRepayment")); + assertEquals(TRANSFER_AMOUNT_ADJUST, toLoanSummaryAfter.get("totalRepayment"), + "Verifying To Loan Repayment Amount after Account Transfer"); final JournalEntry[] office1LiabilityEntries = { new JournalEntry(Float.valueOf(ACCOUNT_TRANSFER_AMOUNT_ADJUST), JournalEntry.TransactionType.CREDIT) }; @@ -340,20 +340,20 @@ public class AccountTransferTest { OfficeHelper officeHelper = new OfficeHelper(this.requestSpec, this.responseSpec); Integer toOfficeId = officeHelper.createOffice("01 January 2011"); - Assert.assertNotNull(toOfficeId); + Assertions.assertNotNull(toOfficeId); // Creating Loan Account to which fund to be Transferred final Integer toClientID = ClientHelper.createClient(this.requestSpec, this.responseSpec, "01 January 2011", String.valueOf(toOfficeId)); - Assert.assertNotNull(toClientID); + Assertions.assertNotNull(toClientID); final Integer toSavingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE, assetAccount, incomeAccount, expenseAccount, liabilityAccount); - Assert.assertNotNull(toSavingsProductID); + Assertions.assertNotNull(toSavingsProductID); final Integer toSavingsID = this.savingsAccountHelper.applyForSavingsApplication(toClientID, toSavingsProductID, ACCOUNT_TYPE_INDIVIDUAL); - Assert.assertNotNull(toSavingsID); + Assertions.assertNotNull(toSavingsID); HashMap toSavingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, toSavingsID); SavingsStatusChecker.verifySavingsIsPending(toSavingsStatusHashMap); @@ -365,18 +365,18 @@ public class AccountTransferTest { SavingsStatusChecker.verifySavingsIsActive(toSavingsStatusHashMap); Integer fromOfficeId = officeHelper.createOffice("01 January 2011"); - Assert.assertNotNull(fromOfficeId); + Assertions.assertNotNull(fromOfficeId); // Creating Savings Account from which the Fund has to be Transferred final Integer fromClientID = ClientHelper.createClient(this.requestSpec, this.responseSpec, "01 January 2011", String.valueOf(fromOfficeId)); - Assert.assertNotNull(fromClientID); + Assertions.assertNotNull(fromClientID); final Integer loanProductID = createLoanProduct(loanAssetAccount, loanIncomeAccount, loanExpenseAccount, overpaymentAccount); - Assert.assertNotNull(loanProductID); + Assertions.assertNotNull(loanProductID); final Integer loanID = applyForLoanApplication(fromClientID, loanProductID); - Assert.assertNotNull(loanID); + Assertions.assertNotNull(loanID); HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID); LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap); @@ -389,11 +389,11 @@ public class AccountTransferTest { final Integer fromSavingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE, assetAccount, incomeAccount, expenseAccount, liabilityAccount); - Assert.assertNotNull(fromSavingsProductID); + Assertions.assertNotNull(fromSavingsProductID); final Integer fromSavingsID = this.savingsAccountHelper.applyForSavingsApplication(fromClientID, fromSavingsProductID, ACCOUNT_TYPE_INDIVIDUAL); - Assert.assertNotNull(fromSavingsID); + Assertions.assertNotNull(fromSavingsID); HashMap fromSavingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, fromSavingsID); SavingsStatusChecker.verifySavingsIsPending(fromSavingsStatusHashMap); @@ -416,8 +416,8 @@ public class AccountTransferTest { HashMap fromSavingsSummaryAfter = this.savingsAccountHelper.getSavingsSummary(fromSavingsID); // Verifying fromSavings Account Balance after Account Transfer - assertEquals("Verifying From Savings Account Balance after Account Transfer", fromSavingsBalance, - fromSavingsSummaryAfter.get("accountBalance")); + assertEquals(fromSavingsBalance, fromSavingsSummaryAfter.get("accountBalance"), + "Verifying From Savings Account Balance after Account Transfer"); Float toSavingsBalance = Float.valueOf(MINIMUM_OPENING_BALANCE); @@ -429,8 +429,8 @@ public class AccountTransferTest { HashMap toSavingsSummaryAfter = this.savingsAccountHelper.getSavingsSummary(toSavingsID); // Verifying toSavings Account Balance after Account Transfer - assertEquals("Verifying From Savings Account Balance after Account Transfer", toSavingsBalance, - toSavingsSummaryAfter.get("accountBalance")); + assertEquals(toSavingsBalance, toSavingsSummaryAfter.get("accountBalance"), + "Verifying From Savings Account Balance after Account Transfer"); final JournalEntry[] office1LiabilityEntries = { new JournalEntry(Float.valueOf(ACCOUNT_TRANSFER_AMOUNT_ADJUST), JournalEntry.TransactionType.CREDIT) }; diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/AccountingScenarioIntegrationTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/AccountingScenarioIntegrationTest.java index b16a866bc..bef78f27e 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/AccountingScenarioIntegrationTest.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/AccountingScenarioIntegrationTest.java @@ -18,7 +18,7 @@ */ package org.apache.fineract.integrationtests; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import io.restassured.builder.RequestSpecBuilder; import io.restassured.builder.ResponseSpecBuilder; @@ -60,9 +60,9 @@ import org.apache.fineract.integrationtests.common.savings.SavingsProductHelper; import org.apache.fineract.integrationtests.common.savings.SavingsStatusChecker; import org.joda.time.Days; import org.joda.time.LocalDate; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -109,7 +109,7 @@ public class AccountingScenarioIntegrationTest { private SchedulerJobHelper schedulerJobHelper; private PeriodicAccrualAccountingHelper periodicAccrualAccountingHelper; - @Before + @BeforeEach public void setup() { Utils.initializeRESTAssured(); this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build(); @@ -282,7 +282,7 @@ public class AccountingScenarioIntegrationTest { CommonConstants.RESPONSE_RESOURCE_ID); Float balance = SP_BALANCE + SP_DEPOSIT_AMOUNT; HashMap summary = this.savingsAccountHelper.getSavingsSummary(savingsID); - assertEquals("Verifying Balance after Deposit", balance, summary.get("accountBalance")); + assertEquals(balance, summary.get("accountBalance"), "Verifying Balance after Deposit"); LOG.info("----------------------Verifying Journal Entry after the Transaction Deposit----------------------------"); final JournalEntry[] assetAccountFirstTransactionEntry = { new JournalEntry(this.SP_DEPOSIT_AMOUNT, @@ -298,7 +298,7 @@ public class AccountingScenarioIntegrationTest { CommonConstants.RESPONSE_RESOURCE_ID); balance -= SP_WITHDRAWAL_AMOUNT; summary = this.savingsAccountHelper.getSavingsSummary(savingsID); - assertEquals("Verifying Balance after Withdrawal", balance, summary.get("accountBalance")); + assertEquals(balance, summary.get("accountBalance"), "Verifying Balance after Withdrawal"); LOG.info("-------------------Verifying Journal Entry after the Transaction Withdrawal----------------------"); final JournalEntry[] assetAccountSecondTransactionEntry = { new JournalEntry(this.SP_WITHDRAWAL_AMOUNT, @@ -312,11 +312,11 @@ public class AccountingScenarioIntegrationTest { // Third Transaction-Add Charges for Withdrawal Fee final Integer withdrawalChargeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec, ChargesHelper.getSavingsWithdrawalFeeJSON()); - Assert.assertNotNull(withdrawalChargeId); + Assertions.assertNotNull(withdrawalChargeId); this.savingsAccountHelper.addChargesForSavings(savingsID, withdrawalChargeId, false); ArrayList chargesPendingState = this.savingsAccountHelper.getSavingsCharges(savingsID); - Assert.assertEquals(1, chargesPendingState.size()); + Assertions.assertEquals(1, chargesPendingState.size()); HashMap savingsChargeForPay = chargesPendingState.get(0); HashMap paidCharge = this.savingsAccountHelper.getSavingsCharge(savingsID, (Integer) savingsChargeForPay.get("id")); Float chargeAmount = (Float) paidCharge.get("amount"); @@ -339,7 +339,7 @@ public class AccountingScenarioIntegrationTest { this.journalEntryHelper.checkJournalEntryForIncomeAccount(incomeAccount, this.TRANSACTION_DATE, incomeAccountThirdTransactionEntry); // Verifying Balance after applying Charge for Withdrawal Fee - assertEquals("Verifying Balance", balance, summary.get("accountBalance")); + assertEquals(balance, summary.get("accountBalance"), "Verifying Balance"); } @Test @@ -376,15 +376,15 @@ public class AccountingScenarioIntegrationTest { final Account liabilityAccount = this.accountHelper.createLiabilityAccount(); Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientId); + Assertions.assertNotNull(clientId); Integer fixedDepositProductId = createFixedDepositProduct(VALID_FROM, VALID_TO, assetAccount, incomeAccount, expenseAccount, liabilityAccount); - Assert.assertNotNull(fixedDepositProductId); + Assertions.assertNotNull(fixedDepositProductId); Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), VALID_FROM, VALID_TO, SUBMITTED_ON_DATE, FixedDepositTest.WHOLE_TERM); - Assert.assertNotNull(fixedDepositAccountId); + Assertions.assertNotNull(fixedDepositAccountId); HashMap fixedDepositAccountStatusHashMap = FixedDepositAccountStatusChecker.getStatusOfFixedDepositAccount(this.requestSpec, this.responseSpec, fixedDepositAccountId.toString()); @@ -407,7 +407,7 @@ public class AccountingScenarioIntegrationTest { this.journalEntryHelper.checkJournalEntryForLiabilityAccount(liabilityAccount, ACTIVATION_DATE, liablilityAccountInitialEntry); Integer transactionIdForPostInterest = this.fixedDepositAccountHelper.postInterestForFixedDeposit(fixedDepositAccountId); - Assert.assertNotNull(transactionIdForPostInterest); + Assertions.assertNotNull(transactionIdForPostInterest); accountSummary = this.fixedDepositAccountHelper.getFixedDepositSummary(fixedDepositAccountId); Float totalInterestPosted = (Float) accountSummary.get("totalInterestPosted"); @@ -454,15 +454,15 @@ public class AccountingScenarioIntegrationTest { final String INTEREST_POSTED_DATE = dateFormat.format(todaysDate.getTime()); Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientId); + Assertions.assertNotNull(clientId); Integer recurringDepositProductId = createRecurringDepositProduct(VALID_FROM, VALID_TO, assetAccount, liabilityAccount, incomeAccount, expenseAccount); - Assert.assertNotNull(recurringDepositProductId); + Assertions.assertNotNull(recurringDepositProductId); Integer recurringDepositAccountId = applyForRecurringDepositApplication(clientId.toString(), recurringDepositProductId.toString(), VALID_FROM, VALID_TO, SUBMITTED_ON_DATE, RecurringDepositTest.WHOLE_TERM, EXPECTED_FIRST_DEPOSIT_ON_DATE); - Assert.assertNotNull(recurringDepositAccountId); + Assertions.assertNotNull(recurringDepositAccountId); HashMap recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker.getStatusOfRecurringDepositAccount( this.requestSpec, this.responseSpec, recurringDepositAccountId.toString()); @@ -482,7 +482,7 @@ public class AccountingScenarioIntegrationTest { Integer depositTransactionId = this.recurringDepositAccountHelper.depositToRecurringDepositAccount(recurringDepositAccountId, depositAmount, EXPECTED_FIRST_DEPOSIT_ON_DATE); - Assert.assertNotNull(depositTransactionId); + Assertions.assertNotNull(depositTransactionId); // Checking initial Journal entries after Activation. final JournalEntry[] assetAccountInitialEntry = { new JournalEntry(depositAmount, JournalEntry.TransactionType.DEBIT) }; @@ -493,7 +493,7 @@ public class AccountingScenarioIntegrationTest { Integer interestPostingTransactionId = this.recurringDepositAccountHelper .postInterestForRecurringDeposit(recurringDepositAccountId); - Assert.assertNotNull(interestPostingTransactionId); + Assertions.assertNotNull(interestPostingTransactionId); HashMap accountSummary = this.recurringDepositAccountHelper.getRecurringDepositSummary(recurringDepositAccountId); Float totalInterestPosted = (Float) accountSummary.get("totalInterestPosted"); diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/ActuatorIntegrationTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/ActuatorIntegrationTest.java index 48219f873..d23ecae49 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/ActuatorIntegrationTest.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/ActuatorIntegrationTest.java @@ -19,13 +19,13 @@ package org.apache.fineract.integrationtests; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; import io.restassured.RestAssured; import io.restassured.http.ContentType; import io.restassured.response.Response; import java.util.Map; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class ActuatorIntegrationTest { diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/ApiDocsTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/ApiDocsTest.java index 3faaffd1a..c1b169ed0 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/ApiDocsTest.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/ApiDocsTest.java @@ -24,15 +24,15 @@ import io.restassured.http.ContentType; import io.restassured.specification.RequestSpecification; import io.restassured.specification.ResponseSpecification; import org.apache.fineract.integrationtests.common.Utils; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class ApiDocsTest { private ResponseSpecification responseSpec; private RequestSpecification requestSpec; - @Before + @BeforeEach public void setup() { Utils.initializeRESTAssured(); this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build(); diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/BatchApiTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/BatchApiTest.java index 28d0a8c8f..4fe193428 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/BatchApiTest.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/BatchApiTest.java @@ -36,9 +36,9 @@ import org.apache.fineract.integrationtests.common.Utils; import org.apache.fineract.integrationtests.common.loans.LoanProductTestBuilder; import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper; import org.apache.fineract.integrationtests.common.savings.SavingsProductHelper; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; /** * Test class for @@ -62,9 +62,9 @@ public class BatchApiTest { /** * Sets up the essential settings for the TEST like contentType, - * expectedStatusCode. It uses the '@Before' annotation provided by jUnit. + * expectedStatusCode. It uses the '@BeforeEach' annotation provided by jUnit. */ - @Before + @BeforeEach public void setup() { Utils.initializeRESTAssured(); @@ -92,7 +92,7 @@ public class BatchApiTest { // Verify that only 501 is returned as the status code for (BatchResponse resp : response) { - Assert.assertEquals("Verify Status code 501", (long) 501, (long) resp.getStatusCode()); + Assertions.assertEquals((long) 501, (long) resp.getStatusCode(), "Verify Status code 501"); } } @@ -112,7 +112,7 @@ public class BatchApiTest { // Verify that a 200 response is returned as the status code for (BatchResponse resp : response) { - Assert.assertEquals("Verify Status code 200", (long) 200, (long) resp.getStatusCode()); + Assertions.assertEquals((long) 200, (long) resp.getStatusCode(), "Verify Status code 200"); } } @@ -155,8 +155,8 @@ public class BatchApiTest { BatchHelper.verifyClientCreatedOnServer(this.requestSpec, this.responseSpec, "TestExtId12"); // Asserts that all the transactions have been successfully rolled back - Assert.assertEquals(1, response.size()); - Assert.assertEquals("Verify Status code 400", (long) 400, (long) response.get(0).getStatusCode()); + Assertions.assertEquals(1, response.size()); + Assertions.assertEquals((long) 400, (long) response.get(0).getStatusCode(), "Verify Status code 400"); } /** @@ -189,8 +189,8 @@ public class BatchApiTest { final JsonObject changes = new FromJsonHelper().parse(response.get(1).getBody()).getAsJsonObject().get("changes").getAsJsonObject(); // Asserts the client information is successfully updated - Assert.assertEquals("Verify Firstname", "TestFirstName", changes.get("firstname").getAsString()); - Assert.assertEquals("Verify Lastname", "TestLastName", changes.get("lastname").getAsString()); + Assertions.assertEquals("Verify Firstname", "TestFirstName", changes.get("firstname").getAsString()); + Assertions.assertEquals("Verify Lastname", "TestLastName", changes.get("lastname").getAsString()); } /** @@ -240,7 +240,7 @@ public class BatchApiTest { // Get the clientId parameter from createClient Response final JsonElement clientId = new FromJsonHelper().parse(response.get(0).getBody()).getAsJsonObject().get("clientId"); - Assert.assertEquals("Verify Status Code 200" + clientId.getAsString(), 200L, (long) response.get(1).getStatusCode()); + Assertions.assertEquals(200L, (long) response.get(1).getStatusCode(), "Verify Status Code 200" + clientId.getAsString()); } /** @@ -282,7 +282,7 @@ public class BatchApiTest { final List response = BatchHelper.postBatchRequestsWithoutEnclosingTransaction(this.requestSpec, this.responseSpec, jsonifiedRequest); - Assert.assertEquals("Verify Status Code 200", 200L, (long) response.get(1).getStatusCode()); + Assertions.assertEquals(200L, (long) response.get(1).getStatusCode(), "Verify Status Code 200"); } /** @@ -334,7 +334,7 @@ public class BatchApiTest { final List response = BatchHelper.postBatchRequestsWithoutEnclosingTransaction(this.requestSpec, this.responseSpec, jsonifiedRequest); - Assert.assertEquals("Verify Status Code 200 for Create Loan Charge", 200L, (long) response.get(3).getStatusCode()); + Assertions.assertEquals(200L, (long) response.get(3).getStatusCode(), "Verify Status Code 200 for Create Loan Charge"); } /** @@ -397,8 +397,8 @@ public class BatchApiTest { final List response = BatchHelper.postBatchRequestsWithoutEnclosingTransaction(this.requestSpec, this.responseSpec, jsonifiedRequest); - Assert.assertEquals("Verify Status Code 200 for Repayment", 200L, (long) response.get(5).getStatusCode()); - Assert.assertEquals("Verify Status Code 200 for Repayment", 200L, (long) response.get(6).getStatusCode()); + Assertions.assertEquals(200L, (long) response.get(5).getStatusCode(), "Verify Status Code 200 for Repayment"); + Assertions.assertEquals(200L, (long) response.get(6).getStatusCode(), "Verify Status Code 200 for Repayment"); } /** @@ -427,8 +427,8 @@ public class BatchApiTest { final List response = BatchHelper.postBatchRequestsWithoutEnclosingTransaction(this.requestSpec, this.responseSpec, jsonifiedRequest); - Assert.assertEquals("Verify Status Code 200 for Create Client", 200L, (long) response.get(0).getStatusCode()); - Assert.assertEquals("Verify Status Code 200 for Activate Client", 200L, (long) response.get(1).getStatusCode()); + Assertions.assertEquals(200L, (long) response.get(0).getStatusCode(), "Verify Status Code 200 for Create Client"); + Assertions.assertEquals(200L, (long) response.get(1).getStatusCode(), "Verify Status Code 200 for Activate Client"); } /** @@ -482,8 +482,8 @@ public class BatchApiTest { final List response = BatchHelper.postBatchRequestsWithoutEnclosingTransaction(this.requestSpec, this.responseSpec, jsonifiedRequest); - Assert.assertEquals("Verify Status Code 200 for Approve Loan", 200L, (long) response.get(3).getStatusCode()); - Assert.assertEquals("Verify Status Code 200 for Disburse Loan", 200L, (long) response.get(4).getStatusCode()); + Assertions.assertEquals(200L, (long) response.get(3).getStatusCode(), "Verify Status Code 200 for Approve Loan"); + Assertions.assertEquals(200L, (long) response.get(4).getStatusCode(), "Verify Status Code 200 for Disburse Loan"); } /** @@ -527,9 +527,9 @@ public class BatchApiTest { final List response = BatchHelper.postBatchRequestsWithEnclosingTransaction(this.requestSpec, this.responseSpec, jsonifiedRequest); - Assert.assertEquals("Verify Status Code 200 for create client", 200L, (long) response.get(0).getStatusCode()); - Assert.assertEquals("Verify Status Code 200 for apply Loan", 200L, (long) response.get(1).getStatusCode()); - Assert.assertEquals("Verify Status Code 200 for approve Loan", 200L, (long) response.get(2).getStatusCode()); - Assert.assertEquals("Verify Status Code 200 for disburse Loan", 200L, (long) response.get(3).getStatusCode()); + Assertions.assertEquals(200L, (long) response.get(0).getStatusCode(), "Verify Status Code 200 for create client"); + Assertions.assertEquals(200L, (long) response.get(1).getStatusCode(), "Verify Status Code 200 for apply Loan"); + Assertions.assertEquals(200L, (long) response.get(2).getStatusCode(), "Verify Status Code 200 for approve Loan"); + Assertions.assertEquals(200L, (long) response.get(3).getStatusCode(), "Verify Status Code 200 for disburse Loan"); } } diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/BatchRequestsIntegrationTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/BatchRequestsIntegrationTest.java index d812a5b80..f3709ef55 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/BatchRequestsIntegrationTest.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/BatchRequestsIntegrationTest.java @@ -33,9 +33,9 @@ import org.apache.fineract.integrationtests.common.GroupHelper; import org.apache.fineract.integrationtests.common.Utils; import org.apache.fineract.integrationtests.common.loans.LoanProductTestBuilder; import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -58,9 +58,9 @@ public class BatchRequestsIntegrationTest { /** * Sets up the essential settings for the TEST like contentType, - * expectedStatusCode. It uses the '@Before' annotation provided by jUnit. + * expectedStatusCode. It uses the '@BeforeEach' annotation provided by jUnit. */ - @Before + @BeforeEach public void setup() { Utils.initializeRESTAssured(); @@ -135,7 +135,7 @@ public class BatchRequestsIntegrationTest { // Verify that each loan has been applied successfully for (BatchResponse res : response) { - Assert.assertEquals("Verify Status Code 200", 200L, (long) res.getStatusCode()); + Assertions.assertEquals(200L, (long) res.getStatusCode(), "Verify Status Code 200"); } } } diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/CenterIntegrationTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/CenterIntegrationTest.java index a1c914311..d38e32856 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/CenterIntegrationTest.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/CenterIntegrationTest.java @@ -18,7 +18,7 @@ */ package org.apache.fineract.integrationtests; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import com.google.gson.Gson; import io.restassured.builder.RequestSpecBuilder; @@ -35,9 +35,9 @@ import org.apache.fineract.integrationtests.common.CenterHelper; import org.apache.fineract.integrationtests.common.OfficeHelper; import org.apache.fineract.integrationtests.common.Utils; import org.apache.fineract.integrationtests.common.organisation.StaffHelper; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -46,7 +46,7 @@ public class CenterIntegrationTest { private RequestSpecification requestSpec; private ResponseSpecification responseSpec; - @Before + @BeforeEach public void setup() { Utils.initializeRESTAssured(); this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build(); @@ -62,20 +62,20 @@ public class CenterIntegrationTest { int resourceId = CenterHelper.createCenter(name, officeId, requestSpec, responseSpec); CenterDomain center = CenterHelper.retrieveByID(resourceId, requestSpec, responseSpec); - Assert.assertNotNull(center); - Assert.assertTrue(center.getName().equals(name)); - Assert.assertTrue(center.getOfficeId() == officeId); - Assert.assertTrue(center.isActive() == false); + Assertions.assertNotNull(center); + Assertions.assertTrue(center.getName().equals(name)); + Assertions.assertTrue(center.getOfficeId() == officeId); + Assertions.assertTrue(center.isActive() == false); // Test retrieval by listing all centers int id = CenterHelper.listCenters(requestSpec, responseSpec).get(0).getId(); - Assert.assertTrue(id > 0); + Assertions.assertTrue(id > 0); CenterDomain retrievedCenter = CenterHelper.retrieveByID(id, requestSpec, responseSpec); - Assert.assertNotNull(retrievedCenter); - Assert.assertNotNull(retrievedCenter.getName()); - Assert.assertNotNull(retrievedCenter.getHierarchy()); - Assert.assertNotNull(retrievedCenter.getOfficeName()); + Assertions.assertNotNull(retrievedCenter); + Assertions.assertNotNull(retrievedCenter.getName()); + Assertions.assertNotNull(retrievedCenter.getHierarchy()); + Assertions.assertNotNull(retrievedCenter.getOfficeName()); } @@ -90,13 +90,13 @@ public class CenterIntegrationTest { int resourceId = CenterHelper.createCenter(name, officeId, externalId, staffId, groupMembers, requestSpec, responseSpec); CenterDomain center = CenterHelper.retrieveByID(resourceId, requestSpec, responseSpec); - Assert.assertNotNull(center); - Assert.assertTrue(center.getName().equals(name)); - Assert.assertTrue(center.getOfficeId() == officeId); - Assert.assertTrue(center.getExternalId().equals(externalId)); - Assert.assertTrue(center.getStaffId() == staffId); - Assert.assertTrue(center.isActive() == false); - Assert.assertArrayEquals(center.getGroupMembers(), groupMembers); + Assertions.assertNotNull(center); + Assertions.assertTrue(center.getName().equals(name)); + Assertions.assertTrue(center.getOfficeId() == officeId); + Assertions.assertTrue(center.getExternalId().equals(externalId)); + Assertions.assertTrue(center.getStaffId() == staffId); + Assertions.assertTrue(center.isActive() == false); + Assertions.assertArrayEquals(center.getGroupMembers(), groupMembers); } @Test @@ -104,9 +104,9 @@ public class CenterIntegrationTest { ArrayList paginatedList = CenterHelper.paginatedListCenters(requestSpec, responseSpec); ArrayList list = CenterHelper.listCenters(requestSpec, responseSpec); - Assert.assertNotNull(paginatedList); - Assert.assertNotNull(list); - Assert.assertTrue(Arrays.equals(paginatedList.toArray(new CenterDomain[paginatedList.size()]), + Assertions.assertNotNull(paginatedList); + Assertions.assertNotNull(list); + Assertions.assertTrue(Arrays.equals(paginatedList.toArray(new CenterDomain[paginatedList.size()]), list.toArray(new CenterDomain[list.size()]))); } @@ -116,7 +116,7 @@ public class CenterIntegrationTest { int id = arr.get(arr.size() - 1).getId() + 1; ResponseSpecification responseSpec = new ResponseSpecBuilder().expectStatusCode(404).build(); CenterDomain center = CenterHelper.retrieveByID(id, requestSpec, responseSpec); - Assert.assertNotNull(center); + Assertions.assertNotNull(center); } @SuppressWarnings({ "rawtypes", "unchecked" }) @@ -137,7 +137,7 @@ public class CenterIntegrationTest { int[] associateResponse = CenterHelper.associateGroups(resourceId, associateGroupMembers, requestSpec, responseSpec); Arrays.sort(associateResponse); Arrays.sort(associateGroupMembers); - Assert.assertArrayEquals(associateResponse, associateGroupMembers); + Assertions.assertArrayEquals(associateResponse, associateGroupMembers); int[] newGroupMembers = new int[5]; for (int i = 0; i < 5; i++) { @@ -153,17 +153,17 @@ public class CenterIntegrationTest { request.put("externalId", newExternalId); request.put("staffId", newStaffId); HashMap response = CenterHelper.updateCenter(resourceId, request, requestSpec, responseSpec); - Assert.assertNotNull(response); - Assert.assertEquals(newName, response.get("name")); - Assert.assertEquals(newExternalId, response.get("externalId")); - Assert.assertEquals(Integer.valueOf(newStaffId), Integer.valueOf(response.get("staffId").toString())); + Assertions.assertNotNull(response); + Assertions.assertEquals(newName, response.get("name")); + Assertions.assertEquals(newExternalId, response.get("externalId")); + Assertions.assertEquals(Integer.valueOf(newStaffId), Integer.valueOf(response.get("staffId").toString())); CenterDomain center = CenterHelper.retrieveByID(resourceId, requestSpec, responseSpec); - Assert.assertNotNull(center); - Assert.assertEquals(newName, center.getName()); - Assert.assertEquals(newExternalId, center.getExternalId()); - Assert.assertEquals((Integer)newStaffId, center.getStaffId()); - Assert.assertArrayEquals(newGroupMembers, center.getGroupMembers()); + Assertions.assertNotNull(center); + Assertions.assertEquals(newName, center.getName()); + Assertions.assertEquals(newExternalId, center.getExternalId()); + Assertions.assertEquals((Integer)newStaffId, center.getStaffId()); + Assertions.assertArrayEquals(newGroupMembers, center.getGroupMembers()); } @Test @@ -175,7 +175,7 @@ public class CenterIntegrationTest { CenterHelper.deleteCenter(resourceId, requestSpec, responseSpec); ResponseSpecification responseSpec = new ResponseSpecBuilder().expectStatusCode(404).build(); CenterDomain center = CenterHelper.retrieveByID(resourceId, requestSpec, responseSpec); - Assert.assertNotNull(center); + Assertions.assertNotNull(center); } private int[] generateGroupMembers(int size, int officeId) { @@ -201,21 +201,21 @@ public class CenterIntegrationTest { final Integer staffId = StaffHelper.createStaff(this.requestSpec, this.responseSpec); LOG.info("--------------creating first staff with id------------- {}" , staffId); - Assert.assertNotNull(staffId); + Assertions.assertNotNull(staffId); final int centerWithStaffId = CenterHelper.createCenterWithStaffId(this.requestSpec, this.responseSpec, staffId); final CenterDomain center = CenterHelper.retrieveByID(centerWithStaffId, requestSpec, responseSpec); - Assert.assertNotNull(center); - Assert.assertTrue(center.getId() == centerWithStaffId); - Assert.assertTrue(center.getStaffId().intValue() == staffId); - Assert.assertTrue(center.isActive() == true); + Assertions.assertNotNull(center); + Assertions.assertTrue(center.getId() == centerWithStaffId); + Assertions.assertTrue(center.getStaffId().intValue() == staffId); + Assertions.assertTrue(center.isActive() == true); } @Test public void testAssignStaffToCenter() { final Integer staffId = StaffHelper.createStaff(this.requestSpec, this.responseSpec); LOG.info("--------------creating first staff with id------------- {}" , staffId); - Assert.assertNotNull(staffId); + Assertions.assertNotNull(staffId); final Integer groupID = CenterHelper.createCenter(this.requestSpec, this.responseSpec); CenterHelper.verifyCenterCreatedOnServer(this.requestSpec, this.responseSpec, groupID); @@ -223,12 +223,12 @@ public class CenterIntegrationTest { final HashMap assignStaffToCenterResponseMap = (HashMap) CenterHelper.assignStaff(this.requestSpec, this.responseSpec, groupID.toString(), staffId.longValue()); - assertEquals("Verify assigned staff id is the same as id sent", assignStaffToCenterResponseMap.get("staffId"), staffId); + assertEquals(assignStaffToCenterResponseMap.get("staffId"), staffId, "Verify assigned staff id is the same as id sent"); final CenterDomain center = CenterHelper.retrieveByID(groupID, requestSpec, responseSpec); - Assert.assertNotNull(center); - Assert.assertTrue(center.getId().intValue() == groupID); - Assert.assertTrue(center.getStaffId().intValue() == staffId); + Assertions.assertNotNull(center); + Assertions.assertTrue(center.getId().intValue() == groupID); + Assertions.assertTrue(center.getStaffId().intValue() == staffId); } @@ -236,7 +236,7 @@ public class CenterIntegrationTest { public void testUnassignStaffToCenter() { final Integer staffId = StaffHelper.createStaff(this.requestSpec, this.responseSpec); LOG.info("--------------creating first staff with id------------- {}" , staffId); - Assert.assertNotNull(staffId); + Assertions.assertNotNull(staffId); final Integer groupID = CenterHelper.createCenter(this.requestSpec, this.responseSpec); CenterHelper.verifyCenterCreatedOnServer(this.requestSpec, this.responseSpec, groupID); @@ -244,20 +244,20 @@ public class CenterIntegrationTest { final HashMap assignStaffToCenterResponseMap = (HashMap) CenterHelper.assignStaff(this.requestSpec, this.responseSpec, groupID.toString(), staffId.longValue()); - assertEquals("Verify assigned staff id is the same as id sent", assignStaffToCenterResponseMap.get("staffId"), staffId); + assertEquals(assignStaffToCenterResponseMap.get("staffId"), staffId, "Verify assigned staff id is the same as id sent"); final CenterDomain centerWithStaffAssigned = CenterHelper.retrieveByID(groupID, requestSpec, responseSpec); - Assert.assertNotNull(centerWithStaffAssigned); - Assert.assertTrue(centerWithStaffAssigned.getId().intValue() == groupID); - Assert.assertTrue(centerWithStaffAssigned.getStaffId().intValue() == staffId); + Assertions.assertNotNull(centerWithStaffAssigned); + Assertions.assertTrue(centerWithStaffAssigned.getId().intValue() == groupID); + Assertions.assertTrue(centerWithStaffAssigned.getStaffId().intValue() == staffId); final HashMap unassignStaffToCenterResponseMap = (HashMap) CenterHelper.unassignStaff(this.requestSpec, this.responseSpec, groupID.toString(), staffId.longValue()); - assertEquals("Verify staffId is null after unassigning ", unassignStaffToCenterResponseMap.get("staffId"), null); + assertEquals(unassignStaffToCenterResponseMap.get("staffId"), null, "Verify staffId is null after unassigning "); final CenterDomain centerWithStaffUnssigned = CenterHelper.retrieveByID(groupID, requestSpec, responseSpec); - Assert.assertNotNull(centerWithStaffUnssigned); - Assert.assertTrue(centerWithStaffUnssigned.getId().intValue() == groupID); - Assert.assertTrue(centerWithStaffUnssigned.getStaffId() == null); + Assertions.assertNotNull(centerWithStaffUnssigned); + Assertions.assertTrue(centerWithStaffUnssigned.getId().intValue() == groupID); + Assertions.assertTrue(centerWithStaffUnssigned.getStaffId() == null); } diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/ChargesTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/ChargesTest.java index ca1125dfc..938760ee1 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/ChargesTest.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/ChargesTest.java @@ -27,9 +27,9 @@ import java.util.ArrayList; import java.util.HashMap; import org.apache.fineract.integrationtests.common.Utils; import org.apache.fineract.integrationtests.common.charges.ChargesHelper; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; @SuppressWarnings({ "rawtypes" }) public class ChargesTest { @@ -37,7 +37,7 @@ public class ChargesTest { private ResponseSpecification responseSpec; private RequestSpecification requestSpec; - @Before + @BeforeEach public void setup() { Utils.initializeRESTAssured(); this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build(); @@ -50,19 +50,19 @@ public class ChargesTest { // Retrieving all Charges ArrayList allChargesData = ChargesHelper.getCharges(this.requestSpec, this.responseSpec); - Assert.assertNotNull(allChargesData); + Assertions.assertNotNull(allChargesData); // Testing Creation, Updation and Deletion of Disbursement Charge final Integer disbursementChargeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec, ChargesHelper.getLoanDisbursementJSON()); - Assert.assertNotNull(disbursementChargeId); + Assertions.assertNotNull(disbursementChargeId); // Updating Charge Amount HashMap changes = ChargesHelper.updateCharges(this.requestSpec, this.responseSpec, disbursementChargeId, ChargesHelper.getModifyChargeJSON()); HashMap chargeDataAfterChanges = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, disbursementChargeId); - Assert.assertEquals("Verifying Charge after Modification", chargeDataAfterChanges.get("amount"), changes.get("amount")); + Assertions.assertEquals(chargeDataAfterChanges.get("amount"), changes.get("amount"), "Verifying Charge after Modification"); changes = ChargesHelper.updateCharges(this.requestSpec, this.responseSpec, disbursementChargeId, ChargesHelper.getModifyChargeAsPecentageAmountJSON()); @@ -70,10 +70,10 @@ public class ChargesTest { chargeDataAfterChanges = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, disbursementChargeId); HashMap chargeChangedData = (HashMap) chargeDataAfterChanges.get("chargePaymentMode"); - Assert.assertEquals("Verifying Charge after Modification", chargeChangedData.get("id"), changes.get("chargePaymentMode")); + Assertions.assertEquals(chargeChangedData.get("id"), changes.get("chargePaymentMode"), "Verifying Charge after Modification"); chargeChangedData = (HashMap) chargeDataAfterChanges.get("chargeCalculationType"); - Assert.assertEquals("Verifying Charge after Modification", chargeChangedData.get("id"), changes.get("chargeCalculationType")); + Assertions.assertEquals(chargeChangedData.get("id"), changes.get("chargeCalculationType"), "Verifying Charge after Modification"); changes = ChargesHelper.updateCharges(this.requestSpec, this.responseSpec, disbursementChargeId, ChargesHelper.getModifyChargeAsPecentageLoanAmountWithInterestJSON()); @@ -81,7 +81,7 @@ public class ChargesTest { chargeDataAfterChanges = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, disbursementChargeId); chargeChangedData = (HashMap) chargeDataAfterChanges.get("chargeCalculationType"); - Assert.assertEquals("Verifying Charge after Modification", chargeChangedData.get("id"), changes.get("chargeCalculationType")); + Assertions.assertEquals(chargeChangedData.get("id"), changes.get("chargeCalculationType"), "Verifying Charge after Modification"); changes = ChargesHelper.updateCharges(this.requestSpec, this.responseSpec, disbursementChargeId, ChargesHelper.getModifyChargeAsPercentageInterestJSON()); @@ -89,22 +89,22 @@ public class ChargesTest { chargeDataAfterChanges = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, disbursementChargeId); chargeChangedData = (HashMap) chargeDataAfterChanges.get("chargeCalculationType"); - Assert.assertEquals("Verifying Charge after Modification", chargeChangedData.get("id"), changes.get("chargeCalculationType")); + Assertions.assertEquals(chargeChangedData.get("id"), changes.get("chargeCalculationType"), "Verifying Charge after Modification"); Integer chargeIdAfterDeletion = ChargesHelper.deleteCharge(this.responseSpec, this.requestSpec, disbursementChargeId); - Assert.assertEquals("Verifying Charge ID after deletion", disbursementChargeId, chargeIdAfterDeletion); + Assertions.assertEquals(disbursementChargeId, chargeIdAfterDeletion, "Verifying Charge ID after deletion"); // Testing Creation, Updation and Deletion of Specified due date Charge final Integer specifiedDueDateChargeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec, ChargesHelper.getLoanSpecifiedDueDateJSON()); - Assert.assertNotNull(specifiedDueDateChargeId); + Assertions.assertNotNull(specifiedDueDateChargeId); // Updating Charge Amount changes = ChargesHelper.updateCharges(this.requestSpec, this.responseSpec, specifiedDueDateChargeId, ChargesHelper.getModifyChargeJSON()); chargeDataAfterChanges = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, specifiedDueDateChargeId); - Assert.assertEquals("Verifying Charge after Modification", chargeDataAfterChanges.get("amount"), changes.get("amount")); + Assertions.assertEquals(chargeDataAfterChanges.get("amount"), changes.get("amount"), "Verifying Charge after Modification"); changes = ChargesHelper.updateCharges(this.requestSpec, this.responseSpec, specifiedDueDateChargeId, ChargesHelper.getModifyChargeAsPecentageAmountJSON()); @@ -112,10 +112,10 @@ public class ChargesTest { chargeDataAfterChanges = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, specifiedDueDateChargeId); chargeChangedData = (HashMap) chargeDataAfterChanges.get("chargePaymentMode"); - Assert.assertEquals("Verifying Charge after Modification", chargeChangedData.get("id"), changes.get("chargePaymentMode")); + Assertions.assertEquals(chargeChangedData.get("id"), changes.get("chargePaymentMode"), "Verifying Charge after Modification"); chargeChangedData = (HashMap) chargeDataAfterChanges.get("chargeCalculationType"); - Assert.assertEquals("Verifying Charge after Modification", chargeChangedData.get("id"), changes.get("chargeCalculationType")); + Assertions.assertEquals(chargeChangedData.get("id"), changes.get("chargeCalculationType"), "Verifying Charge after Modification"); changes = ChargesHelper.updateCharges(this.requestSpec, this.responseSpec, specifiedDueDateChargeId, ChargesHelper.getModifyChargeAsPecentageLoanAmountWithInterestJSON()); @@ -123,7 +123,7 @@ public class ChargesTest { chargeDataAfterChanges = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, specifiedDueDateChargeId); chargeChangedData = (HashMap) chargeDataAfterChanges.get("chargeCalculationType"); - Assert.assertEquals("Verifying Charge after Modification", chargeChangedData.get("id"), changes.get("chargeCalculationType")); + Assertions.assertEquals(chargeChangedData.get("id"), changes.get("chargeCalculationType"), "Verifying Charge after Modification"); changes = ChargesHelper.updateCharges(this.requestSpec, this.responseSpec, specifiedDueDateChargeId, ChargesHelper.getModifyChargeAsPercentageInterestJSON()); @@ -131,10 +131,10 @@ public class ChargesTest { chargeDataAfterChanges = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, specifiedDueDateChargeId); chargeChangedData = (HashMap) chargeDataAfterChanges.get("chargeCalculationType"); - Assert.assertEquals("Verifying Charge after Modification", chargeChangedData.get("id"), changes.get("chargeCalculationType")); + Assertions.assertEquals(chargeChangedData.get("id"), changes.get("chargeCalculationType"), "Verifying Charge after Modification"); chargeIdAfterDeletion = ChargesHelper.deleteCharge(this.responseSpec, this.requestSpec, specifiedDueDateChargeId); - Assert.assertEquals("Verifying Charge ID after deletion", specifiedDueDateChargeId, chargeIdAfterDeletion); + Assertions.assertEquals(specifiedDueDateChargeId, chargeIdAfterDeletion, "Verifying Charge ID after deletion"); // Testing Creation, Updation and Deletion of Installment Fee Charge final Integer installmentFeeChargeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec, @@ -145,7 +145,7 @@ public class ChargesTest { ChargesHelper.getModifyChargeJSON()); chargeDataAfterChanges = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, installmentFeeChargeId); - Assert.assertEquals("Verifying Charge after Modification", chargeDataAfterChanges.get("amount"), changes.get("amount")); + Assertions.assertEquals(chargeDataAfterChanges.get("amount"), changes.get("amount"), "Verifying Charge after Modification"); changes = ChargesHelper.updateCharges(this.requestSpec, this.responseSpec, installmentFeeChargeId, ChargesHelper.getModifyChargeAsPecentageAmountJSON()); @@ -153,10 +153,10 @@ public class ChargesTest { chargeDataAfterChanges = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, installmentFeeChargeId); chargeChangedData = (HashMap) chargeDataAfterChanges.get("chargePaymentMode"); - Assert.assertEquals("Verifying Charge after Modification", chargeChangedData.get("id"), changes.get("chargePaymentMode")); + Assertions.assertEquals(chargeChangedData.get("id"), changes.get("chargePaymentMode"), "Verifying Charge after Modification"); chargeChangedData = (HashMap) chargeDataAfterChanges.get("chargeCalculationType"); - Assert.assertEquals("Verifying Charge after Modification", chargeChangedData.get("id"), changes.get("chargeCalculationType")); + Assertions.assertEquals(chargeChangedData.get("id"), changes.get("chargeCalculationType"), "Verifying Charge after Modification"); changes = ChargesHelper.updateCharges(this.requestSpec, this.responseSpec, installmentFeeChargeId, ChargesHelper.getModifyChargeAsPecentageLoanAmountWithInterestJSON()); @@ -164,7 +164,7 @@ public class ChargesTest { chargeDataAfterChanges = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, installmentFeeChargeId); chargeChangedData = (HashMap) chargeDataAfterChanges.get("chargeCalculationType"); - Assert.assertEquals("Verifying Charge after Modification", chargeChangedData.get("id"), changes.get("chargeCalculationType")); + Assertions.assertEquals(chargeChangedData.get("id"), changes.get("chargeCalculationType"), "Verifying Charge after Modification"); changes = ChargesHelper.updateCharges(this.requestSpec, this.responseSpec, installmentFeeChargeId, ChargesHelper.getModifyChargeAsPercentageInterestJSON()); @@ -172,22 +172,22 @@ public class ChargesTest { chargeDataAfterChanges = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, installmentFeeChargeId); chargeChangedData = (HashMap) chargeDataAfterChanges.get("chargeCalculationType"); - Assert.assertEquals("Verifying Charge after Modification", chargeChangedData.get("id"), changes.get("chargeCalculationType")); + Assertions.assertEquals(chargeChangedData.get("id"), changes.get("chargeCalculationType"), "Verifying Charge after Modification"); chargeIdAfterDeletion = ChargesHelper.deleteCharge(this.responseSpec, this.requestSpec, installmentFeeChargeId); - Assert.assertEquals("Verifying Charge ID after deletion", installmentFeeChargeId, chargeIdAfterDeletion); + Assertions.assertEquals(installmentFeeChargeId, chargeIdAfterDeletion, "Verifying Charge ID after deletion"); // Testing Creation, Updation and Deletion of Overdue Installment Fee // Charge final Integer overdueFeeChargeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec, ChargesHelper.getLoanOverdueFeeJSON()); - Assert.assertNotNull(overdueFeeChargeId); + Assertions.assertNotNull(overdueFeeChargeId); // Updating Charge Amount changes = ChargesHelper.updateCharges(this.requestSpec, this.responseSpec, overdueFeeChargeId, ChargesHelper.getModifyChargeJSON()); chargeDataAfterChanges = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, overdueFeeChargeId); - Assert.assertEquals("Verifying Charge after Modification", chargeDataAfterChanges.get("amount"), changes.get("amount")); + Assertions.assertEquals(chargeDataAfterChanges.get("amount"), changes.get("amount"), "Verifying Charge after Modification"); changes = ChargesHelper.updateCharges(this.requestSpec, this.responseSpec, overdueFeeChargeId, ChargesHelper.getModifyChargeAsPecentageAmountJSON()); @@ -195,10 +195,10 @@ public class ChargesTest { chargeDataAfterChanges = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, overdueFeeChargeId); chargeChangedData = (HashMap) chargeDataAfterChanges.get("chargePaymentMode"); - Assert.assertEquals("Verifying Charge after Modification", chargeChangedData.get("id"), changes.get("chargePaymentMode")); + Assertions.assertEquals(chargeChangedData.get("id"), changes.get("chargePaymentMode"), "Verifying Charge after Modification"); chargeChangedData = (HashMap) chargeDataAfterChanges.get("chargeCalculationType"); - Assert.assertEquals("Verifying Charge after Modification", chargeChangedData.get("id"), changes.get("chargeCalculationType")); + Assertions.assertEquals(chargeChangedData.get("id"), changes.get("chargeCalculationType"), "Verifying Charge after Modification"); changes = ChargesHelper.updateCharges(this.requestSpec, this.responseSpec, overdueFeeChargeId, ChargesHelper.getModifyChargeAsPecentageLoanAmountWithInterestJSON()); @@ -206,7 +206,7 @@ public class ChargesTest { chargeDataAfterChanges = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, overdueFeeChargeId); chargeChangedData = (HashMap) chargeDataAfterChanges.get("chargeCalculationType"); - Assert.assertEquals("Verifying Charge after Modification", chargeChangedData.get("id"), changes.get("chargeCalculationType")); + Assertions.assertEquals(chargeChangedData.get("id"), changes.get("chargeCalculationType"), "Verifying Charge after Modification"); changes = ChargesHelper.updateCharges(this.requestSpec, this.responseSpec, overdueFeeChargeId, ChargesHelper.getModifyChargeAsPercentageInterestJSON()); @@ -214,7 +214,7 @@ public class ChargesTest { chargeDataAfterChanges = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, overdueFeeChargeId); chargeChangedData = (HashMap) chargeDataAfterChanges.get("chargeCalculationType"); - Assert.assertEquals("Verifying Charge after Modification", chargeChangedData.get("id"), changes.get("chargeCalculationType")); + Assertions.assertEquals(chargeChangedData.get("id"), changes.get("chargeCalculationType"), "Verifying Charge after Modification"); changes = ChargesHelper.updateCharges(this.requestSpec, this.responseSpec, overdueFeeChargeId, ChargesHelper.getModifyChargeFeeFrequencyAsYearsJSON()); @@ -222,10 +222,10 @@ public class ChargesTest { chargeDataAfterChanges = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, overdueFeeChargeId); chargeChangedData = (HashMap) chargeDataAfterChanges.get("feeFrequency"); - Assert.assertEquals("Verifying Charge after Modification", chargeChangedData.get("id"), changes.get("feeFrequency")); + Assertions.assertEquals(chargeChangedData.get("id"), changes.get("feeFrequency"), "Verifying Charge after Modification"); chargeIdAfterDeletion = ChargesHelper.deleteCharge(this.responseSpec, this.requestSpec, overdueFeeChargeId); - Assert.assertEquals("Verifying Charge ID after deletion", overdueFeeChargeId, chargeIdAfterDeletion); + Assertions.assertEquals(overdueFeeChargeId, chargeIdAfterDeletion, "Verifying Charge ID after deletion"); } @Test @@ -234,37 +234,37 @@ public class ChargesTest { // Testing Creation, Updation and Deletion of Specified due date Charge final Integer specifiedDueDateChargeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec, ChargesHelper.getSavingsSpecifiedDueDateJSON()); - Assert.assertNotNull(specifiedDueDateChargeId); + Assertions.assertNotNull(specifiedDueDateChargeId); // Updating Charge Amount HashMap changes = ChargesHelper.updateCharges(this.requestSpec, this.responseSpec, specifiedDueDateChargeId, ChargesHelper.getModifyChargeJSON()); HashMap chargeDataAfterChanges = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, specifiedDueDateChargeId); - Assert.assertEquals("Verifying Charge after Modification", chargeDataAfterChanges.get("amount"), changes.get("amount")); + Assertions.assertEquals(chargeDataAfterChanges.get("amount"), changes.get("amount"), "Verifying Charge after Modification"); Integer chargeIdAfterDeletion = ChargesHelper.deleteCharge(this.responseSpec, this.requestSpec, specifiedDueDateChargeId); - Assert.assertEquals("Verifying Charge ID after deletion", specifiedDueDateChargeId, chargeIdAfterDeletion); + Assertions.assertEquals(specifiedDueDateChargeId, chargeIdAfterDeletion, "Verifying Charge ID after deletion"); // Testing Creation, Updation and Deletion of Savings Activation Charge final Integer savingsActivationChargeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec, ChargesHelper.getSavingsActivationFeeJSON()); - Assert.assertNotNull(savingsActivationChargeId); + Assertions.assertNotNull(savingsActivationChargeId); // Updating Charge Amount changes = ChargesHelper.updateCharges(this.requestSpec, this.responseSpec, savingsActivationChargeId, ChargesHelper.getModifyChargeJSON()); chargeDataAfterChanges = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, savingsActivationChargeId); - Assert.assertEquals("Verifying Charge after Modification", chargeDataAfterChanges.get("amount"), changes.get("amount")); + Assertions.assertEquals(chargeDataAfterChanges.get("amount"), changes.get("amount"), "Verifying Charge after Modification"); chargeIdAfterDeletion = ChargesHelper.deleteCharge(this.responseSpec, this.requestSpec, savingsActivationChargeId); - Assert.assertEquals("Verifying Charge ID after deletion", savingsActivationChargeId, chargeIdAfterDeletion); + Assertions.assertEquals(savingsActivationChargeId, chargeIdAfterDeletion, "Verifying Charge ID after deletion"); // Testing Creation, Updation and Deletion of Charge for Withdrawal Fee final Integer withdrawalFeeChargeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec, ChargesHelper.getSavingsWithdrawalFeeJSON()); - Assert.assertNotNull(withdrawalFeeChargeId); + Assertions.assertNotNull(withdrawalFeeChargeId); // Updating Charge-Calculation-Type to Withdrawal-Fee changes = ChargesHelper.updateCharges(this.requestSpec, this.responseSpec, withdrawalFeeChargeId, @@ -273,52 +273,52 @@ public class ChargesTest { chargeDataAfterChanges = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, withdrawalFeeChargeId); HashMap chargeChangedData = (HashMap) chargeDataAfterChanges.get("chargeCalculationType"); - Assert.assertEquals("Verifying Charge after Modification", chargeChangedData.get("id"), changes.get("chargeCalculationType")); + Assertions.assertEquals(chargeChangedData.get("id"), changes.get("chargeCalculationType"), "Verifying Charge after Modification"); chargeIdAfterDeletion = ChargesHelper.deleteCharge(this.responseSpec, this.requestSpec, withdrawalFeeChargeId); - Assert.assertEquals("Verifying Charge ID after deletion", withdrawalFeeChargeId, chargeIdAfterDeletion); + Assertions.assertEquals(withdrawalFeeChargeId, chargeIdAfterDeletion, "Verifying Charge ID after deletion"); // Testing Creation, Updation and Deletion of Charge for Annual Fee final Integer annualFeeChargeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec, ChargesHelper.getSavingsAnnualFeeJSON()); - Assert.assertNotNull(annualFeeChargeId); + Assertions.assertNotNull(annualFeeChargeId); // Updating Charge Amount changes = ChargesHelper.updateCharges(this.requestSpec, this.responseSpec, annualFeeChargeId, ChargesHelper.getModifyChargeJSON()); chargeDataAfterChanges = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, annualFeeChargeId); - Assert.assertEquals("Verifying Charge after Modification", chargeDataAfterChanges.get("amount"), changes.get("amount")); + Assertions.assertEquals(chargeDataAfterChanges.get("amount"), changes.get("amount"), "Verifying Charge after Modification"); chargeIdAfterDeletion = ChargesHelper.deleteCharge(this.responseSpec, this.requestSpec, annualFeeChargeId); - Assert.assertEquals("Verifying Charge ID after deletion", annualFeeChargeId, chargeIdAfterDeletion); + Assertions.assertEquals(annualFeeChargeId, chargeIdAfterDeletion, "Verifying Charge ID after deletion"); // Testing Creation, Updation and Deletion of Charge for Monthly Fee final Integer monthlyFeeChargeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec, ChargesHelper.getSavingsMonthlyFeeJSON()); - Assert.assertNotNull(monthlyFeeChargeId); + Assertions.assertNotNull(monthlyFeeChargeId); // Updating Charge Amount changes = ChargesHelper.updateCharges(this.requestSpec, this.responseSpec, monthlyFeeChargeId, ChargesHelper.getModifyChargeJSON()); chargeDataAfterChanges = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, monthlyFeeChargeId); - Assert.assertEquals("Verifying Charge after Modification", chargeDataAfterChanges.get("amount"), changes.get("amount")); + Assertions.assertEquals(chargeDataAfterChanges.get("amount"), changes.get("amount"), "Verifying Charge after Modification"); chargeIdAfterDeletion = ChargesHelper.deleteCharge(this.responseSpec, this.requestSpec, monthlyFeeChargeId); - Assert.assertEquals("Verifying Charge ID after deletion", monthlyFeeChargeId, chargeIdAfterDeletion); + Assertions.assertEquals(monthlyFeeChargeId, chargeIdAfterDeletion, "Verifying Charge ID after deletion"); // Testing Creation, Updation and Deletion of Charge for Overdraft Fee final Integer overdraftFeeChargeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec, ChargesHelper.getSavingsOverdraftFeeJSON()); - Assert.assertNotNull(overdraftFeeChargeId); + Assertions.assertNotNull(overdraftFeeChargeId); // Updating Charge Amount changes = ChargesHelper.updateCharges(this.requestSpec, this.responseSpec, overdraftFeeChargeId, ChargesHelper.getModifyChargeJSON()); chargeDataAfterChanges = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, overdraftFeeChargeId); - Assert.assertEquals("Verifying Charge after Modification", chargeDataAfterChanges.get("amount"), changes.get("amount")); + Assertions.assertEquals(chargeDataAfterChanges.get("amount"), changes.get("amount"), "Verifying Charge after Modification"); chargeIdAfterDeletion = ChargesHelper.deleteCharge(this.responseSpec, this.requestSpec, overdraftFeeChargeId); - Assert.assertEquals("Verifying Charge ID after deletion", overdraftFeeChargeId, chargeIdAfterDeletion); + Assertions.assertEquals(overdraftFeeChargeId, chargeIdAfterDeletion, "Verifying Charge ID after deletion"); } } diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/ClientLoanIntegrationTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/ClientLoanIntegrationTest.java index e96b3d55b..2c7de5ba8 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/ClientLoanIntegrationTest.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/ClientLoanIntegrationTest.java @@ -18,7 +18,7 @@ */ package org.apache.fineract.integrationtests; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import com.google.gson.JsonObject; import io.restassured.builder.RequestSpecBuilder; @@ -55,9 +55,9 @@ import org.apache.fineract.integrationtests.common.savings.SavingsAccountHelper; import org.apache.fineract.integrationtests.common.savings.SavingsProductHelper; import org.apache.fineract.integrationtests.common.savings.SavingsStatusChecker; import org.joda.time.LocalDate; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -88,7 +88,7 @@ public class ClientLoanIntegrationTest { private SavingsAccountHelper savingsAccountHelper; private AccountTransferHelper accountTransferHelper; - @Before + @BeforeEach public void setup() { Utils.initializeRESTAssured(); this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build(); @@ -136,7 +136,7 @@ public class ClientLoanIntegrationTest { addCharges(charges, interestPercentage, "1", null); final Integer loanID = applyForLoanApplication(clientID, loanProductID, charges, null, "12,000.00"); - Assert.assertNotNull(loanID); + Assertions.assertNotNull(loanID); HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID); LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap); @@ -222,7 +222,7 @@ public class ClientLoanIntegrationTest { loanCharges = this.loanTransactionHelper.getLoanCharges(loanID); loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID); disbursementDetail = loanSchedule.get(0); - Assert.assertEquals(0, loanCharges.size()); + Assertions.assertEquals(0, loanCharges.size()); validateNumberForEqual("0.0", String.valueOf(disbursementDetail.get("feeChargesDue"))); } @@ -247,7 +247,7 @@ public class ClientLoanIntegrationTest { addCharges(charges, interestPercentage, "1", null); final Integer loanID = applyForLoanApplication(clientID, loanProductID, charges, null, "12,000.00"); - Assert.assertNotNull(loanID); + Assertions.assertNotNull(loanID); HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID); LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap); @@ -311,7 +311,7 @@ public class ClientLoanIntegrationTest { addCharges(charges, interestPercentage, "1", "29 September 2011"); final Integer loanID = applyForLoanApplication(clientID, loanProductID, charges, null, "12,000.00"); - Assert.assertNotNull(loanID); + Assertions.assertNotNull(loanID); HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID); LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap); @@ -397,7 +397,7 @@ public class ClientLoanIntegrationTest { loanCharges = this.loanTransactionHelper.getLoanCharges(loanID); loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID); firstInstallment = loanSchedule.get(1); - Assert.assertEquals(0, loanCharges.size()); + Assertions.assertEquals(0, loanCharges.size()); validateNumberForEqual("0", String.valueOf(firstInstallment.get("feeChargesDue"))); LOG.info("-----------------------------------APPROVE LOAN-----------------------------------------"); @@ -477,7 +477,7 @@ public class ClientLoanIntegrationTest { addCharges(charges, interestPercentage, "1", "29 September 2011"); final Integer loanID = applyForLoanApplication(clientID, loanProductID, charges, null, "12,000.00"); - Assert.assertNotNull(loanID); + Assertions.assertNotNull(loanID); HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID); LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap); @@ -699,7 +699,7 @@ public class ClientLoanIntegrationTest { loanSchedule.remove(0); for (HashMap installment : loanSchedule) { validateNumberForEqualExcludePrecission("150", String.valueOf(installment.get("feeChargesDue"))); - if (waivePeriodnum == installment.get("period")) { + if (waivePeriodnum.equals(installment.get("period"))) { validateNumberForEqualExcludePrecission("100.0", String.valueOf(installment.get("feeChargesOutstanding"))); validateNumberForEqualExcludePrecission("50.0", String.valueOf(installment.get("feeChargesWaived"))); @@ -722,11 +722,11 @@ public class ClientLoanIntegrationTest { loanSchedule.remove(0); for (HashMap installment : loanSchedule) { validateNumberForEqualExcludePrecission("150", String.valueOf(installment.get("feeChargesDue"))); - if (payPeriodnum == installment.get("period")) { + if (payPeriodnum.equals(installment.get("period"))) { validateNumberForEqualExcludePrecission("50.0", String.valueOf(installment.get("feeChargesOutstanding"))); validateNumberForEqualExcludePrecission("100.0", String.valueOf(installment.get("feeChargesPaid"))); - } else if (waivePeriodnum == installment.get("period")) { + } else if (waivePeriodnum.equals(installment.get("period"))) { validateNumberForEqualExcludePrecission("100.0", String.valueOf(installment.get("feeChargesOutstanding"))); validateNumberForEqualExcludePrecission("50.0", String.valueOf(installment.get("feeChargesWaived"))); @@ -756,7 +756,7 @@ public class ClientLoanIntegrationTest { final Integer loanID = applyForLoanApplication(clientID, loanProductID, null, savingsId.toString(), "12,000.00"); - Assert.assertNotNull(loanID); + Assertions.assertNotNull(loanID); HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID); LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap); @@ -768,7 +768,7 @@ public class ClientLoanIntegrationTest { HashMap summary = savingsAccountHelper.getSavingsSummary(savingsId); Float balance = Float.valueOf(MINIMUM_OPENING_BALANCE); - assertEquals("Verifying opening Balance", balance, summary.get("accountBalance")); + assertEquals(balance, summary.get("accountBalance"), "Verifying opening Balance"); // DISBURSE loanStatusHashMap = this.loanTransactionHelper.disburseLoanToSavings(SavingsAccountHelper.TRANSACTION_DATE, @@ -778,7 +778,7 @@ public class ClientLoanIntegrationTest { summary = savingsAccountHelper.getSavingsSummary(savingsId); balance = Float.valueOf(MINIMUM_OPENING_BALANCE) + Float.valueOf("12000"); - assertEquals("Verifying opening Balance", balance, summary.get("accountBalance")); + assertEquals(balance, summary.get("accountBalance"), "Verifying opening Balance"); loanStatusHashMap = this.loanTransactionHelper.undoDisbursal(loanID); LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap); @@ -786,7 +786,7 @@ public class ClientLoanIntegrationTest { summary = savingsAccountHelper.getSavingsSummary(savingsId); balance = Float.valueOf(MINIMUM_OPENING_BALANCE); - assertEquals("Verifying opening Balance", balance, summary.get("accountBalance")); + assertEquals(balance, summary.get("accountBalance"), "Verifying opening Balance"); } @@ -803,7 +803,7 @@ public class ClientLoanIntegrationTest { final Integer loanID = applyForLoanApplicationWithTranches(clientID, loanProductID, null, null, "45,000.00", tranches); - Assert.assertNotNull(loanID); + Assertions.assertNotNull(loanID); HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID); LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap); @@ -847,7 +847,7 @@ public class ClientLoanIntegrationTest { final Integer loanID = applyForLoanApplicationWithTranches(clientID, loanProductID, null, savingsId.toString(), "45,000.00", tranches); - Assert.assertNotNull(loanID); + Assertions.assertNotNull(loanID); HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID); LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap); @@ -859,7 +859,7 @@ public class ClientLoanIntegrationTest { HashMap summary = savingsAccountHelper.getSavingsSummary(savingsId); Float balance = Float.valueOf(MINIMUM_OPENING_BALANCE); - assertEquals("Verifying opening Balance", balance, summary.get("accountBalance")); + assertEquals(balance, summary.get("accountBalance"), "Verifying opening Balance"); // DISBURSE first Tranche loanStatusHashMap = this.loanTransactionHelper.disburseLoanToSavings("1 March 2014", loanID); @@ -868,7 +868,7 @@ public class ClientLoanIntegrationTest { summary = savingsAccountHelper.getSavingsSummary(savingsId); balance = Float.valueOf(MINIMUM_OPENING_BALANCE) + Float.valueOf("25000"); - assertEquals("Verifying opening Balance", balance, summary.get("accountBalance")); + assertEquals(balance, summary.get("accountBalance"), "Verifying opening Balance"); // DISBURSE Second Tranche loanStatusHashMap = this.loanTransactionHelper.disburseLoanToSavings("23 April 2014", loanID); @@ -877,7 +877,7 @@ public class ClientLoanIntegrationTest { summary = savingsAccountHelper.getSavingsSummary(savingsId); balance = Float.valueOf(MINIMUM_OPENING_BALANCE) + Float.valueOf("25000") + Float.valueOf("20000"); - assertEquals("Verifying opening Balance", balance, summary.get("accountBalance")); + assertEquals(balance, summary.get("accountBalance"), "Verifying opening Balance"); loanStatusHashMap = this.loanTransactionHelper.undoDisbursal(loanID); LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap); @@ -885,20 +885,20 @@ public class ClientLoanIntegrationTest { summary = savingsAccountHelper.getSavingsSummary(savingsId); balance = Float.valueOf(MINIMUM_OPENING_BALANCE); - assertEquals("Verifying opening Balance", balance, summary.get("accountBalance")); + assertEquals(balance, summary.get("accountBalance"), "Verifying opening Balance"); } private void validateCharge(Integer amountPercentage, final List loanCharges, final String amount, final String outstanding, String amountPaid, String amountWaived) { HashMap chargeDetail = getloanCharge(amountPercentage, loanCharges); - Assert.assertTrue(Float.valueOf(amount) + Assertions.assertTrue(Float.valueOf(amount) .compareTo(Float.valueOf(String.valueOf(chargeDetail.get("amountOrPercentage")))) == 0); - Assert.assertTrue(Float.valueOf(outstanding) + Assertions.assertTrue(Float.valueOf(outstanding) .compareTo(Float.valueOf(String.valueOf(chargeDetail.get("amountOutstanding")))) == 0); - Assert.assertTrue(Float.valueOf(amountPaid) + Assertions.assertTrue(Float.valueOf(amountPaid) .compareTo(Float.valueOf(String.valueOf(chargeDetail.get("amountPaid")))) == 0); - Assert.assertTrue(Float.valueOf(amountWaived) + Assertions.assertTrue(Float.valueOf(amountWaived) .compareTo(Float.valueOf(String.valueOf(chargeDetail.get("amountWaived")))) == 0); } @@ -906,28 +906,28 @@ public class ClientLoanIntegrationTest { final String amount, final String outstanding, String amountPaid, String amountWaived) { DecimalFormat twoDForm = new DecimalFormat("#"); HashMap chargeDetail = getloanCharge(amountPercentage, loanCharges); - Assert.assertTrue(Float.valueOf(twoDForm.format(Float.valueOf(amount))).compareTo(Float + Assertions.assertTrue(Float.valueOf(twoDForm.format(Float.valueOf(amount))).compareTo(Float .valueOf(twoDForm.format(Float.valueOf(String.valueOf(chargeDetail.get("amountOrPercentage")))))) == 0); - Assert.assertTrue(Float.valueOf(twoDForm.format(Float.valueOf(outstanding))).compareTo(Float + Assertions.assertTrue(Float.valueOf(twoDForm.format(Float.valueOf(outstanding))).compareTo(Float .valueOf(twoDForm.format(Float.valueOf(String.valueOf(chargeDetail.get("amountOutstanding")))))) == 0); - Assert.assertTrue(Float.valueOf(twoDForm.format(Float.valueOf(amountPaid))).compareTo( + Assertions.assertTrue(Float.valueOf(twoDForm.format(Float.valueOf(amountPaid))).compareTo( Float.valueOf(twoDForm.format(Float.valueOf(String.valueOf(chargeDetail.get("amountPaid")))))) == 0); - Assert.assertTrue(Float.valueOf(twoDForm.format(Float.valueOf(amountWaived))).compareTo( + Assertions.assertTrue(Float.valueOf(twoDForm.format(Float.valueOf(amountWaived))).compareTo( Float.valueOf(twoDForm.format(Float.valueOf(String.valueOf(chargeDetail.get("amountWaived")))))) == 0); } public void validateNumberForEqual(String val, String val2) { - Assert.assertTrue(Float.valueOf(val).compareTo(Float.valueOf(val2)) == 0); + Assertions.assertTrue(Float.valueOf(val).compareTo(Float.valueOf(val2)) == 0); } public void validateNumberForEqualWithMsg(String msg, String val, String val2) { - Assert.assertTrue(msg + "expected " + val + " but was " + val2, - Float.valueOf(val).compareTo(Float.valueOf(val2)) == 0); + Assertions.assertTrue(Float.valueOf(val).compareTo(Float.valueOf(val2)) == 0, + msg + "expected " + val + " but was " + val2); } public void validateNumberForEqualExcludePrecission(String val, String val2) { DecimalFormat twoDForm = new DecimalFormat("#"); - Assert.assertTrue(Float.valueOf(twoDForm.format(Float.valueOf(val))) + Assertions.assertTrue(Float.valueOf(twoDForm.format(Float.valueOf(val))) .compareTo(Float.valueOf(twoDForm.format(Float.valueOf(val2)))) == 0); } @@ -1122,101 +1122,140 @@ public class ClientLoanIntegrationTest { LOG.info( "--------------------VERIFYING THE PRINCIPAL DUES,INTEREST DUE AND DUE DATE--------------------------"); - assertEquals("Checking for Due Date for 1st Month", new ArrayList<>(Arrays.asList(2011, 10, 20)), - loanSchedule.get(1).get("dueDate")); - assertEquals("Checking for Principal Due for 1st Month", Float.valueOf("2911.49"), - loanSchedule.get(1).get("principalOriginalDue")); - assertEquals("Checking for Interest Due for 1st Month", Float.valueOf("240.00"), - loanSchedule.get(1).get("interestOriginalDue")); + assertEquals(new ArrayList<>(Arrays.asList(2011, 10, 20)), + loanSchedule.get(1).get("dueDate"), + "Checking for Due Date for 1st Month"); + assertEquals(Float.valueOf("2911.49"), + loanSchedule.get(1).get("principalOriginalDue"), + "Checking for Principal Due for 1st Month"); + assertEquals(Float.valueOf("240.00"), + loanSchedule.get(1).get("interestOriginalDue"), + "Checking for Interest Due for 1st Month"); - assertEquals("Checking for Due Date for 2nd Month", new ArrayList<>(Arrays.asList(2011, 11, 20)), - loanSchedule.get(2).get("dueDate")); - assertEquals("Checking for Principal Due for 2nd Month", Float.valueOf("2969.72"), - loanSchedule.get(2).get("principalDue")); - assertEquals("Checking for Interest Due for 2nd Month", Float.valueOf("181.77"), - loanSchedule.get(2).get("interestOriginalDue")); + assertEquals(new ArrayList<>(Arrays.asList(2011, 11, 20)), + loanSchedule.get(2).get("dueDate"), + "Checking for Due Date for 2nd Month"); + assertEquals(Float.valueOf("2969.72"), + loanSchedule.get(2).get("principalDue"), + "Checking for Principal Due for 2nd Month"); + assertEquals(Float.valueOf("181.77"), + loanSchedule.get(2).get("interestOriginalDue"), + "Checking for Interest Due for 2nd Month"); - assertEquals("Checking for Due Date for 3rd Month", new ArrayList<>(Arrays.asList(2011, 12, 20)), - loanSchedule.get(3).get("dueDate")); - assertEquals("Checking for Principal Due for 3rd Month", Float.valueOf("3029.11"), - loanSchedule.get(3).get("principalDue")); - assertEquals("Checking for Interest Due for 3rd Month", Float.valueOf("122.38"), - loanSchedule.get(3).get("interestOriginalDue")); + assertEquals(new ArrayList<>(Arrays.asList(2011, 12, 20)), + loanSchedule.get(3).get("dueDate"), + "Checking for Due Date for 3rd Month"); + assertEquals(Float.valueOf("3029.11"), + loanSchedule.get(3).get("principalDue"), + "Checking for Principal Due for 3rd Month"); + assertEquals(Float.valueOf("122.38"), + loanSchedule.get(3).get("interestOriginalDue"), + "Checking for Interest Due for 3rd Month"); - assertEquals("Checking for Due Date for 4th Month", new ArrayList<>(Arrays.asList(2012, 1, 20)), - loanSchedule.get(4).get("dueDate")); - assertEquals("Checking for Principal Due for 4th Month", Float.valueOf("3089.68"), - loanSchedule.get(4).get("principalDue")); - assertEquals("Checking for Interest Due for 4th Month", Float.valueOf("61.79"), - loanSchedule.get(4).get("interestOriginalDue")); + assertEquals(new ArrayList<>(Arrays.asList(2012, 1, 20)), + loanSchedule.get(4).get("dueDate"), + "Checking for Due Date for 4th Month"); + assertEquals(Float.valueOf("3089.68"), + loanSchedule.get(4).get("principalDue"), + "Checking for Principal Due for 4th Month"); + assertEquals(Float.valueOf("61.79"), + loanSchedule.get(4).get("interestOriginalDue"), + "Checking for Interest Due for 4th Month"); } private void verifyLoanRepaymentScheduleForEqualPrincipal(final ArrayList loanSchedule) { LOG.info( "--------------------VERIFYING THE PRINCIPAL DUES,INTEREST DUE AND DUE DATE--------------------------"); - assertEquals("Checking for Due Date for 1st Month", new ArrayList<>(Arrays.asList(2014, 7, 2)), - loanSchedule.get(1).get("dueDate")); - assertEquals("Checking for Principal Due for 1st Month", Float.valueOf("416700"), - loanSchedule.get(1).get("principalOriginalDue")); - assertEquals("Checking for Interest Due for 1st Month", Float.valueOf("200000"), - loanSchedule.get(1).get("interestOriginalDue")); + assertEquals(new ArrayList<>(Arrays.asList(2014, 7, 2)), + loanSchedule.get(1).get("dueDate"), + "Checking for Due Date for 1st Month"); + assertEquals(Float.valueOf("416700"), + loanSchedule.get(1).get("principalOriginalDue"), + "Checking for Principal Due for 1st Month"); + assertEquals(Float.valueOf("200000"), + loanSchedule.get(1).get("interestOriginalDue"), + "Checking for Interest Due for 1st Month"); - assertEquals("Checking for Due Date for 2nd Month", new ArrayList<>(Arrays.asList(2014, 8, 2)), - loanSchedule.get(2).get("dueDate")); - assertEquals("Checking for Principal Due for 2nd Month", Float.valueOf("416700"), - loanSchedule.get(2).get("principalDue")); - assertEquals("Checking for Interest Due for 2nd Month", Float.valueOf("191700"), - loanSchedule.get(2).get("interestOriginalDue")); + assertEquals(new ArrayList<>(Arrays.asList(2014, 8, 2)), + loanSchedule.get(2).get("dueDate"), + "Checking for Due Date for 2nd Month"); + assertEquals(Float.valueOf("416700"), + loanSchedule.get(2).get("principalDue"), + "Checking for Principal Due for 2nd Month"); + assertEquals(Float.valueOf("191700"), + loanSchedule.get(2).get("interestOriginalDue"), + "Checking for Interest Due for 2nd Month"); - assertEquals("Checking for Due Date for 3rd Month", new ArrayList<>(Arrays.asList(2014, 9, 2)), - loanSchedule.get(3).get("dueDate")); - assertEquals("Checking for Principal Due for 3rd Month", Float.valueOf("416700"), - loanSchedule.get(3).get("principalDue")); - assertEquals("Checking for Interest Due for 3rd Month", Float.valueOf("183300"), - loanSchedule.get(3).get("interestOriginalDue")); + assertEquals(new ArrayList<>(Arrays.asList(2014, 9, 2)), + loanSchedule.get(3).get("dueDate"), + "Checking for Due Date for 3rd Month"); + assertEquals(Float.valueOf("416700"), + loanSchedule.get(3).get("principalDue"), + "Checking for Principal Due for 3rd Month"); + assertEquals(Float.valueOf("183300"), + loanSchedule.get(3).get("interestOriginalDue"), + "Checking for Interest Due for 3rd Month"); - assertEquals("Checking for Due Date for 4th Month", new ArrayList<>(Arrays.asList(2014, 10, 2)), - loanSchedule.get(4).get("dueDate")); - assertEquals("Checking for Principal Due for 4th Month", Float.valueOf("416700"), - loanSchedule.get(4).get("principalDue")); - assertEquals("Checking for Interest Due for 4th Month", Float.valueOf("175000"), - loanSchedule.get(4).get("interestOriginalDue")); + assertEquals(new ArrayList<>(Arrays.asList(2014, 10, 2)), + loanSchedule.get(4).get("dueDate"), + "Checking for Due Date for 4th Month"); + assertEquals(Float.valueOf("416700"), + loanSchedule.get(4).get("principalDue"), + "Checking for Principal Due for 4th Month"); + assertEquals(Float.valueOf("175000"), + loanSchedule.get(4).get("interestOriginalDue"), + "Checking for Interest Due for 4th Month"); - assertEquals("Checking for Due Date for 5th Month", new ArrayList<>(Arrays.asList(2014, 11, 2)), - loanSchedule.get(5).get("dueDate")); - assertEquals("Checking for Principal Due for 5th Month", Float.valueOf("416700"), - loanSchedule.get(5).get("principalDue")); - assertEquals("Checking for Interest Due for 5th Month", Float.valueOf("166700"), - loanSchedule.get(5).get("interestOriginalDue")); + assertEquals(new ArrayList<>(Arrays.asList(2014, 11, 2)), + loanSchedule.get(5).get("dueDate"), + "Checking for Due Date for 5th Month"); + assertEquals(Float.valueOf("416700"), + loanSchedule.get(5).get("principalDue"), + "Checking for Principal Due for 5th Month"); + assertEquals(Float.valueOf("166700"), + loanSchedule.get(5).get("interestOriginalDue"), + "Checking for Interest Due for 5th Month"); - assertEquals("Checking for Due Date for 6th Month", new ArrayList<>(Arrays.asList(2014, 12, 2)), - loanSchedule.get(6).get("dueDate")); - assertEquals("Checking for Principal Due for 6th Month", Float.valueOf("416700"), - loanSchedule.get(6).get("principalDue")); - assertEquals("Checking for Interest Due for 6th Month", Float.valueOf("158300"), - loanSchedule.get(6).get("interestOriginalDue")); + assertEquals(new ArrayList<>(Arrays.asList(2014, 12, 2)), + loanSchedule.get(6).get("dueDate"), + "Checking for Due Date for 6th Month"); + assertEquals(Float.valueOf("416700"), + loanSchedule.get(6).get("principalDue"), + "Checking for Principal Due for 6th Month"); + assertEquals(Float.valueOf("158300"), + loanSchedule.get(6).get("interestOriginalDue"), + "Checking for Interest Due for 6th Month"); - assertEquals("Checking for Due Date for 10th Month", new ArrayList<>(Arrays.asList(2015, 4, 2)), - loanSchedule.get(10).get("dueDate")); - assertEquals("Checking for Principal Due for 10th Month", Float.valueOf("416700"), - loanSchedule.get(10).get("principalDue")); - assertEquals("Checking for Interest Due for 10th Month", Float.valueOf("125000"), - loanSchedule.get(10).get("interestOriginalDue")); + assertEquals(new ArrayList<>(Arrays.asList(2015, 4, 2)), + loanSchedule.get(10).get("dueDate"), + "Checking for Due Date for 10th Month"); + assertEquals(Float.valueOf("416700"), + loanSchedule.get(10).get("principalDue"), + "Checking for Principal Due for 10th Month"); + assertEquals(Float.valueOf("125000"), + loanSchedule.get(10).get("interestOriginalDue"), + "Checking for Interest Due for 10th Month"); - assertEquals("Checking for Due Date for 20th Month", new ArrayList<>(Arrays.asList(2016, 2, 2)), - loanSchedule.get(20).get("dueDate")); - assertEquals("Checking for Principal Due for 20th Month", Float.valueOf("416700"), - loanSchedule.get(20).get("principalDue")); - assertEquals("Checking for Interest Due for 20th Month", Float.valueOf("41700"), - loanSchedule.get(20).get("interestOriginalDue")); + assertEquals(new ArrayList<>(Arrays.asList(2016, 2, 2)), + loanSchedule.get(20).get("dueDate"), + "Checking for Due Date for 20th Month"); + assertEquals(Float.valueOf("416700"), + loanSchedule.get(20).get("principalDue"), + "Checking for Principal Due for 20th Month"); + assertEquals(Float.valueOf("41700"), + loanSchedule.get(20).get("interestOriginalDue"), + "Checking for Interest Due for 20th Month"); - assertEquals("Checking for Due Date for 24th Month", new ArrayList<>(Arrays.asList(2016, 6, 2)), - loanSchedule.get(24).get("dueDate")); - assertEquals("Checking for Principal Due for 24th Month", Float.valueOf("415900"), - loanSchedule.get(24).get("principalDue")); - assertEquals("Checking for Interest Due for 24th Month", Float.valueOf("8300"), - loanSchedule.get(24).get("interestOriginalDue")); + assertEquals(new ArrayList<>(Arrays.asList(2016, 6, 2)), + loanSchedule.get(24).get("dueDate"), + "Checking for Due Date for 24th Month"); + assertEquals(Float.valueOf("415900"), + loanSchedule.get(24).get("principalDue"), + "Checking for Principal Due for 24th Month"); + assertEquals(Float.valueOf("8300"), + loanSchedule.get(24).get("interestOriginalDue"), + "Checking for Interest Due for 24th Month"); } @@ -1224,75 +1263,99 @@ public class ClientLoanIntegrationTest { LOG.info( "--------------------VERIFYING THE PRINCIPAL DUES,INTEREST DUE AND DUE DATE--------------------------"); - assertEquals("Checking for Due Date for 1st Month", new ArrayList<>(Arrays.asList(2014, 7, 2)), - loanSchedule.get(1).get("dueDate")); - validateNumberForEqualWithMsg("Checking for Principal Due for 1st Month", "0.0", - String.valueOf(loanSchedule.get(1).get("principalOriginalDue"))); - assertEquals("Checking for Interest Due for 1st Month", Float.valueOf("200000"), - loanSchedule.get(1).get("interestOriginalDue")); + assertEquals(new ArrayList<>(Arrays.asList(2014, 7, 2)), + loanSchedule.get(1).get("dueDate"), + "Checking for Due Date for 1st Month"); + validateNumberForEqualWithMsg(String.valueOf(loanSchedule.get(1).get("principalOriginalDue")), + "Checking for Principal Due for 1st Month", "0.0"); + assertEquals(Float.valueOf("200000"), + loanSchedule.get(1).get("interestOriginalDue"), + "Checking for Interest Due for 1st Month"); - assertEquals("Checking for Due Date for 2nd Month", new ArrayList<>(Arrays.asList(2014, 8, 2)), - loanSchedule.get(2).get("dueDate")); - validateNumberForEqualWithMsg("Checking for Principal Due for 2nd Month", "0.0", - String.valueOf(loanSchedule.get(2).get("principalOriginalDue"))); - assertEquals("Checking for Interest Due for 2nd Month", Float.valueOf("200000"), - loanSchedule.get(2).get("interestOriginalDue")); + assertEquals(new ArrayList<>(Arrays.asList(2014, 8, 2)), + loanSchedule.get(2).get("dueDate"), + "Checking for Due Date for 2nd Month"); + validateNumberForEqualWithMsg("0.0", String.valueOf(loanSchedule.get(2).get("principalOriginalDue")), + "Checking for Principal Due for 2nd Month"); + assertEquals(Float.valueOf("200000"), + loanSchedule.get(2).get("interestOriginalDue"), + "Checking for Interest Due for 2nd Month"); - assertEquals("Checking for Due Date for 3rd Month", new ArrayList<>(Arrays.asList(2014, 9, 2)), - loanSchedule.get(3).get("dueDate")); - validateNumberForEqualWithMsg("Checking for Principal Due for 3rd Month", "0.0", - String.valueOf(loanSchedule.get(3).get("principalDue"))); - assertEquals("Checking for Interest Due for 3rd Month", Float.valueOf("200000"), - loanSchedule.get(3).get("interestOriginalDue")); + assertEquals(new ArrayList<>(Arrays.asList(2014, 9, 2)), + loanSchedule.get(3).get("dueDate"), + "Checking for Due Date for 3rd Month"); + validateNumberForEqualWithMsg("0.0", String.valueOf(loanSchedule.get(3).get("principalDue")), + "Checking for Principal Due for 3rd Month"); + assertEquals(Float.valueOf("200000"), loanSchedule.get(3).get("interestOriginalDue"), + "Checking for Interest Due for 3rd Month"); - assertEquals("Checking for Due Date for 4th Month", new ArrayList<>(Arrays.asList(2014, 10, 2)), - loanSchedule.get(4).get("dueDate")); - validateNumberForEqualWithMsg("Checking for Principal Due for 4th Month", "0", - String.valueOf(loanSchedule.get(4).get("principalDue"))); - assertEquals("Checking for Interest Due for 4th Month", Float.valueOf("200000"), - loanSchedule.get(4).get("interestOriginalDue")); + assertEquals(new ArrayList<>(Arrays.asList(2014, 10, 2)), + loanSchedule.get(4).get("dueDate"), + "Checking for Due Date for 4th Month"); + validateNumberForEqualWithMsg("0", String.valueOf(loanSchedule.get(4).get("principalDue")), + "Checking for Principal Due for 4th Month"); + assertEquals(Float.valueOf("200000"), + loanSchedule.get(4).get("interestOriginalDue"), + "Checking for Interest Due for 4th Month"); - assertEquals("Checking for Due Date for 5th Month", new ArrayList<>(Arrays.asList(2014, 11, 2)), - loanSchedule.get(5).get("dueDate")); + assertEquals(new ArrayList<>(Arrays.asList(2014, 11, 2)), + loanSchedule.get(5).get("dueDate"), + "Checking for Due Date for 5th Month"); validateNumberForEqualWithMsg("Checking for Principal Due for 5th Month", "0", String.valueOf(loanSchedule.get(5).get("principalDue"))); - assertEquals("Checking for Interest Due for 5th Month", Float.valueOf("200000"), - loanSchedule.get(5).get("interestOriginalDue")); + assertEquals(Float.valueOf("200000"), + loanSchedule.get(5).get("interestOriginalDue"), + "Checking for Interest Due for 5th Month"); - assertEquals("Checking for Due Date for 6th Month", new ArrayList<>(Arrays.asList(2014, 12, 2)), - loanSchedule.get(6).get("dueDate")); - assertEquals("Checking for Principal Due for 6th Month", Float.valueOf("526300"), - loanSchedule.get(6).get("principalDue")); - assertEquals("Checking for Interest Due for 6th Month", Float.valueOf("200000"), - loanSchedule.get(6).get("interestOriginalDue")); + assertEquals(new ArrayList<>(Arrays.asList(2014, 12, 2)), + loanSchedule.get(6).get("dueDate"), + "Checking for Due Date for 6th Month"); + assertEquals(Float.valueOf("526300"), + loanSchedule.get(6).get("principalDue"), + "Checking for Principal Due for 6th Month"); + assertEquals(Float.valueOf("200000"), + loanSchedule.get(6).get("interestOriginalDue"), + "Checking for Interest Due for 6th Month"); - assertEquals("Checking for Due Date for 7th Month", new ArrayList<>(Arrays.asList(2015, 1, 2)), - loanSchedule.get(7).get("dueDate")); - assertEquals("Checking for Principal Due for 7th Month", Float.valueOf("526300"), - loanSchedule.get(7).get("principalDue")); - assertEquals("Checking for Interest Due for 7th Month", Float.valueOf("189500"), - loanSchedule.get(7).get("interestOriginalDue")); + assertEquals(new ArrayList<>(Arrays.asList(2015, 1, 2)), + loanSchedule.get(7).get("dueDate"), + "Checking for Due Date for 7th Month"); + assertEquals(Float.valueOf("526300"), + loanSchedule.get(7).get("principalDue"), + "Checking for Principal Due for 7th Month"); + assertEquals(Float.valueOf("189500"), + loanSchedule.get(7).get("interestOriginalDue"), + "Checking for Interest Due for 7th Month"); - assertEquals("Checking for Due Date for 10th Month", new ArrayList<>(Arrays.asList(2015, 4, 2)), - loanSchedule.get(10).get("dueDate")); - assertEquals("Checking for Principal Due for 10th Month", Float.valueOf("526300"), - loanSchedule.get(10).get("principalDue")); - assertEquals("Checking for Interest Due for 10th Month", Float.valueOf("157900"), - loanSchedule.get(10).get("interestOriginalDue")); + assertEquals(new ArrayList<>(Arrays.asList(2015, 4, 2)), + loanSchedule.get(10).get("dueDate"), + "Checking for Due Date for 10th Month"); + assertEquals(Float.valueOf("526300"), + loanSchedule.get(10).get("principalDue"), + "Checking for Principal Due for 10th Month"); + assertEquals(Float.valueOf("157900"), + loanSchedule.get(10).get("interestOriginalDue"), + "Checking for Interest Due for 10th Month"); - assertEquals("Checking for Due Date for 20th Month", new ArrayList<>(Arrays.asList(2016, 2, 2)), - loanSchedule.get(20).get("dueDate")); - assertEquals("Checking for Principal Due for 20th Month", Float.valueOf("526300"), - loanSchedule.get(20).get("principalDue")); - assertEquals("Checking for Interest Due for 20th Month", Float.valueOf("52600"), - loanSchedule.get(20).get("interestOriginalDue")); + assertEquals(new ArrayList<>(Arrays.asList(2016, 2, 2)), + loanSchedule.get(20).get("dueDate"), + "Checking for Due Date for 20th Month"); + assertEquals(Float.valueOf("526300"), + loanSchedule.get(20).get("principalDue"), + "Checking for Principal Due for 20th Month"); + assertEquals(Float.valueOf("52600"), + loanSchedule.get(20).get("interestOriginalDue"), + "Checking for Interest Due for 20th Month"); - assertEquals("Checking for Due Date for 24th Month", new ArrayList<>(Arrays.asList(2016, 6, 2)), - loanSchedule.get(24).get("dueDate")); - assertEquals("Checking for Principal Due for 24th Month", Float.valueOf("526600"), - loanSchedule.get(24).get("principalDue")); - assertEquals("Checking for Interest Due for 24th Month", Float.valueOf("10500"), - loanSchedule.get(24).get("interestOriginalDue")); + assertEquals(new ArrayList<>(Arrays.asList(2016, 6, 2)), + loanSchedule.get(24).get("dueDate"), + "Checking for Due Date for 24th Month"); + assertEquals(Float.valueOf("526600"), + loanSchedule.get(24).get("principalDue"), + "Checking for Principal Due for 24th Month"); + assertEquals(Float.valueOf("10500"), + loanSchedule.get(24).get("interestOriginalDue"), + "Checking for Interest Due for 24th Month"); } @@ -1384,7 +1447,7 @@ public class ClientLoanIntegrationTest { final Integer loanProductID = createLoanProduct(false, CASH_BASED, assetAccount, incomeAccount, expenseAccount, overpaymentAccount); final Integer loanID = applyForLoanApplication(clientID, loanProductID, charges, null, "12,000.00"); - Assert.assertNotNull(loanID); + Assertions.assertNotNull(loanID); HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID); LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap); @@ -1572,7 +1635,7 @@ public class ClientLoanIntegrationTest { final Integer loanProductID = createLoanProduct(false, CASH_BASED, assetAccount, incomeAccount, expenseAccount, overpaymentAccount); final Integer loanID = applyForLoanApplication(clientID, loanProductID, charges, null, "12,000.00"); - Assert.assertNotNull(loanID); + Assertions.assertNotNull(loanID); HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID); LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap); @@ -1763,7 +1826,7 @@ public class ClientLoanIntegrationTest { final Integer loanProductID = createLoanProduct(false, CASH_BASED, assetAccount, incomeAccount, expenseAccount, overpaymentAccount); final Integer loanID = applyForLoanApplication(clientID, loanProductID, charges, null, "12,000.00"); - Assert.assertNotNull(loanID); + Assertions.assertNotNull(loanID); HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID); LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap); @@ -1950,7 +2013,7 @@ public class ClientLoanIntegrationTest { final Integer loanProductID = createLoanProduct(false, ACCRUAL_UPFRONT, assetAccount, incomeAccount, expenseAccount, overpaymentAccount); final Integer loanID = applyForLoanApplication(clientID, loanProductID, charges, null, "12,000.00"); - Assert.assertNotNull(loanID); + Assertions.assertNotNull(loanID); HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID); LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap); @@ -2156,7 +2219,7 @@ public class ClientLoanIntegrationTest { final Integer loanProductID = createLoanProduct(false, ACCRUAL_UPFRONT, assetAccount, incomeAccount, expenseAccount, overpaymentAccount); final Integer loanID = applyForLoanApplication(clientID, loanProductID, charges, null, "12,000.00"); - Assert.assertNotNull(loanID); + Assertions.assertNotNull(loanID); HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID); LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap); @@ -2356,7 +2419,7 @@ public class ClientLoanIntegrationTest { final Integer loanProductID = createLoanProduct(false, ACCRUAL_UPFRONT, assetAccount, incomeAccount, expenseAccount, overpaymentAccount); final Integer loanID = applyForLoanApplication(clientID, loanProductID, charges, null, "12,000.00"); - Assert.assertNotNull(loanID); + Assertions.assertNotNull(loanID); HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID); LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap); @@ -2561,7 +2624,7 @@ public class ClientLoanIntegrationTest { final Integer loanProductID = createLoanProduct(false, ACCRUAL_PERIODIC, assetAccount, incomeAccount, expenseAccount, overpaymentAccount); final Integer loanID = applyForLoanApplication(clientID, loanProductID, charges, null, "12,000.00"); - Assert.assertNotNull(loanID); + Assertions.assertNotNull(loanID); HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID); LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap); @@ -2763,7 +2826,7 @@ public class ClientLoanIntegrationTest { final Integer loanProductID = createLoanProduct(false, ACCRUAL_PERIODIC, assetAccount, incomeAccount, expenseAccount, overpaymentAccount); final Integer loanID = applyForLoanApplication(clientID, loanProductID, charges, null, "12,000.00"); - Assert.assertNotNull(loanID); + Assertions.assertNotNull(loanID); HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID); LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap); @@ -2970,7 +3033,7 @@ public class ClientLoanIntegrationTest { final Integer loanProductID = createLoanProduct(false, ACCRUAL_PERIODIC, assetAccount, incomeAccount, expenseAccount, overpaymentAccount); final Integer loanID = applyForLoanApplication(clientID, loanProductID, charges, null, "12,000.00"); - Assert.assertNotNull(loanID); + Assertions.assertNotNull(loanID); HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID); LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap); @@ -3183,7 +3246,7 @@ public class ClientLoanIntegrationTest { * Create loan product with RBI strategy */ final Integer loanProductID = createLoanProduct("100", "0", LoanProductTestBuilder.RBI_INDIA_STRATEGY); - Assert.assertNotNull(loanProductID); + Assertions.assertNotNull(loanProductID); /*** * Apply for loan application and verify loan status @@ -3192,7 +3255,7 @@ public class ClientLoanIntegrationTest { final String principal = "12,000.00"; final Integer loanID = applyForLoanApplicationWithPaymentStrategy(clientID, loanProductID, null, savingsId, principal, LoanApplicationTestBuilder.RBI_INDIA_STRATEGY); - Assert.assertNotNull(loanID); + Assertions.assertNotNull(loanID); HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID); LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap); @@ -3342,7 +3405,7 @@ public class ClientLoanIntegrationTest { final Integer loanID = applyForLoanApplicationForInterestRecalculation(clientID, loanProductID, LOAN_DISBURSEMENT_DATE, null, LoanApplicationTestBuilder.DEFAULT_STRATEGY, new ArrayList(0)); - Assert.assertNotNull(loanID); + Assertions.assertNotNull(loanID); HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID); LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap); @@ -3451,7 +3514,7 @@ public class ClientLoanIntegrationTest { final Integer loanID = applyForLoanApplicationForInterestRecalculation(clientID, loanProductID, LOAN_DISBURSEMENT_DATE, null, LoanApplicationTestBuilder.DEFAULT_STRATEGY, new ArrayList(0)); - Assert.assertNotNull(loanID); + Assertions.assertNotNull(loanID); HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID); LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap); @@ -3535,7 +3598,7 @@ public class ClientLoanIntegrationTest { final Integer loanID = applyForLoanApplicationForInterestRecalculation(clientID, loanProductID, LOAN_DISBURSEMENT_DATE, null, LoanApplicationTestBuilder.DEFAULT_STRATEGY, charges); - Assert.assertNotNull(loanID); + Assertions.assertNotNull(loanID); HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID); LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap); @@ -3632,7 +3695,7 @@ public class ClientLoanIntegrationTest { final Integer loanID = applyForLoanApplicationForInterestRecalculation(clientID, loanProductID, LOAN_DISBURSEMENT_DATE, LoanApplicationTestBuilder.RBI_INDIA_STRATEGY, new ArrayList(0)); - Assert.assertNotNull(loanID); + Assertions.assertNotNull(loanID); HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID); LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap); @@ -3768,7 +3831,7 @@ public class ClientLoanIntegrationTest { final Integer loanID = applyForLoanApplicationForInterestRecalculation(clientID, loanProductID, LOAN_DISBURSEMENT_DATE, LOAN_DISBURSEMENT_DATE, LoanApplicationTestBuilder.DEFAULT_STRATEGY, charges); - Assert.assertNotNull(loanID); + Assertions.assertNotNull(loanID); HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID); LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap); @@ -3902,7 +3965,7 @@ public class ClientLoanIntegrationTest { final Integer loanID = applyForLoanApplicationForInterestRecalculation(clientID, loanProductID, LOAN_DISBURSEMENT_DATE, REST_START_DATE, LoanApplicationTestBuilder.DEFAULT_STRATEGY, charges); - Assert.assertNotNull(loanID); + Assertions.assertNotNull(loanID); HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID); LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap); @@ -3978,7 +4041,7 @@ public class ClientLoanIntegrationTest { Integer overdueFeeChargeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec, ChargesHelper.getLoanOverdueFeeJSONWithCalculattionTypePercentage("10")); - Assert.assertNotNull(overdueFeeChargeId); + Assertions.assertNotNull(overdueFeeChargeId); final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec); ClientHelper.verifyClientCreatedOnServer(this.requestSpec, this.responseSpec, clientID); @@ -3997,7 +4060,7 @@ public class ClientLoanIntegrationTest { final Integer loanID = applyForLoanApplicationForInterestRecalculation(clientID, loanProductID, LOAN_DISBURSEMENT_DATE, REST_START_DATE, LoanApplicationTestBuilder.DEFAULT_STRATEGY, null); - Assert.assertNotNull(loanID); + Assertions.assertNotNull(loanID); HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID); LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap); @@ -4107,7 +4170,7 @@ public class ClientLoanIntegrationTest { final Integer loanID = applyForLoanApplicationForInterestRecalculation(clientID, loanProductID, LOAN_DISBURSEMENT_DATE, null, LoanApplicationTestBuilder.DEFAULT_STRATEGY, new ArrayList(0)); - Assert.assertNotNull(loanID); + Assertions.assertNotNull(loanID); HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID); LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap); @@ -4218,7 +4281,7 @@ public class ClientLoanIntegrationTest { LOAN_DISBURSEMENT_DATE, LOAN_DISBURSEMENT_DATE, LoanApplicationTestBuilder.RBI_INDIA_STRATEGY, new ArrayList(0)); - Assert.assertNotNull(loanID); + Assertions.assertNotNull(loanID); HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID); LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap); @@ -4305,7 +4368,7 @@ public class ClientLoanIntegrationTest { LOAN_DISBURSEMENT_DATE, LOAN_DISBURSEMENT_DATE, LoanApplicationTestBuilder.RBI_INDIA_STRATEGY, new ArrayList(0)); - Assert.assertNotNull(loanID); + Assertions.assertNotNull(loanID); HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID); LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap); @@ -4356,7 +4419,7 @@ public class ClientLoanIntegrationTest { todaysDate.add(Calendar.DAY_OF_MONTH, -7); loanSummary = this.loanTransactionHelper.getLoanSummary(this.requestSpec, this.responseSpec, loanID); dates = (List) loanSummary.get("overdueSinceDate"); - Assert.assertNull(dates); + Assertions.assertNull(dates); } @@ -4395,7 +4458,7 @@ public class ClientLoanIntegrationTest { LOAN_DISBURSEMENT_DATE, LoanApplicationTestBuilder.DEFAULT_STRATEGY, new ArrayList(0), "1", null); - Assert.assertNotNull(loanID); + Assertions.assertNotNull(loanID); HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID); LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap); @@ -4597,8 +4660,8 @@ public class ClientLoanIntegrationTest { LOG.info( "--------------------VERIFYING THE PRINCIPAL DUES,INTEREST DUE AND DUE DATE--------------------------"); for (Map values : expectedvalues) { - assertEquals("Checking for Due Date for installment " + index, values.get("dueDate"), - loanSchedule.get(index).get("dueDate")); + assertEquals(values.get("dueDate"), loanSchedule.get(index).get("dueDate"), + "Checking for Due Date for installment " + index); validateNumberForEqualWithMsg("Checking for Principal Due for installment " + index, String.valueOf(values.get("principalDue")), String.valueOf(loanSchedule.get(index).get("principalDue"))); @@ -4643,7 +4706,7 @@ public class ClientLoanIntegrationTest { final Integer loanProductID = createLoanProduct("0", "0", LoanProductTestBuilder.DEFAULT_STRATEGY, CASH_BASED, assetAccount, incomeAccount, expenseAccount, overpaymentAccount); - Assert.assertNotNull(loanProductID); + Assertions.assertNotNull(loanProductID); /*** * Apply for loan application and verify loan status @@ -4660,7 +4723,7 @@ public class ClientLoanIntegrationTest { final Integer loanID = applyForLoanApplicationWithPaymentStrategyAndPastMonth(clientID, loanProductID, charges, savingsId, principal, LoanApplicationTestBuilder.DEFAULT_STRATEGY, -4); - Assert.assertNotNull(loanID); + Assertions.assertNotNull(loanID); HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID); LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap); @@ -4809,7 +4872,7 @@ public class ClientLoanIntegrationTest { ACCRUAL_UPFRONT, assetAccount, incomeAccount, expenseAccount, overpaymentAccount);// , // LoanProductTestBuilder.EQUAL_INSTALLMENTS, // LoanProductTestBuilder.FLAT_BALANCE); - Assert.assertNotNull(loanProductID); + Assertions.assertNotNull(loanProductID); /*** * Apply for loan application and verify loan status @@ -4826,7 +4889,7 @@ public class ClientLoanIntegrationTest { final Integer loanID = applyForLoanApplicationWithPaymentStrategyAndPastMonth(clientID, loanProductID, charges, savingsId, principal, LoanApplicationTestBuilder.DEFAULT_STRATEGY, -4); - Assert.assertNotNull(loanID); + Assertions.assertNotNull(loanID); HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID); LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap); @@ -4959,15 +5022,15 @@ public class ClientLoanIntegrationTest { final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE); - Assert.assertNotNull(savingsProductID); + Assertions.assertNotNull(savingsProductID); final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(clientID, savingsProductID, ACCOUNT_TYPE_INDIVIDUAL); - Assert.assertNotNull(savingsProductID); + Assertions.assertNotNull(savingsProductID); HashMap modifications = this.savingsAccountHelper.updateSavingsAccount(clientID, savingsProductID, savingsId, ACCOUNT_TYPE_INDIVIDUAL); - Assert.assertTrue(modifications.containsKey("submittedOnDate")); + Assertions.assertTrue(modifications.containsKey("submittedOnDate")); HashMap savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsId); @@ -4990,7 +5053,7 @@ public class ClientLoanIntegrationTest { final Integer loanProductID = createLoanProduct("0", "0", LoanProductTestBuilder.DEFAULT_STRATEGY, CASH_BASED, assetAccount, incomeAccount, expenseAccount, overpaymentAccount); - Assert.assertNotNull(loanProductID); + Assertions.assertNotNull(loanProductID); /*** * Apply for loan application and verify loan status @@ -5007,7 +5070,7 @@ public class ClientLoanIntegrationTest { final Integer loanID = applyForLoanApplicationWithPaymentStrategyAndPastMonth(clientID, loanProductID, charges, null, principal, LoanApplicationTestBuilder.DEFAULT_STRATEGY, -4); - Assert.assertNotNull(loanID); + Assertions.assertNotNull(loanID); HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID); LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap); @@ -5105,8 +5168,8 @@ public class ClientLoanIntegrationTest { toSavingsBalance += TRANSFER_AMOUNT; // Verifying toSavings Account Balance after Account Transfer - assertEquals("Verifying From Savings Account Balance after Account Transfer", toSavingsBalance, - toSavingsSummaryAfter.get("accountBalance")); + assertEquals(toSavingsBalance, toSavingsSummaryAfter.get("accountBalance"), + "Verifying From Savings Account Balance after Account Transfer"); this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, now, new JournalEntry(Float.valueOf("20"), JournalEntry.TransactionType.CREDIT), @@ -5136,8 +5199,8 @@ public class ClientLoanIntegrationTest { toSavingsBalance += TRANSFER_AMOUNT; // Verifying toSavings Account Balance after Account Transfer - assertEquals("Verifying From Savings Account Balance after Account Transfer", toSavingsBalance, - toSavingsSummaryAfter.get("accountBalance")); + assertEquals(toSavingsBalance, toSavingsSummaryAfter.get("accountBalance"), + "Verifying From Savings Account Balance after Account Transfer"); this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, now, new JournalEntry(Float.valueOf("2000"), JournalEntry.TransactionType.CREDIT), @@ -5233,7 +5296,7 @@ public class ClientLoanIntegrationTest { addCharges(charges, flatAmountChargeTwo, "100", "15 December 2011"); final Integer loanID = applyForLoanApplication(clientID, loanProductID, charges, null, "10,000.00"); - Assert.assertNotNull(loanID); + Assertions.assertNotNull(loanID); HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID); LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap); diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/ClientSavingsIntegrationTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/ClientSavingsIntegrationTest.java index 683b314dc..1ba3f74fb 100755 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/ClientSavingsIntegrationTest.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/ClientSavingsIntegrationTest.java @@ -18,7 +18,7 @@ */ package org.apache.fineract.integrationtests; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import io.restassured.builder.RequestSpecBuilder; import io.restassured.builder.ResponseSpecBuilder; @@ -52,9 +52,9 @@ import org.apache.fineract.portfolio.charge.domain.ChargeTimeType; import org.joda.time.LocalDate; import org.joda.time.format.DateTimeFormat; import org.joda.time.format.DateTimeFormatter; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -75,7 +75,7 @@ public class ClientSavingsIntegrationTest { private RequestSpecification requestSpec; private SavingsAccountHelper savingsAccountHelper; - @Before + @BeforeEach public void setup() { Utils.initializeRESTAssured(); this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build(); @@ -88,21 +88,21 @@ public class ClientSavingsIntegrationTest { this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec); final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientID); + Assertions.assertNotNull(clientID); final String minBalanceForInterestCalculation = null; final String minRequiredBalance = null; final String enforceMinRequiredBalance = "false"; final boolean allowOverdraft = false; final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE, minBalanceForInterestCalculation, minRequiredBalance, enforceMinRequiredBalance, allowOverdraft); - Assert.assertNotNull(savingsProductID); + Assertions.assertNotNull(savingsProductID); final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(clientID, savingsProductID, ACCOUNT_TYPE_INDIVIDUAL); - Assert.assertNotNull(savingsProductID); + Assertions.assertNotNull(savingsProductID); HashMap modifications = this.savingsAccountHelper.updateSavingsAccount(clientID, savingsProductID, savingsId, ACCOUNT_TYPE_INDIVIDUAL); - Assert.assertTrue(modifications.containsKey("submittedOnDate")); + Assertions.assertTrue(modifications.containsKey("submittedOnDate")); HashMap savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsId); SavingsStatusChecker.verifySavingsIsPending(savingsStatusHashMap); @@ -120,7 +120,7 @@ public class ClientSavingsIntegrationTest { this.savingsAccountHelper.postInterestForSavings(savingsId); summary = this.savingsAccountHelper.getSavingsSummary(savingsId); - Assert.assertFalse(summaryBefore.equals(summary)); + Assertions.assertFalse(summaryBefore.equals(summary)); final Object savingsInterest = this.savingsAccountHelper.getSavingsInterest(savingsId); // verifySavingsInterest(savingsInterest); @@ -131,21 +131,21 @@ public class ClientSavingsIntegrationTest { this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec); final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientID); + Assertions.assertNotNull(clientID); final String minBalanceForInterestCalculation = "5000"; final String minRequiredBalance = null; final String enforceMinRequiredBalance = "false"; final boolean allowOverdraft = false; final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE, minBalanceForInterestCalculation, minRequiredBalance, enforceMinRequiredBalance, allowOverdraft); - Assert.assertNotNull(savingsProductID); + Assertions.assertNotNull(savingsProductID); final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(clientID, savingsProductID, ACCOUNT_TYPE_INDIVIDUAL); - Assert.assertNotNull(savingsProductID); + Assertions.assertNotNull(savingsProductID); HashMap modifications = this.savingsAccountHelper.updateSavingsAccount(clientID, savingsProductID, savingsId, ACCOUNT_TYPE_INDIVIDUAL); - Assert.assertTrue(modifications.containsKey("submittedOnDate")); + Assertions.assertTrue(modifications.containsKey("submittedOnDate")); HashMap savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsId); SavingsStatusChecker.verifySavingsIsPending(savingsStatusHashMap); @@ -166,7 +166,7 @@ public class ClientSavingsIntegrationTest { assertEquals(summaryBefore, summary); final Object savingsInterest = this.savingsAccountHelper.getSavingsInterest(savingsId); - Assert.assertNull(savingsInterest); + Assertions.assertNull(savingsInterest); } @@ -178,17 +178,17 @@ public class ClientSavingsIntegrationTest { final SavingsAccountHelper validationErrorHelper = new SavingsAccountHelper(this.requestSpec, errorResponse); final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientID); + Assertions.assertNotNull(clientID); final String minBalanceForInterestCalculation = null; final String minRequiredBalance = "1000.0"; final String enforceMinRequiredBalance = "true"; final boolean allowOverdraft = false; final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE, minBalanceForInterestCalculation, minRequiredBalance, enforceMinRequiredBalance, allowOverdraft); - Assert.assertNotNull(savingsProductID); + Assertions.assertNotNull(savingsProductID); final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(clientID, savingsProductID, ACCOUNT_TYPE_INDIVIDUAL); - Assert.assertNotNull(savingsProductID); + Assertions.assertNotNull(savingsProductID); HashMap savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsId); SavingsStatusChecker.verifySavingsIsPending(savingsStatusHashMap); @@ -221,7 +221,7 @@ public class ClientSavingsIntegrationTest { final SavingsAccountHelper validationErrorHelper = new SavingsAccountHelper(this.requestSpec, errorResponse); final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientID); + Assertions.assertNotNull(clientID); final String minBalanceForInterestCalculation = null; final String minRequiredBalance = "1500.0"; final String openningBalance = "1600"; @@ -229,17 +229,17 @@ public class ClientSavingsIntegrationTest { final boolean allowOverdraft = false; final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, openningBalance, minBalanceForInterestCalculation, minRequiredBalance, enforceMinRequiredBalance, allowOverdraft); - Assert.assertNotNull(savingsProductID); + Assertions.assertNotNull(savingsProductID); final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(clientID, savingsProductID, ACCOUNT_TYPE_INDIVIDUAL); - Assert.assertNotNull(savingsProductID); + Assertions.assertNotNull(savingsProductID); HashMap savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsId); SavingsStatusChecker.verifySavingsIsPending(savingsStatusHashMap); final Integer savingsActivationChargeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec, ChargesHelper.getSavingsActivationFeeJSON()); - Assert.assertNotNull(savingsActivationChargeId); + Assertions.assertNotNull(savingsActivationChargeId); this.savingsAccountHelper.addChargesForSavings(savingsId, savingsActivationChargeId, true); @@ -253,7 +253,7 @@ public class ClientSavingsIntegrationTest { Float balance = Float.valueOf(openningBalance); Float chargeAmt = 100f; balance -= chargeAmt; - assertEquals("Verifying opening Balance", balance, summary.get("accountBalance")); + assertEquals(balance, summary.get("accountBalance"), "Verifying opening Balance"); DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy"); Calendar todaysDate = Calendar.getInstance(); @@ -268,15 +268,15 @@ public class ClientSavingsIntegrationTest { TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID); HashMap depositTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, depositTransactionId); balance += Float.valueOf(DEPOSIT_AMOUNT); - assertEquals("Verifying Deposit Amount", Float.valueOf(DEPOSIT_AMOUNT), depositTransaction.get("amount")); - assertEquals("Verifying Balance after Deposit", balance, depositTransaction.get("runningBalance")); + assertEquals(Float.valueOf(DEPOSIT_AMOUNT), depositTransaction.get("amount"), "Verifying Deposit Amount"); + assertEquals(balance, depositTransaction.get("runningBalance"), "Verifying Balance after Deposit"); Integer withdrawTransactionId = (Integer) this.savingsAccountHelper.withdrawalFromSavingsAccount(savingsId, withdrawAmt, TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID); HashMap withdrawTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, withdrawTransactionId); balance -= Float.valueOf(withdrawAmt); - assertEquals("Verifying Withdrawal Amount", Float.valueOf(withdrawAmt), withdrawTransaction.get("amount")); - assertEquals("Verifying Balance after Withdrawal", balance, withdrawTransaction.get("runningBalance")); + assertEquals(Float.valueOf(withdrawAmt), withdrawTransaction.get("amount"), "Verifying Withdrawal Amount"); + assertEquals(balance, withdrawTransaction.get("runningBalance"), "Verifying Balance after Withdrawal"); } @SuppressWarnings("unchecked") @@ -288,17 +288,17 @@ public class ClientSavingsIntegrationTest { new ResponseSpecBuilder().build()); final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientID); + Assertions.assertNotNull(clientID); final String minBalanceForInterestCalculation = null; final String minRequiredBalance = null; final String enforceMinRequiredBalance = "false"; final boolean allowOverdraft = false; final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE, minBalanceForInterestCalculation, minRequiredBalance, enforceMinRequiredBalance, allowOverdraft); - Assert.assertNotNull(savingsProductID); + Assertions.assertNotNull(savingsProductID); final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(clientID, savingsProductID, ACCOUNT_TYPE_INDIVIDUAL); - Assert.assertNotNull(savingsProductID); + Assertions.assertNotNull(savingsProductID); HashMap savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsId); SavingsStatusChecker.verifySavingsIsPending(savingsStatusHashMap); @@ -331,17 +331,17 @@ public class ClientSavingsIntegrationTest { new ResponseSpecBuilder().build()); final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientID); + Assertions.assertNotNull(clientID); final String minBalanceForInterestCalculation = null; final String minRequiredBalance = null; final String enforceMinRequiredBalance = "false"; final boolean allowOverdraft = false; final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE, minBalanceForInterestCalculation, minRequiredBalance, enforceMinRequiredBalance, allowOverdraft); - Assert.assertNotNull(savingsProductID); + Assertions.assertNotNull(savingsProductID); final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(clientID, savingsProductID, ACCOUNT_TYPE_INDIVIDUAL); - Assert.assertNotNull(savingsProductID); + Assertions.assertNotNull(savingsProductID); HashMap savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsId); SavingsStatusChecker.verifySavingsIsPending(savingsStatusHashMap); @@ -376,17 +376,17 @@ public class ClientSavingsIntegrationTest { this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec); final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientID); + Assertions.assertNotNull(clientID); final String minBalanceForInterestCalculation = null; final String minRequiredBalance = null; final String enforceMinRequiredBalance = "false"; final boolean allowOverdraft = false; final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE, minBalanceForInterestCalculation, minRequiredBalance, enforceMinRequiredBalance, allowOverdraft); - Assert.assertNotNull(savingsProductID); + Assertions.assertNotNull(savingsProductID); final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(clientID, savingsProductID, ACCOUNT_TYPE_INDIVIDUAL); - Assert.assertNotNull(savingsProductID); + Assertions.assertNotNull(savingsProductID); HashMap savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsId); SavingsStatusChecker.verifySavingsIsPending(savingsStatusHashMap); @@ -404,17 +404,17 @@ public class ClientSavingsIntegrationTest { new ResponseSpecBuilder().build()); final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientID); + Assertions.assertNotNull(clientID); final String minBalanceForInterestCalculation = null; final String minRequiredBalance = null; final String enforceMinRequiredBalance = "false"; final boolean allowOverdraft = false; final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE, minBalanceForInterestCalculation, minRequiredBalance, enforceMinRequiredBalance, allowOverdraft); - Assert.assertNotNull(savingsProductID); + Assertions.assertNotNull(savingsProductID); final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(clientID, savingsProductID, ACCOUNT_TYPE_INDIVIDUAL); - Assert.assertNotNull(savingsProductID); + Assertions.assertNotNull(savingsProductID); HashMap savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsId); SavingsStatusChecker.verifySavingsIsPending(savingsStatusHashMap); @@ -437,39 +437,39 @@ public class ClientSavingsIntegrationTest { HashMap summary = this.savingsAccountHelper.getSavingsSummary(savingsId); Float balance = Float.valueOf(MINIMUM_OPENING_BALANCE); - assertEquals("Verifying opening Balance", balance, summary.get("accountBalance")); + assertEquals(balance, summary.get("accountBalance"), "Verifying opening Balance"); Integer depositTransactionId = (Integer) this.savingsAccountHelper.depositToSavingsAccount(savingsId, DEPOSIT_AMOUNT, SavingsAccountHelper.TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID); HashMap depositTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, depositTransactionId); balance += Float.valueOf(DEPOSIT_AMOUNT); - assertEquals("Verifying Deposit Amount", Float.valueOf(DEPOSIT_AMOUNT), depositTransaction.get("amount")); - assertEquals("Verifying Balance after Deposit", balance, depositTransaction.get("runningBalance")); + assertEquals(Float.valueOf(DEPOSIT_AMOUNT), depositTransaction.get("amount"), "Verifying Deposit Amount"); + assertEquals(balance, depositTransaction.get("runningBalance"), "Verifying Balance after Deposit"); Integer withdrawTransactionId = (Integer) this.savingsAccountHelper.withdrawalFromSavingsAccount(savingsId, WITHDRAW_AMOUNT, SavingsAccountHelper.TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID); HashMap withdrawTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, withdrawTransactionId); balance -= Float.valueOf(WITHDRAW_AMOUNT); - assertEquals("Verifying Withdrawal Amount", Float.valueOf(WITHDRAW_AMOUNT), withdrawTransaction.get("amount")); - assertEquals("Verifying Balance after Withdrawal", balance, withdrawTransaction.get("runningBalance")); + assertEquals(Float.valueOf(WITHDRAW_AMOUNT), withdrawTransaction.get("amount"), "Verifying Withdrawal Amount"); + assertEquals(balance, withdrawTransaction.get("runningBalance"), "Verifying Balance after Withdrawal"); Integer newWithdrawTransactionId = this.savingsAccountHelper.updateSavingsAccountTransaction(savingsId, withdrawTransactionId, WITHDRAW_AMOUNT_ADJUSTED); HashMap newWithdrawTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, newWithdrawTransactionId); balance = balance + Float.valueOf(WITHDRAW_AMOUNT) - Float.valueOf(WITHDRAW_AMOUNT_ADJUSTED); - assertEquals("Verifying adjusted Amount", Float.valueOf(WITHDRAW_AMOUNT_ADJUSTED), newWithdrawTransaction.get("amount")); - assertEquals("Verifying Balance after adjust", balance, newWithdrawTransaction.get("runningBalance")); + assertEquals(Float.valueOf(WITHDRAW_AMOUNT_ADJUSTED), newWithdrawTransaction.get("amount"), "Verifying adjusted Amount"); + assertEquals(balance, newWithdrawTransaction.get("runningBalance"), "Verifying Balance after adjust"); summary = this.savingsAccountHelper.getSavingsSummary(savingsId); - assertEquals("Verifying Adjusted Balance", balance, summary.get("accountBalance")); + assertEquals(balance, summary.get("accountBalance"), "Verifying Adjusted Balance"); withdrawTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, withdrawTransactionId); - Assert.assertTrue((Boolean) withdrawTransaction.get("reversed")); + Assertions.assertTrue((Boolean) withdrawTransaction.get("reversed")); this.savingsAccountHelper.undoSavingsAccountTransaction(savingsId, newWithdrawTransactionId); newWithdrawTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, withdrawTransactionId); - Assert.assertTrue((Boolean) newWithdrawTransaction.get("reversed")); + Assertions.assertTrue((Boolean) newWithdrawTransaction.get("reversed")); summary = this.savingsAccountHelper.getSavingsSummary(savingsId); balance += Float.valueOf(WITHDRAW_AMOUNT_ADJUSTED); - assertEquals("Verifying Balance After Undo Transaction", balance, summary.get("accountBalance")); + assertEquals(balance, summary.get("accountBalance"), "Verifying Balance After Undo Transaction"); error = (List) savingsAccountHelperValidationError.withdrawalFromSavingsAccount(savingsId, "5000", SavingsAccountHelper.TRANSACTION_DATE, CommonConstants.RESPONSE_ERROR); @@ -505,16 +505,16 @@ public class ClientSavingsIntegrationTest { final SavingsAccountHelper validationErrorHelper = new SavingsAccountHelper(this.requestSpec, erroResponseSpec); final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientID); + Assertions.assertNotNull(clientID); final String minBalanceForInterestCalculation = null; final String minRequiredBalance = null; final String enforceMinRequiredBalance = "false"; final boolean allowOverdraft = false; final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE, minBalanceForInterestCalculation, minRequiredBalance, enforceMinRequiredBalance, allowOverdraft); - Assert.assertNotNull(savingsProductID); + Assertions.assertNotNull(savingsProductID); - Assert.assertNotNull(savingsProductID); + Assertions.assertNotNull(savingsProductID); final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(clientID, savingsProductID, ACCOUNT_TYPE_INDIVIDUAL); HashMap savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsId); @@ -522,21 +522,21 @@ public class ClientSavingsIntegrationTest { final Integer withdrawalChargeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec, ChargesHelper.getSavingsWithdrawalFeeJSON()); - Assert.assertNotNull(withdrawalChargeId); + Assertions.assertNotNull(withdrawalChargeId); this.savingsAccountHelper.addChargesForSavings(savingsId, withdrawalChargeId, false); ArrayList chargesPendingState = this.savingsAccountHelper.getSavingsCharges(savingsId); - Assert.assertEquals(1, chargesPendingState.size()); + Assertions.assertEquals(1, chargesPendingState.size()); Integer savingsChargeId = (Integer) chargesPendingState.get(0).get("id"); HashMap chargeChanges = this.savingsAccountHelper.updateCharges(savingsChargeId, savingsId); - Assert.assertTrue(chargeChanges.containsKey("amount")); + Assertions.assertTrue(chargeChanges.containsKey("amount")); Integer deletedChargeId = this.savingsAccountHelper.deleteCharge(savingsChargeId, savingsId); assertEquals(savingsChargeId, deletedChargeId); chargesPendingState = this.savingsAccountHelper.getSavingsCharges(savingsId); - Assert.assertTrue(chargesPendingState == null || chargesPendingState.size() == 0); + Assertions.assertTrue(chargesPendingState == null || chargesPendingState.size() == 0); savingsStatusHashMap = this.savingsAccountHelper.approveSavings(savingsId); SavingsStatusChecker.verifySavingsIsApproved(savingsStatusHashMap); @@ -545,14 +545,14 @@ public class ClientSavingsIntegrationTest { SavingsStatusChecker.verifySavingsIsActive(savingsStatusHashMap); final Integer chargeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec, ChargesHelper.getSavingsAnnualFeeJSON()); - Assert.assertNotNull(chargeId); + Assertions.assertNotNull(chargeId); ArrayList charges = this.savingsAccountHelper.getSavingsCharges(savingsId); - Assert.assertTrue(charges == null || charges.size() == 0); + Assertions.assertTrue(charges == null || charges.size() == 0); this.savingsAccountHelper.addChargesForSavings(savingsId, chargeId, true); charges = this.savingsAccountHelper.getSavingsCharges(savingsId); - Assert.assertEquals(1, charges.size()); + Assertions.assertEquals(1, charges.size()); HashMap savingsChargeForPay = charges.get(0); Integer annualSavingsChargeId = (Integer) savingsChargeForPay.get("id"); @@ -589,15 +589,15 @@ public class ClientSavingsIntegrationTest { Integer inactivatedChargeId = (Integer) this.savingsAccountHelper.inactivateCharge(annualSavingsChargeId, savingsId, CommonConstants.RESPONSE_RESOURCE_ID); - assertEquals("Inactivated Savings Charges Id", annualSavingsChargeId, inactivatedChargeId); + assertEquals(annualSavingsChargeId, inactivatedChargeId, "Inactivated Savings Charges Id"); final Integer monthlyFeechargeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec, ChargesHelper.getSavingsMonthlyFeeJSON()); - Assert.assertNotNull(monthlyFeechargeId); + Assertions.assertNotNull(monthlyFeechargeId); this.savingsAccountHelper.addChargesForSavings(savingsId, monthlyFeechargeId, true); charges = this.savingsAccountHelper.getSavingsCharges(savingsId); - Assert.assertEquals(2, charges.size()); + Assertions.assertEquals(2, charges.size()); HashMap savingsChargeForWaive = charges.get(1); final Integer monthlySavingsCharge = (Integer) savingsChargeForWaive.get("id"); @@ -619,11 +619,11 @@ public class ClientSavingsIntegrationTest { final Integer weeklyFeeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec, ChargesHelper.getSavingsWeeklyFeeJSON()); - Assert.assertNotNull(weeklyFeeId); + Assertions.assertNotNull(weeklyFeeId); this.savingsAccountHelper.addChargesForSavings(savingsId, weeklyFeeId, true); charges = this.savingsAccountHelper.getSavingsCharges(savingsId); - Assert.assertEquals(3, charges.size()); + Assertions.assertEquals(3, charges.size()); savingsChargeForPay = charges.get(2); final Integer weeklySavingsFeeId = (Integer) savingsChargeForPay.get("id"); @@ -642,7 +642,7 @@ public class ClientSavingsIntegrationTest { // Depositing huge amount as scheduler job deducts the fee amount Integer depositTransactionId = (Integer) this.savingsAccountHelper.depositToSavingsAccount(savingsId, "100000", SavingsAccountHelper.TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID); - Assert.assertNotNull(depositTransactionId); + Assertions.assertNotNull(depositTransactionId); this.savingsAccountHelper.payCharge((Integer) savingsChargeForPay.get("id"), savingsId, ((Float) savingsChargeForPay.get("amount")).toString(), sdf.format(cal.getTime())); @@ -671,7 +671,7 @@ public class ClientSavingsIntegrationTest { * Create a client to apply for savings account (overdraft account). */ final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientID); + Assertions.assertNotNull(clientID); final String minBalanceForInterestCalculation = null; /*** @@ -684,17 +684,17 @@ public class ClientSavingsIntegrationTest { final boolean allowOverdraft = true; final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, zeroOpeningBalance, minBalanceForInterestCalculation, minRequiredBalance, enforceMinRequiredBalance, allowOverdraft); - Assert.assertNotNull(savingsProductID); + Assertions.assertNotNull(savingsProductID); /*** * Apply for Savings account */ final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(clientID, savingsProductID, ACCOUNT_TYPE_INDIVIDUAL); - Assert.assertNotNull(savingsProductID); + Assertions.assertNotNull(savingsProductID); HashMap modifications = this.savingsAccountHelper.updateSavingsAccount(clientID, savingsProductID, savingsId, ACCOUNT_TYPE_INDIVIDUAL); - Assert.assertTrue(modifications.containsKey("submittedOnDate")); + Assertions.assertTrue(modifications.containsKey("submittedOnDate")); HashMap savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsId); SavingsStatusChecker.verifySavingsIsPending(savingsStatusHashMap); @@ -742,8 +742,8 @@ public class ClientSavingsIntegrationTest { ACTIVATION_DATE, CommonConstants.RESPONSE_RESOURCE_ID); HashMap withdrawTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, withdrawTransactionId); balance -= Float.valueOf(WITHDRAW_AMOUNT); - assertEquals("Verifying Withdrawal Amount", Float.valueOf(WITHDRAW_AMOUNT), withdrawTransaction.get("amount")); - assertEquals("Verifying Balance after Withdrawal", balance, withdrawTransaction.get("runningBalance")); + assertEquals(Float.valueOf(WITHDRAW_AMOUNT), withdrawTransaction.get("amount"), "Verifying Withdrawal Amount"); + assertEquals(balance, withdrawTransaction.get("runningBalance"), "Verifying Balance after Withdrawal"); /*** * Perform Deposit transaction on last day of month and verify account @@ -756,8 +756,8 @@ public class ClientSavingsIntegrationTest { TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID); HashMap depositTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, depositTransactionId); balance += Float.valueOf(DEPOSIT_AMOUNT); - assertEquals("Verifying Deposit Amount", Float.valueOf(DEPOSIT_AMOUNT), depositTransaction.get("amount")); - assertEquals("Verifying Balance after Deposit", balance, depositTransaction.get("runningBalance")); + assertEquals(Float.valueOf(DEPOSIT_AMOUNT), depositTransaction.get("amount"), "Verifying Deposit Amount"); + assertEquals(balance, depositTransaction.get("runningBalance"), "Verifying Balance after Deposit"); /*** * Perform Post interest transaction and verify the posted amount @@ -788,7 +788,7 @@ public class ClientSavingsIntegrationTest { decimalFormat.applyPattern("#.###"); interestPosted = Float.valueOf(decimalFormat.format(interestPosted)); actualInterestPosted = Float.valueOf(decimalFormat.format(actualInterestPosted)); - assertEquals("Verifying interest posted", interestPosted, actualInterestPosted); + assertEquals(interestPosted, actualInterestPosted, "Verifying interest posted"); todaysDate = Calendar.getInstance(); final String CLOSEDON_DATE = dateFormat.format(todaysDate.getTime()); @@ -810,7 +810,7 @@ public class ClientSavingsIntegrationTest { */ final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientID); + Assertions.assertNotNull(clientID); final String minBalanceForInterestCalculation = null; /*** @@ -825,7 +825,7 @@ public class ClientSavingsIntegrationTest { this.responseSpec, zeroOpeningBalance, minBalanceForInterestCalculation, minRequiredBalance, enforceMinRequiredBalance, allowOverdraft); - Assert.assertNotNull(savingsProductID); + Assertions.assertNotNull(savingsProductID); /*** * Apply for Savings account @@ -833,11 +833,11 @@ public class ClientSavingsIntegrationTest { final Integer savingsId = this.savingsAccountHelper .applyForSavingsApplication(clientID, savingsProductID, ACCOUNT_TYPE_INDIVIDUAL); - Assert.assertNotNull(savingsProductID); + Assertions.assertNotNull(savingsProductID); HashMap modifications = this.savingsAccountHelper.updateSavingsAccount( clientID, savingsProductID, savingsId, ACCOUNT_TYPE_INDIVIDUAL); - Assert.assertTrue(modifications.containsKey("submittedOnDate")); + Assertions.assertTrue(modifications.containsKey("submittedOnDate")); HashMap savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings( this.requestSpec, this.responseSpec, savingsId); @@ -899,10 +899,10 @@ public class ClientSavingsIntegrationTest { HashMap depositTransaction = this.savingsAccountHelper .getSavingsTransaction(savingsId, depositTransactionId); balance += Float.valueOf(DEPOSIT_AMOUNT); - assertEquals("Verifying Deposit Amount", Float.valueOf(DEPOSIT_AMOUNT), - depositTransaction.get("amount")); - assertEquals("Verifying Balance after Deposit", balance, - depositTransaction.get("runningBalance")); + assertEquals(Float.valueOf(DEPOSIT_AMOUNT), depositTransaction.get("amount"), + "Verifying Deposit Amount"); + assertEquals(balance, depositTransaction.get("runningBalance"), + "Verifying Balance after Deposit"); /*** * Calculate expected interest to be posted, interest should be posted @@ -937,8 +937,8 @@ public class ClientSavingsIntegrationTest { interestPosted = Float.valueOf(decimalFormat.format(interestPosted)); accountDetailsPostInterestPosted = Float.valueOf( decimalFormat.format(accountDetailsPostInterestPosted)); - assertEquals("Verifying interest posted", interestPosted, - accountDetailsPostInterestPosted); + assertEquals(interestPosted, accountDetailsPostInterestPosted, + "Verifying interest posted"); this.savingsAccountHelper.postInterestAsOnSavings(savingsId, TRANSACTION_DATE); @@ -969,8 +969,8 @@ public class ClientSavingsIntegrationTest { interestPosted = Float.valueOf(decimalFormat.format(interestPosted)); accountDetailsPostInterestPosted = Float.valueOf( decimalFormat.format(accountDetailsPostInterestPosted)); - assertEquals("Verifying interest posted", interestPosted, - accountDetailsPostInterestPosted); + assertEquals(interestPosted, accountDetailsPostInterestPosted, + "Verifying interest posted"); LOG.info("-----Post Interest As on Successfully Worked----------"); transactionDate.set(Calendar.DAY_OF_MONTH, 3); @@ -1005,8 +1005,8 @@ public class ClientSavingsIntegrationTest { interestPosted = Float.valueOf(decimalFormat.format(interestPosted)); accountDetailsPostInterestPosted = Float.valueOf( decimalFormat.format(accountDetailsPostInterestPosted)); - assertEquals("Verifying interest posted", interestPosted, - accountDetailsPostInterestPosted); + assertEquals(interestPosted, accountDetailsPostInterestPosted, + "Verifying interest posted"); LOG.info("-----Post Interest As on Successfully Worked-------"); //DateFormat transactionFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US); @@ -1044,8 +1044,8 @@ public class ClientSavingsIntegrationTest { interestPosted = Float.valueOf(decimalFormat.format(interestPosted)); accountDetailsPostInterestPosted = Float.valueOf( decimalFormat.format(accountDetailsPostInterestPosted)); - assertEquals("Verifying interest posted", interestPosted, - accountDetailsPostInterestPosted); + assertEquals(interestPosted, accountDetailsPostInterestPosted, + "Verifying interest posted"); LOG.info("-----Post Interest As on Successfully Worked----------"); } DateFormat lastTransactionDateFormat = new SimpleDateFormat( @@ -1087,8 +1087,8 @@ public class ClientSavingsIntegrationTest { interestPosted = Float.valueOf(decimalFormat.format(interestPosted)); accountDetailsPostInterestPosted = Float.valueOf( decimalFormat.format(accountDetailsPostInterestPosted)); - assertEquals("Verifying interest posted", interestPosted, - accountDetailsPostInterestPosted); + assertEquals(interestPosted, accountDetailsPostInterestPosted, + "Verifying interest posted"); LOG.info("-----Post Interest As on Successfully Worked----------"); } @@ -1123,8 +1123,8 @@ public class ClientSavingsIntegrationTest { interestPosted = Float.valueOf(decimalFormat.format(interestPosted)); accountDetailsPostInterestPosted = Float.valueOf( decimalFormat.format(accountDetailsPostInterestPosted)); - assertEquals("Verifying interest posted", interestPosted, - accountDetailsPostInterestPosted); + assertEquals(interestPosted, accountDetailsPostInterestPosted, + "Verifying interest posted"); LOG.info("-----Post Interest As on Successfully Worked----------"); } @@ -1140,7 +1140,7 @@ public class ClientSavingsIntegrationTest { */ final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientID); + Assertions.assertNotNull(clientID); final String minBalanceForInterestCalculation = null; /*** @@ -1155,7 +1155,7 @@ public class ClientSavingsIntegrationTest { this.responseSpec, zeroOpeningBalance, minBalanceForInterestCalculation, minRequiredBalance, enforceMinRequiredBalance, allowOverdraft); - Assert.assertNotNull(savingsProductID); + Assertions.assertNotNull(savingsProductID); /*** * Apply for Savings account @@ -1163,11 +1163,11 @@ public class ClientSavingsIntegrationTest { final Integer savingsId = this.savingsAccountHelper .applyForSavingsApplication(clientID, savingsProductID, ACCOUNT_TYPE_INDIVIDUAL); - Assert.assertNotNull(savingsProductID); + Assertions.assertNotNull(savingsProductID); HashMap modifications = this.savingsAccountHelper.updateSavingsAccount( clientID, savingsProductID, savingsId, ACCOUNT_TYPE_INDIVIDUAL); - Assert.assertTrue(modifications.containsKey("submittedOnDate")); + Assertions.assertTrue(modifications.containsKey("submittedOnDate")); HashMap savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings( this.requestSpec, this.responseSpec, savingsId); @@ -1225,8 +1225,8 @@ public class ClientSavingsIntegrationTest { ACTIVATION_DATE, CommonConstants.RESPONSE_RESOURCE_ID); HashMap withdrawTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, withdrawTransactionId); balance -= Float.valueOf(WITHDRAW_AMOUNT); - assertEquals("Verifying Withdrawal Amount", Float.valueOf(WITHDRAW_AMOUNT), withdrawTransaction.get("amount")); - assertEquals("Verifying Balance after Withdrawal", balance, withdrawTransaction.get("runningBalance")); + assertEquals(Float.valueOf(WITHDRAW_AMOUNT), withdrawTransaction.get("amount"), "Verifying Withdrawal Amount"); + assertEquals(balance, withdrawTransaction.get("runningBalance"), "Verifying Balance after Withdrawal"); /*** * Perform Deposit transaction on last day of month and verify account @@ -1239,8 +1239,8 @@ public class ClientSavingsIntegrationTest { WITHDRAWAL_DATE, CommonConstants.RESPONSE_RESOURCE_ID); HashMap depositTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, depositTransactionId); balance += Float.valueOf(DEPOSIT_AMOUNT); - assertEquals("Verifying Deposit Amount", Float.valueOf(DEPOSIT_AMOUNT), depositTransaction.get("amount")); - assertEquals("Verifying Balance after Deposit", balance, depositTransaction.get("runningBalance")); + assertEquals(Float.valueOf(DEPOSIT_AMOUNT), depositTransaction.get("amount"), "Verifying Deposit Amount"); + assertEquals(balance, depositTransaction.get("runningBalance"), "Verifying Balance after Deposit"); /*** * Calculate expected interest to be posted, interest should be posted @@ -1275,8 +1275,8 @@ public class ClientSavingsIntegrationTest { interestPosted = Float.valueOf(decimalFormat.format(interestPosted)); accountDetailsPostInterestPosted = Float.valueOf( decimalFormat.format(accountDetailsPostInterestPosted)); - assertEquals("Verifying interest posted", interestPosted, - accountDetailsPostInterestPosted); + assertEquals(interestPosted, accountDetailsPostInterestPosted, + "Verifying interest posted"); this.savingsAccountHelper.postInterestAsOnSavings(savingsId, TRANSACTION_DATE); @@ -1307,8 +1307,8 @@ public class ClientSavingsIntegrationTest { interestPosted = Float.valueOf(decimalFormat.format(interestPosted)); accountDetailsPostInterestPosted = Float.valueOf( decimalFormat.format(accountDetailsPostInterestPosted)); - assertEquals("Verifying interest posted", interestPosted, - accountDetailsPostInterestPosted); + assertEquals(interestPosted, accountDetailsPostInterestPosted, + "Verifying interest posted"); LOG.info("-----Post Interest As on Successfully Worked----------"); transactionDate.set(Calendar.DAY_OF_MONTH, 3); @@ -1343,8 +1343,8 @@ public class ClientSavingsIntegrationTest { interestPosted = Float.valueOf(decimalFormat.format(interestPosted)); accountDetailsPostInterestPosted = Float.valueOf( decimalFormat.format(accountDetailsPostInterestPosted)); - assertEquals("Verifying interest posted", interestPosted, - accountDetailsPostInterestPosted); + assertEquals(interestPosted, accountDetailsPostInterestPosted, + "Verifying interest posted"); LOG.info("-----Post Interest As on Successfully Worked-------"); //DateFormat transactionFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US); @@ -1382,8 +1382,8 @@ public class ClientSavingsIntegrationTest { interestPosted = Float.valueOf(decimalFormat.format(interestPosted)); accountDetailsPostInterestPosted = Float.valueOf( decimalFormat.format(accountDetailsPostInterestPosted)); - assertEquals("Verifying interest posted", interestPosted, - accountDetailsPostInterestPosted); + assertEquals(interestPosted, accountDetailsPostInterestPosted, + "Verifying interest posted"); LOG.info("-----Post Interest As on Successfully Worked----------"); } DateFormat lastTransactionDateFormat = new SimpleDateFormat( @@ -1425,8 +1425,8 @@ public class ClientSavingsIntegrationTest { interestPosted = Float.valueOf(decimalFormat.format(interestPosted)); accountDetailsPostInterestPosted = Float.valueOf( decimalFormat.format(accountDetailsPostInterestPosted)); - assertEquals("Verifying interest posted", interestPosted, - accountDetailsPostInterestPosted); + assertEquals(interestPosted, accountDetailsPostInterestPosted, + "Verifying interest posted"); LOG.info("-----Post Interest As on Successfully Worked----------"); } @@ -1461,8 +1461,8 @@ public class ClientSavingsIntegrationTest { interestPosted = Float.valueOf(decimalFormat.format(interestPosted)); accountDetailsPostInterestPosted = Float.valueOf( decimalFormat.format(accountDetailsPostInterestPosted)); - assertEquals("Verifying interest posted", interestPosted, - accountDetailsPostInterestPosted); + assertEquals(interestPosted,accountDetailsPostInterestPosted, + "Verifying interest posted"); LOG.info("-----Post Interest As on Successfully Worked----------"); } @@ -1476,7 +1476,7 @@ public class ClientSavingsIntegrationTest { * Create a client to apply for savings account (overdraft account). */ final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientID); + Assertions.assertNotNull(clientID); final String minBalanceForInterestCalculation = null; /*** @@ -1489,17 +1489,17 @@ public class ClientSavingsIntegrationTest { final boolean allowOverdraft = true; final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, zeroOpeningBalance, minBalanceForInterestCalculation, minRequiredBalance, enforceMinRequiredBalance, allowOverdraft); - Assert.assertNotNull(savingsProductID); + Assertions.assertNotNull(savingsProductID); /*** * Apply for Savings account */ final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(clientID, savingsProductID, ACCOUNT_TYPE_INDIVIDUAL); - Assert.assertNotNull(savingsProductID); + Assertions.assertNotNull(savingsProductID); HashMap modifications = this.savingsAccountHelper.updateSavingsAccount(clientID, savingsProductID, savingsId, ACCOUNT_TYPE_INDIVIDUAL); - Assert.assertTrue(modifications.containsKey("submittedOnDate")); + Assertions.assertTrue(modifications.containsKey("submittedOnDate")); HashMap savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsId); SavingsStatusChecker.verifySavingsIsPending(savingsStatusHashMap); @@ -1552,8 +1552,8 @@ public class ClientSavingsIntegrationTest { ACTIVATION_DATE, CommonConstants.RESPONSE_RESOURCE_ID); HashMap withdrawTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, withdrawTransactionId); balance -= Float.valueOf(WITHDRAW_AMOUNT); - assertEquals("Verifying Withdrawal Amount", Float.valueOf(WITHDRAW_AMOUNT), withdrawTransaction.get("amount")); - assertEquals("Verifying Balance after Withdrawal", balance, withdrawTransaction.get("runningBalance")); + assertEquals(Float.valueOf(WITHDRAW_AMOUNT), withdrawTransaction.get("amount"), "Verifying Withdrawal Amount"); + assertEquals( balance, withdrawTransaction.get("runningBalance"), "Verifying Balance after Withdrawal"); /*** * Perform Deposit transaction on last day of month and verify account @@ -1566,8 +1566,8 @@ public class ClientSavingsIntegrationTest { TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID); HashMap depositTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, depositTransactionId); balance += Float.valueOf(DEPOSIT_AMOUNT); - assertEquals("Verifying Deposit Amount", Float.valueOf(DEPOSIT_AMOUNT), depositTransaction.get("amount")); - assertEquals("Verifying Balance after Deposit", balance, depositTransaction.get("runningBalance")); + assertEquals(Float.valueOf(DEPOSIT_AMOUNT), depositTransaction.get("amount"), "Verifying Deposit Amount"); + assertEquals(balance, depositTransaction.get("runningBalance"), "Verifying Balance after Deposit"); /*** * Perform Post interest transaction and verify the posted amount @@ -1609,7 +1609,7 @@ public class ClientSavingsIntegrationTest { decimalFormat.applyPattern("#.###"); interestPosted = Float.valueOf(decimalFormat.format(interestPosted)); //actualInterestPosted = Float.valueOf(decimalFormat.format(accountDetailsPostInterestPosted)); - assertEquals("Verifying interest posted", interestPosted, accountDetailsPostInterestPosted); + assertEquals(interestPosted, accountDetailsPostInterestPosted, "Verifying interest posted"); LOG.info("------Post Interest As On After doing a post interest Successfully worked--------"); todaysDate = Calendar.getInstance(); @@ -1648,7 +1648,7 @@ public class ClientSavingsIntegrationTest { * Create a client to apply for savings account (overdraft account). */ final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientID); + Assertions.assertNotNull(clientID); final String minBalanceForInterestCalculation = null; /*** @@ -1661,17 +1661,17 @@ public class ClientSavingsIntegrationTest { final boolean allowOverdraft = true; final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, zeroOpeningBalance, minBalanceForInterestCalculation, minRequiredBalance, enforceMinRequiredBalance, allowOverdraft); - Assert.assertNotNull(savingsProductID); + Assertions.assertNotNull(savingsProductID); /*** * Apply for Savings account */ final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(clientID, savingsProductID, ACCOUNT_TYPE_INDIVIDUAL); - Assert.assertNotNull(savingsProductID); + Assertions.assertNotNull(savingsProductID); HashMap modifications = this.savingsAccountHelper.updateSavingsAccount(clientID, savingsProductID, savingsId, ACCOUNT_TYPE_INDIVIDUAL); - Assert.assertTrue(modifications.containsKey("submittedOnDate")); + Assertions.assertTrue(modifications.containsKey("submittedOnDate")); HashMap savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsId); SavingsStatusChecker.verifySavingsIsPending(savingsStatusHashMap); @@ -1729,8 +1729,8 @@ public class ClientSavingsIntegrationTest { ACTIVATION_DATE, CommonConstants.RESPONSE_RESOURCE_ID); HashMap withdrawTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, withdrawTransactionId); balance -= Float.valueOf(WITHDRAW_AMOUNT); - assertEquals("Verifying Withdrawal Amount", Float.valueOf(WITHDRAW_AMOUNT), withdrawTransaction.get("amount")); - assertEquals("Verifying Balance after Withdrawal", balance, withdrawTransaction.get("runningBalance")); + assertEquals(Float.valueOf(WITHDRAW_AMOUNT), withdrawTransaction.get("amount"), "Verifying Withdrawal Amount"); + assertEquals(balance, withdrawTransaction.get("runningBalance"), "Verifying Balance after Withdrawal"); /*** * Perform Deposit transaction on last day of month and verify account @@ -1743,8 +1743,8 @@ public class ClientSavingsIntegrationTest { TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID); HashMap depositTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, depositTransactionId); balance += Float.valueOf(DEPOSIT_AMOUNT); - assertEquals("Verifying Deposit Amount", Float.valueOf(DEPOSIT_AMOUNT), depositTransaction.get("amount")); - assertEquals("Verifying Balance after Deposit", balance, depositTransaction.get("runningBalance")); + assertEquals(Float.valueOf(DEPOSIT_AMOUNT), depositTransaction.get("amount"), "Verifying Deposit Amount"); + assertEquals(balance, depositTransaction.get("runningBalance"), "Verifying Balance after Deposit"); /*** * Perform Post interest transaction and verify the posted amount @@ -1776,7 +1776,7 @@ public class ClientSavingsIntegrationTest { decimalFormat.applyPattern("#.###"); interestPosted = Float.valueOf(decimalFormat.format(interestPosted)); actualInterestPosted = Float.valueOf(decimalFormat.format(actualInterestPosted)); - assertEquals("Verifying interest posted", interestPosted, actualInterestPosted); + assertEquals(interestPosted, actualInterestPosted, "Verifying interest posted"); LOG.info("------Post Interest As On Successful Worked--------"); this.savingsAccountHelper.postInterestAsOnSavings(savingsId, POSTED_LAST_TRANSACTION_DATE); @@ -1796,7 +1796,7 @@ public class ClientSavingsIntegrationTest { decimalLastFormat.applyPattern("#.###"); interestLastPosted = Float.valueOf(decimalLastFormat.format(interestLastPosted)); actualInterestPosted = Float.valueOf(decimalFormat.format(actualInterestPosted)); - assertEquals("Verifying interest posted", interestLastPosted, actualInterestPosted); + assertEquals(interestLastPosted, actualInterestPosted, "Verifying interest posted"); LOG.info("------Post Interest As On Successful Worked--------"); } @@ -1808,7 +1808,7 @@ public class ClientSavingsIntegrationTest { this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec); final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientID); + Assertions.assertNotNull(clientID); final String minBalanceForInterestCalculation = null; final String minRequiredBalance = null; final String enforceMinRequiredBalance = "false"; @@ -1817,14 +1817,14 @@ public class ClientSavingsIntegrationTest { final Integer taxGroupId = createTaxGroup(percentage); final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE, minBalanceForInterestCalculation, minRequiredBalance, enforceMinRequiredBalance, allowOverdraft, String.valueOf(taxGroupId), false); - Assert.assertNotNull(savingsProductID); + Assertions.assertNotNull(savingsProductID); final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(clientID, savingsProductID, ACCOUNT_TYPE_INDIVIDUAL); - Assert.assertNotNull(savingsProductID); + Assertions.assertNotNull(savingsProductID); HashMap modifications = this.savingsAccountHelper.updateSavingsAccount(clientID, savingsProductID, savingsId, ACCOUNT_TYPE_INDIVIDUAL); - Assert.assertTrue(modifications.containsKey("submittedOnDate")); + Assertions.assertTrue(modifications.containsKey("submittedOnDate")); HashMap savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsId); SavingsStatusChecker.verifySavingsIsPending(savingsStatusHashMap); @@ -1842,12 +1842,12 @@ public class ClientSavingsIntegrationTest { this.savingsAccountHelper.postInterestForSavings(savingsId); summary = this.savingsAccountHelper.getSavingsSummary(savingsId); - Assert.assertFalse(summaryBefore.equals(summary)); - Assert.assertNotNull(summary.get("totalWithholdTax")); + Assertions.assertFalse(summaryBefore.equals(summary)); + Assertions.assertNotNull(summary.get("totalWithholdTax")); Float expected = (Float) summary.get("totalDeposits") + (Float) summary.get("totalInterestPosted") - (Float) summary.get("totalWithholdTax"); Float actual = (Float) summary.get("accountBalance"); - Assert.assertEquals(expected, actual, 1); + Assertions.assertEquals(expected, actual, 1); } @@ -1856,7 +1856,7 @@ public class ClientSavingsIntegrationTest { this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec); final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientID); + Assertions.assertNotNull(clientID); final String minBalanceForInterestCalculation = null; final String minRequiredBalance = null; final String enforceMinRequiredBalance = "false"; @@ -1865,14 +1865,14 @@ public class ClientSavingsIntegrationTest { final Integer taxGroupId = createTaxGroup(percentage); final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE, minBalanceForInterestCalculation, minRequiredBalance, enforceMinRequiredBalance, allowOverdraft, String.valueOf(taxGroupId), false); - Assert.assertNotNull(savingsProductID); + Assertions.assertNotNull(savingsProductID); final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(clientID, savingsProductID, ACCOUNT_TYPE_INDIVIDUAL); - Assert.assertNotNull(savingsProductID); + Assertions.assertNotNull(savingsProductID); HashMap modifications = this.savingsAccountHelper.updateSavingsAccount(clientID, savingsProductID, savingsId, ACCOUNT_TYPE_INDIVIDUAL); - Assert.assertTrue(modifications.containsKey("submittedOnDate")); + Assertions.assertTrue(modifications.containsKey("submittedOnDate")); HashMap savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsId); SavingsStatusChecker.verifySavingsIsPending(savingsStatusHashMap); @@ -1889,15 +1889,15 @@ public class ClientSavingsIntegrationTest { assertEquals(summaryBefore, summary); final HashMap changes = this.savingsAccountHelper.updateSavingsAccountWithHoldTaxStatus(savingsId, false); - Assert.assertTrue(changes.containsKey("withHoldTax")); + Assertions.assertTrue(changes.containsKey("withHoldTax")); this.savingsAccountHelper.postInterestForSavings(savingsId); summary = this.savingsAccountHelper.getSavingsSummary(savingsId); - Assert.assertFalse(summaryBefore.equals(summary)); - Assert.assertNull(summary.get("totalWithholdTax")); + Assertions.assertFalse(summaryBefore.equals(summary)); + Assertions.assertNull(summary.get("totalWithholdTax")); Float expected = (Float) summary.get("totalDeposits") + (Float) summary.get("totalInterestPosted"); Float actual = (Float) summary.get("accountBalance"); - Assert.assertEquals(expected, actual, 1); + Assertions.assertEquals(expected, actual, 1); } @@ -1906,7 +1906,7 @@ public class ClientSavingsIntegrationTest { this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec); final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientID); + Assertions.assertNotNull(clientID); final String minBalanceForInterestCalculation = null; final String minRequiredBalance = null; final String enforceMinRequiredBalance = "false"; @@ -1915,21 +1915,21 @@ public class ClientSavingsIntegrationTest { final Integer taxGroupId = createTaxGroup(percentage); final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE, minBalanceForInterestCalculation, minRequiredBalance, enforceMinRequiredBalance, allowOverdraft, String.valueOf(taxGroupId), true); - Assert.assertNotNull(savingsProductID); + Assertions.assertNotNull(savingsProductID); final Integer savingsChargeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec, ChargesHelper.getSavingsNoActivityFeeJSON()); - Assert.assertNotNull(savingsChargeId); + Assertions.assertNotNull(savingsChargeId); ArrayList savingsList = new ArrayList<>(); for(int i=0; i< 5; i++){ final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(clientID, savingsProductID, ACCOUNT_TYPE_INDIVIDUAL); - Assert.assertNotNull(savingsProductID); + Assertions.assertNotNull(savingsProductID); HashMap modifications = this.savingsAccountHelper.updateSavingsAccount(clientID, savingsProductID, savingsId, ACCOUNT_TYPE_INDIVIDUAL); - Assert.assertTrue(modifications.containsKey("submittedOnDate")); + Assertions.assertTrue(modifications.containsKey("submittedOnDate")); this.savingsAccountHelper.addChargesForSavings(savingsId, savingsChargeId, false); @@ -1945,11 +1945,11 @@ public class ClientSavingsIntegrationTest { } final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(clientID, savingsProductID, ACCOUNT_TYPE_INDIVIDUAL); - Assert.assertNotNull(savingsProductID); + Assertions.assertNotNull(savingsProductID); HashMap modifications = this.savingsAccountHelper.updateSavingsAccount(clientID, savingsProductID, savingsId, ACCOUNT_TYPE_INDIVIDUAL); - Assert.assertTrue(modifications.containsKey("submittedOnDate")); + Assertions.assertTrue(modifications.containsKey("submittedOnDate")); HashMap savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsId); SavingsStatusChecker.verifySavingsIsPending(savingsStatusHashMap); @@ -1977,7 +1977,7 @@ public class ClientSavingsIntegrationTest { Float balance = 3000f; Float chargeAmt = 0f; balance -= chargeAmt; - assertEquals("Verifying account Balance", balance, summary.get("accountBalance")); + assertEquals(balance, summary.get("accountBalance"), "Verifying account Balance"); //VERIFY INACTIVE @@ -1989,7 +1989,7 @@ public class ClientSavingsIntegrationTest { balance = 3000f; chargeAmt = 100f; balance -= chargeAmt; - assertEquals("Verifying account Balance", balance, summary.get("accountBalance")); + assertEquals(balance, summary.get("accountBalance"), "Verifying account Balance"); String TRANSACTION_DATE = formatter.print(new LocalDate()); Integer depositTransactionId = (Integer) this.savingsAccountHelper.depositToSavingsAccount(savingsList.get(1), DEPOSIT_AMOUNT, @@ -2008,7 +2008,7 @@ public class ClientSavingsIntegrationTest { balance = 3000f; chargeAmt = 100f; balance -= chargeAmt; - assertEquals("Verifying account Balance", balance, summary.get("accountBalance")); + assertEquals(balance, summary.get("accountBalance"), "Verifying account Balance"); TRANSACTION_DATE = formatter.print(new LocalDate()); depositTransactionId = (Integer) this.savingsAccountHelper.depositToSavingsAccount(savingsList.get(2), DEPOSIT_AMOUNT, @@ -2024,7 +2024,7 @@ public class ClientSavingsIntegrationTest { savingsStatusHashMap = SavingsStatusChecker.getSubStatusOfSavings(this.requestSpec, this.responseSpec, savingsList.get(3)); SavingsStatusChecker.verifySavingsSubStatusEscheat(savingsStatusHashMap); summary = this.savingsAccountHelper.getSavingsSummary(savingsList.get(3)); - assertEquals("Verifying account Balance", 2900f, summary.get("accountBalance")); + assertEquals(2900f, summary.get("accountBalance"), "Verifying account Balance"); //VERIFY ESCHEAT DUE NO TRANSACTION FROM ACTIVATION savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsList.get(4)); @@ -2032,7 +2032,7 @@ public class ClientSavingsIntegrationTest { savingsStatusHashMap = SavingsStatusChecker.getSubStatusOfSavings(this.requestSpec, this.responseSpec, savingsList.get(4)); SavingsStatusChecker.verifySavingsSubStatusEscheat(savingsStatusHashMap); summary = this.savingsAccountHelper.getSavingsSummary(savingsList.get(4)); - assertEquals("Verifying account Balance", 900f, summary.get("accountBalance")); + assertEquals(900f, summary.get("accountBalance"), "Verifying account Balance"); //VERIFY NON ACTIVE ACCOUNTS ARE NOT AFFECTED savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsList.get(5)); @@ -2110,17 +2110,17 @@ public class ClientSavingsIntegrationTest { new ResponseSpecBuilder().build()); final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientID); + Assertions.assertNotNull(clientID); final String minBalanceForInterestCalculation = null; final String minRequiredBalance = null; final String enforceMinRequiredBalance = "false"; final boolean allowOverdraft = false; final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE, minBalanceForInterestCalculation, minRequiredBalance, enforceMinRequiredBalance, allowOverdraft); - Assert.assertNotNull(savingsProductID); + Assertions.assertNotNull(savingsProductID); final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(clientID, savingsProductID, ACCOUNT_TYPE_INDIVIDUAL); - Assert.assertNotNull(savingsProductID); + Assertions.assertNotNull(savingsProductID); HashMap savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsId); SavingsStatusChecker.verifySavingsIsPending(savingsStatusHashMap); @@ -2153,7 +2153,7 @@ public class ClientSavingsIntegrationTest { SavingsAccountHelper.TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID); HashMap depositTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, depositTransactionId); balance += Float.valueOf(DEPOSIT_AMOUNT); - assertEquals("Verifying Deposit Amount", Float.valueOf(DEPOSIT_AMOUNT), depositTransaction.get("amount")); + assertEquals(Float.valueOf(DEPOSIT_AMOUNT), depositTransaction.get("amount"), "Verifying Deposit Amount"); savingsStatusHashMap = this.savingsAccountHelper.blockDebit(savingsId); SavingsStatusChecker.verifySavingsSubStatusIsDebitBlocked(savingsStatusHashMap); @@ -2166,7 +2166,7 @@ public class ClientSavingsIntegrationTest { SavingsAccountHelper.TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID); depositTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, depositTransactionId); balance += Float.valueOf(DEPOSIT_AMOUNT); - assertEquals("Verifying Deposit Amount", Float.valueOf(DEPOSIT_AMOUNT), depositTransaction.get("amount")); + assertEquals(Float.valueOf(DEPOSIT_AMOUNT), depositTransaction.get("amount"), "Verifying Deposit Amount"); savingsStatusHashMap = this.savingsAccountHelper.unblockDebit(savingsId); SavingsStatusChecker.verifySavingsSubStatusIsNone(savingsStatusHashMap); @@ -2174,7 +2174,7 @@ public class ClientSavingsIntegrationTest { SavingsAccountHelper.TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID); HashMap withdrawTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, withdrawTransactionId); balance -= Float.valueOf(WITHDRAW_AMOUNT); - assertEquals("Verifying Withdrawal Amount", Float.valueOf(WITHDRAW_AMOUNT), withdrawTransaction.get("amount")); + assertEquals(Float.valueOf(WITHDRAW_AMOUNT), withdrawTransaction.get("amount"), "Verifying Withdrawal Amount"); savingsStatusHashMap = this.savingsAccountHelper.blockCredit(savingsId); SavingsStatusChecker.verifySavingsSubStatusIsCreditBlocked(savingsStatusHashMap); @@ -2187,7 +2187,7 @@ public class ClientSavingsIntegrationTest { SavingsAccountHelper.TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID); withdrawTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, withdrawTransactionId); balance -= Float.valueOf(WITHDRAW_AMOUNT); - assertEquals("Verifying Withdrawal Amount", Float.valueOf(WITHDRAW_AMOUNT), withdrawTransaction.get("amount")); + assertEquals(Float.valueOf(WITHDRAW_AMOUNT), withdrawTransaction.get("amount"), "Verifying Withdrawal Amount"); savingsStatusHashMap = this.savingsAccountHelper.unblockCredit(savingsId); SavingsStatusChecker.verifySavingsSubStatusIsNone(savingsStatusHashMap); @@ -2195,7 +2195,7 @@ public class ClientSavingsIntegrationTest { SavingsAccountHelper.TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID); depositTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, depositTransactionId); balance += Float.valueOf(DEPOSIT_AMOUNT); - assertEquals("Verifying Deposit Amount", Float.valueOf(DEPOSIT_AMOUNT), depositTransaction.get("amount")); + assertEquals(Float.valueOf(DEPOSIT_AMOUNT), depositTransaction.get("amount"), "Verifying Deposit Amount"); Integer holdTransactionId = (Integer) this.savingsAccountHelper.holdAmountInSavingsAccount(savingsId, String.valueOf(balance - 100), SavingsAccountHelper.TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID); @@ -2213,7 +2213,7 @@ public class ClientSavingsIntegrationTest { CommonConstants.RESPONSE_RESOURCE_ID); withdrawTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, withdrawTransactionId); balance -= Float.valueOf("300"); - assertEquals("Verifying Withdrawal Amount", Float.valueOf("300"), withdrawTransaction.get("amount")); + assertEquals(Float.valueOf("300"), withdrawTransaction.get("amount"), "Verifying Withdrawal Amount"); } @@ -2228,7 +2228,7 @@ public class ClientSavingsIntegrationTest { //SavingsAccountHelper savingsAccountHelperValidationError = new SavingsAccountHelper(this.requestSpec,new ResponseSpecBuilder().build()); final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientID); + Assertions.assertNotNull(clientID); final String minBalanceForInterestCalculation = null; final String minRequiredBalance = "500"; final String enforceMinRequiredBalance = "false"; @@ -2237,11 +2237,11 @@ public class ClientSavingsIntegrationTest { final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE, minBalanceForInterestCalculation, minRequiredBalance, enforceMinRequiredBalance, allowOverdraft); - Assert.assertNotNull(savingsProductID); + Assertions.assertNotNull(savingsProductID); final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(clientID, savingsProductID, ACCOUNT_TYPE_INDIVIDUAL); - Assert.assertNotNull(savingsId); + Assertions.assertNotNull(savingsId); HashMap savingsStatusHashMap = this.savingsAccountHelper.approveSavings(savingsId); @@ -2261,7 +2261,7 @@ public class ClientSavingsIntegrationTest { final Integer savingsChargeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec, ChargesHelper.getSavingsJSON(chargeAmount, chargeCurrency, ChargeTimeType.SPECIFIED_DUE_DATE)); - Assert.assertNotNull(savingsChargeId); + Assertions.assertNotNull(savingsChargeId); Integer amount = 300; @@ -2269,20 +2269,20 @@ public class ClientSavingsIntegrationTest { final Integer chargeId = this.savingsAccountHelper.addChargesForSavingsWithDueDate(savingsId, savingsChargeId, SavingsAccountHelper.TRANSACTION_DATE, amount); - Assert.assertNotNull(chargeId); + Assertions.assertNotNull(chargeId); final Integer payChargeId = this.savingsAccountHelper.payCharge(chargeId, savingsId, chargeAmount, SavingsAccountHelper.TRANSACTION_DATE); final Integer undoSavingsTransaction = this.savingsAccountHelper.undoSavingsAccountTransaction(savingsId, depositTransactionId); HashMap reversedDepositTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, depositTransactionId); - Assert.assertTrue((Boolean) reversedDepositTransaction.get("reversed")); + Assertions.assertTrue((Boolean) reversedDepositTransaction.get("reversed")); HashMap summary = this.savingsAccountHelper.getSavingsSummary(savingsId); Float balance = Float.valueOf("-300"); - assertEquals("Verifying opening Balance is -300", balance, summary.get("accountBalance")); + assertEquals(balance, summary.get("accountBalance"), "Verifying opening Balance is -300"); } } diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/ClientStatusChecker.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/ClientStatusChecker.java index 3e684f775..1ba5d4fb9 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/ClientStatusChecker.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/ClientStatusChecker.java @@ -18,7 +18,7 @@ */ package org.apache.fineract.integrationtests; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import java.util.HashMap; import org.slf4j.Logger; diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/ClientTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/ClientTest.java index e7a52b1e5..7c1978bca 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/ClientTest.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/ClientTest.java @@ -26,9 +26,9 @@ import io.restassured.specification.ResponseSpecification; import java.util.HashMap; import org.apache.fineract.integrationtests.common.ClientHelper; import org.apache.fineract.integrationtests.common.Utils; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class ClientTest { @@ -36,7 +36,7 @@ public class ClientTest { private RequestSpecification requestSpec; private ClientHelper clientHelper; - @Before + @BeforeEach public void setup() { Utils.initializeRESTAssured(); this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build(); @@ -49,7 +49,7 @@ public class ClientTest { public void testClientStatus() { this.clientHelper = new ClientHelper(this.requestSpec, this.responseSpec); final Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientId); + Assertions.assertNotNull(clientId); HashMap status = ClientHelper.getClientStatus(requestSpec, responseSpec, String.valueOf(clientId)); ClientStatusChecker.verifyClientIsActive(status); @@ -82,7 +82,7 @@ public class ClientTest { this.clientHelper = new ClientHelper(this.requestSpec, this.responseSpec); final Integer clientId = ClientHelper.createClientAsPerson(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientId); + Assertions.assertNotNull(clientId); HashMap status = ClientHelper.getClientStatus(requestSpec, responseSpec, String.valueOf(clientId)); ClientStatusChecker.verifyClientIsActive(status); @@ -115,7 +115,7 @@ public class ClientTest { this.clientHelper = new ClientHelper(this.requestSpec, this.responseSpec); final Integer clientId = ClientHelper.createClientAsEntity(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientId); + Assertions.assertNotNull(clientId); HashMap status = ClientHelper.getClientStatus(requestSpec, responseSpec, String.valueOf(clientId)); ClientStatusChecker.verifyClientIsActive(status); diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/ClientUndoRejectAndWithdrawalIntegrationTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/ClientUndoRejectAndWithdrawalIntegrationTest.java index 7274538e9..1cbcc05ee 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/ClientUndoRejectAndWithdrawalIntegrationTest.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/ClientUndoRejectAndWithdrawalIntegrationTest.java @@ -18,7 +18,7 @@ */ package org.apache.fineract.integrationtests; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import io.restassured.builder.RequestSpecBuilder; import io.restassured.builder.ResponseSpecBuilder; @@ -34,9 +34,9 @@ import java.util.Locale; import org.apache.fineract.integrationtests.common.ClientHelper; import org.apache.fineract.integrationtests.common.CommonConstants; import org.apache.fineract.integrationtests.common.Utils; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; @SuppressWarnings({ "unused" }) public class ClientUndoRejectAndWithdrawalIntegrationTest { @@ -49,7 +49,7 @@ public class ClientUndoRejectAndWithdrawalIntegrationTest { private RequestSpecification requestSpec; private ClientHelper clientHelper; - @Before + @BeforeEach public void setup() { Utils.initializeRESTAssured(); this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build(); @@ -66,7 +66,7 @@ public class ClientUndoRejectAndWithdrawalIntegrationTest { // CREATE CLIENT this.clientHelper = new ClientHelper(this.requestSpec, this.responseSpec); final Integer clientId = ClientHelper.createClientPending(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientId); + Assertions.assertNotNull(clientId); // GET CLIENT STATUS HashMap status = ClientHelper.getClientStatus(requestSpec, responseSpec, @@ -90,7 +90,7 @@ public class ClientUndoRejectAndWithdrawalIntegrationTest { // CREATE CLIENT this.clientHelper = new ClientHelper(this.requestSpec, this.responseSpec); final Integer clientId = ClientHelper.createClientPending(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientId); + Assertions.assertNotNull(clientId); // GET CLIENT STATUS HashMap status = ClientHelper.getClientStatus(requestSpec, responseSpec, @@ -119,7 +119,7 @@ public class ClientUndoRejectAndWithdrawalIntegrationTest { // CREATE CLIENT this.clientHelper = new ClientHelper(this.requestSpec, this.responseSpec); final Integer clientId = ClientHelper.createClientPending(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientId); + Assertions.assertNotNull(clientId); // GET CLIENT STATUS HashMap status = ClientHelper.getClientStatus(requestSpec, responseSpec, @@ -149,7 +149,7 @@ public class ClientUndoRejectAndWithdrawalIntegrationTest { // CREATE CLIENT this.clientHelper = new ClientHelper(this.requestSpec, this.responseSpec); final Integer clientId = ClientHelper.createClientPending(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientId); + Assertions.assertNotNull(clientId); // GET CLIENT STATUS HashMap status = ClientHelper.getClientStatus(requestSpec, responseSpec, @@ -179,7 +179,7 @@ public class ClientUndoRejectAndWithdrawalIntegrationTest { // CREATE CLIENT this.clientHelper = new ClientHelper(this.requestSpec, this.responseSpec); final Integer clientId = ClientHelper.createClientPending(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientId); + Assertions.assertNotNull(clientId); // GET CLIENT STATUS HashMap status = ClientHelper.getClientStatus(requestSpec, responseSpec, @@ -204,7 +204,7 @@ public class ClientUndoRejectAndWithdrawalIntegrationTest { // CREATE CLIENT this.clientHelper = new ClientHelper(this.requestSpec, this.responseSpec); final Integer clientId = ClientHelper.createClientPending(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientId); + Assertions.assertNotNull(clientId); // GET CLIENT STATUS HashMap status = ClientHelper.getClientStatus(requestSpec, responseSpec, @@ -233,7 +233,7 @@ public class ClientUndoRejectAndWithdrawalIntegrationTest { // CREATE CLIENT this.clientHelper = new ClientHelper(this.requestSpec, this.responseSpec); final Integer clientId = ClientHelper.createClientPending(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientId); + Assertions.assertNotNull(clientId); // GET CLIENT STATUS HashMap status = ClientHelper.getClientStatus(requestSpec, responseSpec, @@ -262,7 +262,7 @@ public class ClientUndoRejectAndWithdrawalIntegrationTest { // CREATE CLIENT this.clientHelper = new ClientHelper(this.requestSpec, this.responseSpec); final Integer clientId = ClientHelper.createClientPending(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientId); + Assertions.assertNotNull(clientId); // GET CLIENT STATUS HashMap status = ClientHelper.getClientStatus(requestSpec, responseSpec, @@ -295,7 +295,7 @@ public class ClientUndoRejectAndWithdrawalIntegrationTest { // CREATE CLIENT this.clientHelper = new ClientHelper(this.requestSpec, this.responseSpec); final Integer clientId = ClientHelper.createClientPending(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientId); + Assertions.assertNotNull(clientId); // GET CLIENT STATUS HashMap status = ClientHelper.getClientStatus(requestSpec, responseSpec, String.valueOf(clientId)); @@ -320,7 +320,7 @@ public class ClientUndoRejectAndWithdrawalIntegrationTest { // CREATE CLIENT this.clientHelper = new ClientHelper(this.requestSpec, this.responseSpec); final Integer clientId = ClientHelper.createClientPending(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientId); + Assertions.assertNotNull(clientId); // GET CLIENT STATUS HashMap status = ClientHelper.getClientStatus(requestSpec, responseSpec, String.valueOf(clientId)); diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/ConcurrencyIntegrationTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/ConcurrencyIntegrationTest.java index ec12ffe2b..3fef8939f 100755 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/ConcurrencyIntegrationTest.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/ConcurrencyIntegrationTest.java @@ -35,8 +35,8 @@ import org.apache.fineract.integrationtests.common.accounting.Account; import org.apache.fineract.integrationtests.common.loans.LoanApplicationTestBuilder; import org.apache.fineract.integrationtests.common.loans.LoanProductTestBuilder; import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -50,7 +50,7 @@ public class ConcurrencyIntegrationTest { final int MYTHREADS = 30; - @Before + @BeforeEach public void setup() { Utils.initializeRESTAssured(); this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build(); diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/CurrenciesTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/CurrenciesTest.java index a5ab83e50..dd9936578 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/CurrenciesTest.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/CurrenciesTest.java @@ -28,9 +28,9 @@ import java.util.Collections; import org.apache.fineract.integrationtests.common.CurrenciesHelper; import org.apache.fineract.integrationtests.common.CurrencyDomain; import org.apache.fineract.integrationtests.common.Utils; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; @SuppressWarnings({ "unused", "rawtypes" }) public class CurrenciesTest { @@ -38,7 +38,7 @@ public class CurrenciesTest { private ResponseSpecification responseSpec; private RequestSpecification requestSpec; - @Before + @BeforeEach public void setup() { Utils.initializeRESTAssured(); this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build(); @@ -52,13 +52,13 @@ public class CurrenciesTest { CurrencyDomain currency = CurrenciesHelper.getCurrencybyCode(requestSpec, responseSpec, "USD"); CurrencyDomain usd = CurrencyDomain.create("USD", "US Dollar", 2, "$", "currency.USD", "US Dollar ($)").build(); - Assert.assertTrue(currency.getDecimalPlaces() >= 0); - Assert.assertNotNull(currency.getName()); - Assert.assertNotNull(currency.getDisplaySymbol()); - Assert.assertNotNull(currency.getDisplayLabel()); - Assert.assertNotNull(currency.getNameCode()); + Assertions.assertTrue(currency.getDecimalPlaces() >= 0); + Assertions.assertNotNull(currency.getName()); + Assertions.assertNotNull(currency.getDisplaySymbol()); + Assertions.assertNotNull(currency.getDisplayLabel()); + Assertions.assertNotNull(currency.getNameCode()); - Assert.assertEquals(usd, currency); + Assertions.assertEquals(usd, currency); } @Test @@ -76,9 +76,9 @@ public class CurrenciesTest { ArrayList currenciesOutput = CurrenciesHelper.updateSelectedCurrencies(this.requestSpec, this.responseSpec, currenciestoUpdate); - Assert.assertNotNull(currenciesOutput); + Assertions.assertNotNull(currenciesOutput); - Assert.assertEquals("Verifying Do Outputed Currencies Match after Updation", currenciestoUpdate, currenciesOutput); + Assertions.assertEquals(currenciestoUpdate, currenciesOutput, "Verifying Do Outputed Currencies Match after Updation"); // Test that output matches updation ArrayList currenciesBeforeUpdate = new ArrayList(); @@ -88,8 +88,8 @@ public class CurrenciesTest { Collections.sort(currenciesBeforeUpdate); ArrayList currenciesAfterUpdate = CurrenciesHelper.getSelectedCurrencies(requestSpec, responseSpec); - Assert.assertNotNull(currenciesAfterUpdate); + Assertions.assertNotNull(currenciesAfterUpdate); - Assert.assertEquals("Verifying Do Selected Currencies Match after Updation", currenciesBeforeUpdate, currenciesAfterUpdate); + Assertions.assertEquals(currenciesBeforeUpdate, currenciesAfterUpdate, "Verifying Do Selected Currencies Match after Updation"); } } \ No newline at end of file diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/CurrencyIntegrationTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/CurrencyIntegrationTest.java index 4d99ccba9..5c5ffefa5 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/CurrencyIntegrationTest.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/CurrencyIntegrationTest.java @@ -25,7 +25,7 @@ import io.restassured.specification.RequestSpecification; import io.restassured.specification.ResponseSpecification; import org.apache.fineract.integrationtests.common.Utils; import org.apache.fineract.integrationtests.common.savings.SavingsAccountHelper; -import org.junit.Before; +import org.junit.jupiter.api.BeforeEach; public class CurrencyIntegrationTest { @@ -34,7 +34,7 @@ public class CurrencyIntegrationTest { private SavingsAccountHelper savingsAccountHelper; - @Before + @BeforeEach public void setup() { Utils.initializeRESTAssured(); this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build(); diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/DisbursalAndRepaymentScheduleTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/DisbursalAndRepaymentScheduleTest.java index 6753b4b85..ee4667701 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/DisbursalAndRepaymentScheduleTest.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/DisbursalAndRepaymentScheduleTest.java @@ -18,8 +18,8 @@ */ package org.apache.fineract.integrationtests; -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.assertTrue; import io.restassured.builder.RequestSpecBuilder; import io.restassured.builder.ResponseSpecBuilder; @@ -40,17 +40,17 @@ import org.apache.fineract.integrationtests.common.loans.LoanProductTestBuilder; import org.apache.fineract.integrationtests.common.loans.LoanRescheduleRequestTestBuilder; import org.apache.fineract.integrationtests.common.loans.LoanStatusChecker; import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; /** * Tests loan schedule change based on group meeting changes and loan * rescheduling **/ @SuppressWarnings({ "rawtypes" }) -@Ignore +@Disabled public class DisbursalAndRepaymentScheduleTest { private ResponseSpecification responseSpec; @@ -71,7 +71,7 @@ public class DisbursalAndRepaymentScheduleTest { private final SimpleDateFormat dateFormatterStandard = new SimpleDateFormat("dd MMMM yyyy"); - @Before + @BeforeEach public void setup() { Utils.initializeRESTAssured(); } @@ -148,7 +148,7 @@ public class DisbursalAndRepaymentScheduleTest { this.loanId = this.loanTransactionHelper.getLoanId(loanApplicationJSON); // Test for loan account is created - Assert.assertNotNull(this.loanId); + Assertions.assertNotNull(this.loanId); HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, this.loanId); @@ -185,8 +185,8 @@ public class DisbursalAndRepaymentScheduleTest { dueDateCalendar.setFirstDayOfWeek(Calendar.MONDAY); dueDateCalendar.set((Integer) dueDateLoanSchedule.get(0), (Integer) dueDateLoanSchedule.get(1) - 1, (Integer) dueDateLoanSchedule.get(2)); - assertEquals("AFTER MEETING CHANGE DATE THE NEXT REPAYMENT SHOULD BE ON TUESDAY", 3, - dueDateCalendar.get(Calendar.DAY_OF_WEEK)); + assertEquals(3, dueDateCalendar.get(Calendar.DAY_OF_WEEK), + "AFTER MEETING CHANGE DATE THE NEXT REPAYMENT SHOULD BE ON TUESDAY"); // system.out.println("---------------------------------CREATING LOAN RESCHEDULE // REQUEST------------------------------------------"); @@ -205,8 +205,8 @@ public class DisbursalAndRepaymentScheduleTest { dueDateLoanSchedule = (ArrayList) ((HashMap) loanRepaymnetSchedule.get(2)).get("dueDate"); dueDateCalendar.set((Integer) dueDateLoanSchedule.get(0), (Integer) dueDateLoanSchedule.get(1) - 1, (Integer) dueDateLoanSchedule.get(2)); - assertEquals("AFTER MEETING CHANGE DATE THE NEXT REPAYMENT SHOULD BE ON TUESDAY, EVEN AFTER LOAN RESCHEDULE REQUEST WAS SENT", - 3, dueDateCalendar.get(Calendar.DAY_OF_WEEK)); + assertEquals(3, dueDateCalendar.get(Calendar.DAY_OF_WEEK), + "AFTER MEETING CHANGE DATE THE NEXT REPAYMENT SHOULD BE ON TUESDAY, EVEN AFTER LOAN RESCHEDULE REQUEST WAS SENT"); // system.out.println("Successfully created loan reschedule request (ID: " + // this.loanRescheduleRequestId + ")"); @@ -229,8 +229,8 @@ public class DisbursalAndRepaymentScheduleTest { dueDateLoanSchedule = (ArrayList) ((HashMap) loanRepaymnetSchedule.get(2)).get("dueDate"); dueDateCalendar.set((Integer) dueDateLoanSchedule.get(0), (Integer) dueDateLoanSchedule.get(1) - 1, (Integer) dueDateLoanSchedule.get(2)); - assertEquals("AFTER MEETING CHANGE DATE THE NEXT REPAYMENT SHOULD BE ON TUESDAY, EVEN AFTER RESCHEDULE", - 3, dueDateCalendar.get(Calendar.DAY_OF_WEEK)); + assertEquals(3, dueDateCalendar.get(Calendar.DAY_OF_WEEK), + "AFTER MEETING CHANGE DATE THE NEXT REPAYMENT SHOULD BE ON TUESDAY, EVEN AFTER RESCHEDULE"); // system.out.println("Successfully changed group meeting date (CAELNDAR ID: " + // this.groupCalendarId // + ") and rescheduled loan (RESCHEDULE ID: " + this.loanRescheduleRequestId + @@ -308,7 +308,7 @@ public class DisbursalAndRepaymentScheduleTest { this.loanId = this.loanTransactionHelper.getLoanId(loanApplicationJSON); // Test for loan account is created - Assert.assertNotNull(this.loanId); + Assertions.assertNotNull(this.loanId); HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, this.loanId); @@ -346,8 +346,8 @@ public class DisbursalAndRepaymentScheduleTest { expectedMaturityCalendar.set((Integer) expectedMaturityDate.get(0), (Integer) expectedMaturityDate.get(1) - 1, (Integer) expectedMaturityDate.get(2)); - assertEquals("AFTER MEETING CHANGE DATE THE EXPECTED MATURITY SHOULD BE ON TUESDAY", 3, - expectedMaturityCalendar.get(Calendar.DAY_OF_WEEK)); + assertEquals(3, expectedMaturityCalendar.get(Calendar.DAY_OF_WEEK), + "AFTER MEETING CHANGE DATE THE EXPECTED MATURITY SHOULD BE ON TUESDAY"); this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpecForStatusCode403); diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/ExternalServicesConfigurationTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/ExternalServicesConfigurationTest.java index fa8bf77cb..732240023 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/ExternalServicesConfigurationTest.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/ExternalServicesConfigurationTest.java @@ -27,9 +27,9 @@ import java.util.ArrayList; import java.util.HashMap; import org.apache.fineract.integrationtests.common.ExternalServicesConfigurationHelper; import org.apache.fineract.integrationtests.common.Utils; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -41,7 +41,7 @@ public class ExternalServicesConfigurationTest { private ExternalServicesConfigurationHelper externalServicesConfigurationHelper; private ResponseSpecification httpStatusForidden; - @Before + @BeforeEach public void setup() { Utils.initializeRESTAssured(); this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build(); @@ -59,7 +59,7 @@ public class ExternalServicesConfigurationTest { String configName = "s3_access_key"; ArrayList externalServicesConfig = this.externalServicesConfigurationHelper .getExternalServicesConfigurationByServiceName(requestSpec, responseSpec, "S3"); - Assert.assertNotNull(externalServicesConfig); + Assertions.assertNotNull(externalServicesConfig); for (Integer configIndex = 0; configIndex < externalServicesConfig.size(); configIndex++) { String name = (String) externalServicesConfig.get(configIndex).get("name"); String value = null; @@ -72,12 +72,12 @@ public class ExternalServicesConfigurationTest { LOG.info( "{} : {}",name, value); HashMap arrayListValue = this.externalServicesConfigurationHelper.updateValueForExternaServicesConfiguration(requestSpec, responseSpec, "S3", name, newValue); - Assert.assertNotNull(arrayListValue.get("value")); - Assert.assertEquals(arrayListValue.get("value"), newValue); + Assertions.assertNotNull(arrayListValue.get("value")); + Assertions.assertEquals(arrayListValue.get("value"), newValue); HashMap arrayListValue1 = this.externalServicesConfigurationHelper.updateValueForExternaServicesConfiguration(requestSpec, responseSpec, "S3", name, value); - Assert.assertNotNull(arrayListValue1.get("value")); - Assert.assertEquals(arrayListValue1.get("value"), value); + Assertions.assertNotNull(arrayListValue1.get("value")); + Assertions.assertEquals(arrayListValue1.get("value"), value); } } @@ -87,7 +87,7 @@ public class ExternalServicesConfigurationTest { configName = "username"; externalServicesConfig = this.externalServicesConfigurationHelper.getExternalServicesConfigurationByServiceName(requestSpec, responseSpec, "SMTP"); - Assert.assertNotNull(externalServicesConfig); + Assertions.assertNotNull(externalServicesConfig); for (Integer configIndex = 0; configIndex < externalServicesConfig.size(); configIndex++) { String name = (String) externalServicesConfig.get(configIndex).get("name"); String value = null; @@ -100,12 +100,12 @@ public class ExternalServicesConfigurationTest { LOG.info("{} : {}",name,value); HashMap arrayListValue = this.externalServicesConfigurationHelper.updateValueForExternaServicesConfiguration(requestSpec, responseSpec, "SMTP", name, newValue); - Assert.assertNotNull(arrayListValue.get("value")); - Assert.assertEquals(arrayListValue.get("value"), newValue); + Assertions.assertNotNull(arrayListValue.get("value")); + Assertions.assertEquals(arrayListValue.get("value"), newValue); HashMap arrayListValue1 = this.externalServicesConfigurationHelper.updateValueForExternaServicesConfiguration(requestSpec, responseSpec, "SMTP", name, value); - Assert.assertNotNull(arrayListValue1.get("value")); - Assert.assertEquals(arrayListValue1.get("value"), value); + Assertions.assertNotNull(arrayListValue1.get("value")); + Assertions.assertEquals(arrayListValue1.get("value"), value); } } diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/FinancialActivityAccountsTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/FinancialActivityAccountsTest.java index 15cdb268f..bd71de52b 100755 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/FinancialActivityAccountsTest.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/FinancialActivityAccountsTest.java @@ -18,7 +18,7 @@ */ package org.apache.fineract.integrationtests; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import io.restassured.builder.RequestSpecBuilder; import io.restassured.builder.ResponseSpecBuilder; @@ -35,10 +35,10 @@ import org.apache.fineract.integrationtests.common.Utils; import org.apache.fineract.integrationtests.common.accounting.Account; import org.apache.fineract.integrationtests.common.accounting.AccountHelper; import org.apache.fineract.integrationtests.common.accounting.FinancialActivityAccountHelper; -import org.junit.After; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; @SuppressWarnings("rawtypes") public class FinancialActivityAccountsTest { @@ -53,7 +53,7 @@ public class FinancialActivityAccountsTest { private final Integer assetTransferFinancialActivityId = FinancialActivity.ASSET_TRANSFER.getValue(); public static final Integer LIABILITY_TRANSFER_FINANCIAL_ACTIVITY_ID = FinancialActivity.LIABILITY_TRANSFER.getValue(); - @Before + @BeforeEach public void setup() { Utils.initializeRESTAssured(); this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build(); @@ -73,14 +73,14 @@ public class FinancialActivityAccountsTest { /** Create a Liability and an Asset Transfer Account **/ Account liabilityTransferAccount = accountHelper.createLiabilityAccount(); Account assetTransferAccount = accountHelper.createAssetAccount(); - Assert.assertNotNull(assetTransferAccount); - Assert.assertNotNull(liabilityTransferAccount); + Assertions.assertNotNull(assetTransferAccount); + Assertions.assertNotNull(liabilityTransferAccount); /*** Create A Financial Activity to Account Mapping **/ Integer financialActivityAccountId = (Integer) financialActivityAccountHelper.createFinancialActivityAccount( LIABILITY_TRANSFER_FINANCIAL_ACTIVITY_ID, liabilityTransferAccount.getAccountID(), responseSpec, CommonConstants.RESPONSE_RESOURCE_ID); - Assert.assertNotNull(financialActivityAccountId); + Assertions.assertNotNull(financialActivityAccountId); /*** * Fetch Created Financial Activity to Account Mapping and validate @@ -93,12 +93,12 @@ public class FinancialActivityAccountsTest { * changes **/ Account newLiabilityTransferAccount = accountHelper.createLiabilityAccount(); - Assert.assertNotNull(newLiabilityTransferAccount); + Assertions.assertNotNull(newLiabilityTransferAccount); HashMap changes = (HashMap) financialActivityAccountHelper.updateFinancialActivityAccount(financialActivityAccountId, LIABILITY_TRANSFER_FINANCIAL_ACTIVITY_ID, newLiabilityTransferAccount.getAccountID(), responseSpec, CommonConstants.RESPONSE_CHANGES); - Assert.assertEquals(newLiabilityTransferAccount.getAccountID(), changes.get("glAccountId")); + Assertions.assertEquals(newLiabilityTransferAccount.getAccountID(), changes.get("glAccountId")); /** Validate update works correctly **/ assertFinancialActivityAccountCreation(financialActivityAccountId, LIABILITY_TRANSFER_FINANCIAL_ACTIVITY_ID, @@ -131,8 +131,8 @@ public class FinancialActivityAccountsTest { /** Should be able to delete a Financial Activity to Account Mapping **/ Integer deletedFinancialActivityAccountId = financialActivityAccountHelper.deleteFinancialActivityAccount( financialActivityAccountId, responseSpec, CommonConstants.RESPONSE_RESOURCE_ID); - Assert.assertNotNull(deletedFinancialActivityAccountId); - Assert.assertEquals(financialActivityAccountId, deletedFinancialActivityAccountId); + Assertions.assertNotNull(deletedFinancialActivityAccountId); + Assertions.assertEquals(financialActivityAccountId, deletedFinancialActivityAccountId); /*** Trying to fetch a Deleted Account Mapping should give me a 404 **/ financialActivityAccountHelper.getFinancialActivityAccount(deletedFinancialActivityAccountId, responseSpecForResourceNotFoundError); @@ -140,22 +140,22 @@ public class FinancialActivityAccountsTest { private void assertFinancialActivityAccountCreation(Integer financialActivityAccountId, Integer financialActivityId, Account glAccount) { HashMap mappingDetails = financialActivityAccountHelper.getFinancialActivityAccount(financialActivityAccountId, responseSpec); - Assert.assertEquals(financialActivityId, ((HashMap) mappingDetails.get("financialActivityData")).get("id")); - Assert.assertEquals(glAccount.getAccountID(), ((HashMap) mappingDetails.get("glAccountData")).get("id")); + Assertions.assertEquals(financialActivityId, ((HashMap) mappingDetails.get("financialActivityData")).get("id")); + Assertions.assertEquals(glAccount.getAccountID(), ((HashMap) mappingDetails.get("glAccountData")).get("id")); } /** * Delete the Financial activities */ - @After + @AfterEach public void tearDown() { List financialActivities = this.financialActivityAccountHelper.getAllFinancialActivityAccounts(this.responseSpec); for (HashMap financialActivity : financialActivities) { Integer financialActivityAccountId = (Integer) financialActivity.get("id"); Integer deletedFinancialActivityAccountId = this.financialActivityAccountHelper.deleteFinancialActivityAccount( financialActivityAccountId, this.responseSpec, CommonConstants.RESPONSE_RESOURCE_ID); - Assert.assertNotNull(deletedFinancialActivityAccountId); - Assert.assertEquals(financialActivityAccountId, deletedFinancialActivityAccountId); + Assertions.assertNotNull(deletedFinancialActivityAccountId); + Assertions.assertEquals(financialActivityAccountId, deletedFinancialActivityAccountId); } } } diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/FixedDepositTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/FixedDepositTest.java index 16bf2154f..3cf612aaf 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/FixedDepositTest.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/FixedDepositTest.java @@ -18,7 +18,7 @@ */ package org.apache.fineract.integrationtests; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import io.restassured.builder.RequestSpecBuilder; import io.restassured.builder.ResponseSpecBuilder; @@ -56,10 +56,10 @@ import org.apache.fineract.integrationtests.common.savings.SavingsProductHelper; import org.apache.fineract.integrationtests.common.savings.SavingsStatusChecker; import org.joda.time.DateTime; import org.joda.time.Months; -import org.junit.After; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -105,7 +105,7 @@ public class FixedDepositTest { // digits. A proper solution would be to implement the exact interest calculation in this test, // and then to compare the exact results - @Before + @BeforeEach public void setup() { Utils.initializeRESTAssured(); this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build(); @@ -160,7 +160,7 @@ public class FixedDepositTest { final String CLOSED_ON_DATE = dateFormat.format(Calendar.getInstance().getTime()); Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientId); + Assertions.assertNotNull(clientId); /*** * Create FD product with CashBased accounting enabled @@ -168,14 +168,14 @@ public class FixedDepositTest { final String accountingRule = CASH_BASED; Integer fixedDepositProductId = createFixedDepositProduct(VALID_FROM, VALID_TO, accountingRule, assetAccount, liabilityAccount, incomeAccount, expenseAccount); - Assert.assertNotNull(fixedDepositProductId); + Assertions.assertNotNull(fixedDepositProductId); /*** * Apply for FD account with created product and verify status */ Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), SUBMITTED_ON_DATE, WHOLE_TERM); - Assert.assertNotNull(fixedDepositAccountId); + Assertions.assertNotNull(fixedDepositAccountId); HashMap fixedDepositAccountStatusHashMap = FixedDepositAccountStatusChecker.getStatusOfFixedDepositAccount(this.requestSpec, this.responseSpec, fixedDepositAccountId.toString()); @@ -210,13 +210,13 @@ public class FixedDepositTest { * Update interest earned of FD account */ fixedDepositAccountId = this.fixedDepositAccountHelper.calculateInterestForFixedDeposit(fixedDepositAccountId); - Assert.assertNotNull(fixedDepositAccountId); + Assertions.assertNotNull(fixedDepositAccountId); /*** * Post interest and verify the account summary */ Integer transactionIdForPostInterest = this.fixedDepositAccountHelper.postInterestForFixedDeposit(fixedDepositAccountId); - Assert.assertNotNull(transactionIdForPostInterest); + Assertions.assertNotNull(transactionIdForPostInterest); accountSummary = this.fixedDepositAccountHelper.getFixedDepositSummary(fixedDepositAccountId); Float totalInterestPosted = (Float) accountSummary.get("totalInterestPosted"); @@ -234,7 +234,7 @@ public class FixedDepositTest { Integer prematureClosureTransactionId = (Integer) this.fixedDepositAccountHelper.prematureCloseForFixedDeposit( fixedDepositAccountId, CLOSED_ON_DATE, CLOSURE_TYPE_WITHDRAW_DEPOSIT, null, CommonConstants.RESPONSE_RESOURCE_ID); - Assert.assertNotNull(prematureClosureTransactionId); + Assertions.assertNotNull(prematureClosureTransactionId); fixedDepositAccountStatusHashMap = FixedDepositAccountStatusChecker.getStatusOfFixedDepositAccount(this.requestSpec, this.responseSpec, fixedDepositAccountId.toString()); @@ -296,7 +296,7 @@ public class FixedDepositTest { final String CLOSED_ON_DATE = dateFormat.format(Calendar.getInstance().getTime()); Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientId); + Assertions.assertNotNull(clientId); /*** * Create FD product with CashBased accounting enabled @@ -305,14 +305,14 @@ public class FixedDepositTest { final Integer taxGroupId = createTaxGroup("10", liabilityAccountForTax); Integer fixedDepositProductId = createFixedDepositProductWithWithHoldTax(VALID_FROM, VALID_TO, String.valueOf(taxGroupId), accountingRule, assetAccount, liabilityAccount, incomeAccount, expenseAccount); - Assert.assertNotNull(fixedDepositProductId); + Assertions.assertNotNull(fixedDepositProductId); /*** * Apply for FD account with created product and verify status */ Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), SUBMITTED_ON_DATE, WHOLE_TERM); - Assert.assertNotNull(fixedDepositAccountId); + Assertions.assertNotNull(fixedDepositAccountId); HashMap fixedDepositAccountStatusHashMap = FixedDepositAccountStatusChecker.getStatusOfFixedDepositAccount(this.requestSpec, this.responseSpec, fixedDepositAccountId.toString()); @@ -347,17 +347,17 @@ public class FixedDepositTest { * Update interest earned of FD account */ fixedDepositAccountId = this.fixedDepositAccountHelper.calculateInterestForFixedDeposit(fixedDepositAccountId); - Assert.assertNotNull(fixedDepositAccountId); + Assertions.assertNotNull(fixedDepositAccountId); /*** * Post interest and verify the account summary */ Integer transactionIdForPostInterest = this.fixedDepositAccountHelper.postInterestForFixedDeposit(fixedDepositAccountId); - Assert.assertNotNull(transactionIdForPostInterest); + Assertions.assertNotNull(transactionIdForPostInterest); accountSummary = this.fixedDepositAccountHelper.getFixedDepositSummary(fixedDepositAccountId); Float totalInterestPosted = (Float) accountSummary.get("totalInterestPosted"); - Assert.assertNull(accountSummary.get("totalWithholdTax")); + Assertions.assertNull(accountSummary.get("totalWithholdTax")); /*** * Verify journal entries transactions for interest posting transaction @@ -372,7 +372,7 @@ public class FixedDepositTest { Integer prematureClosureTransactionId = (Integer) this.fixedDepositAccountHelper.prematureCloseForFixedDeposit( fixedDepositAccountId, CLOSED_ON_DATE, CLOSURE_TYPE_WITHDRAW_DEPOSIT, null, CommonConstants.RESPONSE_RESOURCE_ID); - Assert.assertNotNull(prematureClosureTransactionId); + Assertions.assertNotNull(prematureClosureTransactionId); fixedDepositAccountStatusHashMap = FixedDepositAccountStatusChecker.getStatusOfFixedDepositAccount(this.requestSpec, this.responseSpec, fixedDepositAccountId.toString()); @@ -386,7 +386,7 @@ public class FixedDepositTest { Float maturityAmount = Float.valueOf(accountDetails.get("maturityAmount").toString()); HashMap summary = (HashMap) accountDetails.get("summary"); - Assert.assertNotNull(summary.get("totalWithholdTax")); + Assertions.assertNotNull(summary.get("totalWithholdTax")); Float withHoldTax = (Float) summary.get("totalWithholdTax"); this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, CLOSED_ON_DATE, new JournalEntry(maturityAmount, @@ -441,7 +441,7 @@ public class FixedDepositTest { final String CLOSED_ON_DATE = dateFormat.format(closedOn.getTime()); Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientId); + Assertions.assertNotNull(clientId); /*** * Create FD product with CashBased accounting enabled @@ -450,14 +450,14 @@ public class FixedDepositTest { final Integer taxGroupId = createTaxGroup("10", liabilityAccountForTax); Integer fixedDepositProductId = createFixedDepositProductWithWithHoldTax(VALID_FROM, VALID_TO, String.valueOf(taxGroupId), accountingRule, assetAccount, liabilityAccount, incomeAccount, expenseAccount); - Assert.assertNotNull(fixedDepositProductId); + Assertions.assertNotNull(fixedDepositProductId); /*** * Apply for FD account with created product and verify status */ Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), SUBMITTED_ON_DATE, WHOLE_TERM); - Assert.assertNotNull(fixedDepositAccountId); + Assertions.assertNotNull(fixedDepositAccountId); HashMap fixedDepositAccountStatusHashMap = FixedDepositAccountStatusChecker.getStatusOfFixedDepositAccount(this.requestSpec, this.responseSpec, fixedDepositAccountId.toString()); @@ -492,17 +492,17 @@ public class FixedDepositTest { * Update interest earned of FD account */ fixedDepositAccountId = this.fixedDepositAccountHelper.calculateInterestForFixedDeposit(fixedDepositAccountId); - Assert.assertNotNull(fixedDepositAccountId); + Assertions.assertNotNull(fixedDepositAccountId); /*** * Post interest and verify the account summary */ Integer transactionIdForPostInterest = this.fixedDepositAccountHelper.postInterestForFixedDeposit(fixedDepositAccountId); - Assert.assertNotNull(transactionIdForPostInterest); + Assertions.assertNotNull(transactionIdForPostInterest); accountSummary = this.fixedDepositAccountHelper.getFixedDepositSummary(fixedDepositAccountId); accountSummary.get("totalInterestPosted"); - Assert.assertNull(accountSummary.get("totalWithholdTax")); + Assertions.assertNull(accountSummary.get("totalWithholdTax")); /*** * FD account verify whether account is matured @@ -516,7 +516,7 @@ public class FixedDepositTest { fixedDepositAccountId); HashMap summary = (HashMap) accountDetails.get("summary"); - Assert.assertNotNull(summary.get("totalWithholdTax")); + Assertions.assertNotNull(summary.get("totalWithholdTax")); Float withHoldTax = (Float) summary.get("totalWithholdTax"); this.journalEntryHelper.checkJournalEntryForLiabilityAccount(liabilityAccountForTax, CLOSED_ON_DATE, new JournalEntry(withHoldTax, JournalEntry.TransactionType.CREDIT)); @@ -651,21 +651,21 @@ public class FixedDepositTest { final String ACTIVATION_DATE = "01 March 2015"; Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientId); + Assertions.assertNotNull(clientId); /*** * Create FD product with CashBased accounting enabled */ final String accountingRule = NONE; Integer fixedDepositProductId = createFixedDepositProduct(VALID_FROM, VALID_TO, accountingRule, chartToUse); - Assert.assertNotNull(fixedDepositProductId); + Assertions.assertNotNull(fixedDepositProductId); /*** * Apply for FD account with created product and verify status */ Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), SUBMITTED_ON_DATE, WHOLE_TERM, depositAmount, depositPeriod); - Assert.assertNotNull(fixedDepositAccountId); + Assertions.assertNotNull(fixedDepositAccountId); HashMap fixedDepositAccountStatusHashMap = FixedDepositAccountStatusChecker.getStatusOfFixedDepositAccount(this.requestSpec, this.responseSpec, fixedDepositAccountId.toString()); @@ -685,7 +685,7 @@ public class FixedDepositTest { HashMap accountSummary = this.fixedDepositAccountHelper.getFixedDepositDetails(fixedDepositAccountId); - Assert.assertEquals(interestRate, accountSummary.get("nominalAnnualInterestRate")); + Assertions.assertEquals(interestRate, accountSummary.get("nominalAnnualInterestRate")); } /*** @@ -732,7 +732,7 @@ public class FixedDepositTest { final String CLOSED_ON_DATE = dateFormat.format(Calendar.getInstance().getTime()); Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientId); + Assertions.assertNotNull(clientId); /*** * Create Savings product with CashBased accounting enabled @@ -740,10 +740,10 @@ public class FixedDepositTest { final String accountingRule = CASH_BASED; final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE, accountingRule, assetAccount, liabilityAccount, incomeAccount, expenseAccount); - Assert.assertNotNull(savingsProductID); + Assertions.assertNotNull(savingsProductID); final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(clientId, savingsProductID, ACCOUNT_TYPE_INDIVIDUAL); - Assert.assertNotNull(savingsProductID); + Assertions.assertNotNull(savingsProductID); HashMap savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsId); SavingsStatusChecker.verifySavingsIsPending(savingsStatusHashMap); @@ -759,11 +759,11 @@ public class FixedDepositTest { */ Integer fixedDepositProductId = createFixedDepositProduct(VALID_FROM, VALID_TO, accountingRule, assetAccount, liabilityAccount, incomeAccount, expenseAccount); - Assert.assertNotNull(fixedDepositProductId); + Assertions.assertNotNull(fixedDepositProductId); Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), SUBMITTED_ON_DATE, WHOLE_TERM); - Assert.assertNotNull(fixedDepositAccountId); + Assertions.assertNotNull(fixedDepositAccountId); HashMap fixedDepositAccountStatusHashMap = FixedDepositAccountStatusChecker.getStatusOfFixedDepositAccount(this.requestSpec, this.responseSpec, fixedDepositAccountId.toString()); @@ -792,13 +792,13 @@ public class FixedDepositTest { * Update interest earned of FD account */ fixedDepositAccountId = this.fixedDepositAccountHelper.calculateInterestForFixedDeposit(fixedDepositAccountId); - Assert.assertNotNull(fixedDepositAccountId); + Assertions.assertNotNull(fixedDepositAccountId); /*** * Post interest and verify the account summary */ Integer transactionIdForPostInterest = this.fixedDepositAccountHelper.postInterestForFixedDeposit(fixedDepositAccountId); - Assert.assertNotNull(transactionIdForPostInterest); + Assertions.assertNotNull(transactionIdForPostInterest); accountSummary = this.fixedDepositAccountHelper.getFixedDepositSummary(fixedDepositAccountId); Float totalInterestPosted = (Float) accountSummary.get("totalInterestPosted"); @@ -827,7 +827,7 @@ public class FixedDepositTest { */ Integer prematureClosureTransactionId = (Integer) this.fixedDepositAccountHelper.prematureCloseForFixedDeposit( fixedDepositAccountId, CLOSED_ON_DATE, CLOSURE_TYPE_TRANSFER_TO_SAVINGS, savingsId, CommonConstants.RESPONSE_RESOURCE_ID); - Assert.assertNotNull(prematureClosureTransactionId); + Assertions.assertNotNull(prematureClosureTransactionId); fixedDepositAccountStatusHashMap = FixedDepositAccountStatusChecker.getStatusOfFixedDepositAccount(this.requestSpec, this.responseSpec, fixedDepositAccountId.toString()); @@ -852,7 +852,7 @@ public class FixedDepositTest { Float balanceAfter = (Float) savingsSummaryAfter.get("accountBalance"); Float expectedSavingsBalance = balanceBefore + prematurityAmount; - Assert.assertEquals("Verifying Savings Account Balance after Premature Closure", expectedSavingsBalance, balanceAfter); + Assertions.assertEquals(expectedSavingsBalance, balanceAfter, "Verifying Savings Account Balance after Premature Closure"); } @@ -903,7 +903,7 @@ public class FixedDepositTest { final String CLOSED_ON_DATE = dateFormat.format(Calendar.getInstance().getTime()); Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientId); + Assertions.assertNotNull(clientId); /*** * Create FD product with CashBased accounting enabled @@ -911,11 +911,11 @@ public class FixedDepositTest { final String accountingRule = CASH_BASED; Integer fixedDepositProductId = createFixedDepositProduct(VALID_FROM, VALID_TO, accountingRule, assetAccount, liabilityAccount, incomeAccount, expenseAccount); - Assert.assertNotNull(fixedDepositProductId); + Assertions.assertNotNull(fixedDepositProductId); Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), SUBMITTED_ON_DATE, WHOLE_TERM); - Assert.assertNotNull(fixedDepositAccountId); + Assertions.assertNotNull(fixedDepositAccountId); HashMap fixedDepositAccountStatusHashMap = FixedDepositAccountStatusChecker.getStatusOfFixedDepositAccount(this.requestSpec, this.responseSpec, fixedDepositAccountId.toString()); @@ -941,10 +941,10 @@ public class FixedDepositTest { this.journalEntryHelper.checkJournalEntryForLiabilityAccount(liabilityAccount, ACTIVATION_DATE, liablilityAccountInitialEntry); fixedDepositAccountId = this.fixedDepositAccountHelper.calculateInterestForFixedDeposit(fixedDepositAccountId); - Assert.assertNotNull(fixedDepositAccountId); + Assertions.assertNotNull(fixedDepositAccountId); Integer transactionIdForPostInterest = this.fixedDepositAccountHelper.postInterestForFixedDeposit(fixedDepositAccountId); - Assert.assertNotNull(transactionIdForPostInterest); + Assertions.assertNotNull(transactionIdForPostInterest); accountSummary = this.fixedDepositAccountHelper.getFixedDepositSummary(fixedDepositAccountId); Float totalInterestPosted = (Float) accountSummary.get("totalInterestPosted"); @@ -988,11 +988,11 @@ public class FixedDepositTest { String SUBMITTED_ON_DATE = dateFormat.format(todaysDate.getTime()); Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientId); + Assertions.assertNotNull(clientId); final String accountingRule = NONE; Integer fixedDepositProductId = createFixedDepositProduct(VALID_FROM, VALID_TO, accountingRule); - Assert.assertNotNull(fixedDepositProductId); + Assertions.assertNotNull(fixedDepositProductId); this.fixedDepositProductHelper.retrieveAllFixedDepositProducts(this.requestSpec, this.responseSpec); @@ -1001,13 +1001,13 @@ public class FixedDepositTest { Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), SUBMITTED_ON_DATE, WHOLE_TERM); - Assert.assertNotNull(fixedDepositAccountId); + Assertions.assertNotNull(fixedDepositAccountId); todaysDate.add(Calendar.DATE, -1); SUBMITTED_ON_DATE = dateFormat.format(todaysDate.getTime()); HashMap modificationsHashMap = this.fixedDepositAccountHelper.updateFixedDepositAccount(clientId.toString(), fixedDepositProductId.toString(), fixedDepositAccountId.toString(), VALID_FROM, VALID_TO, WHOLE_TERM, SUBMITTED_ON_DATE); - Assert.assertTrue(modificationsHashMap.containsKey("submittedOnDate")); + Assertions.assertTrue(modificationsHashMap.containsKey("submittedOnDate")); } @@ -1032,15 +1032,15 @@ public class FixedDepositTest { monthDayFormat.format(todaysDate.getTime()); Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientId); + Assertions.assertNotNull(clientId); final String accountingRule = NONE; Integer fixedDepositProductId = createFixedDepositProduct(VALID_FROM, VALID_TO, accountingRule); - Assert.assertNotNull(fixedDepositProductId); + Assertions.assertNotNull(fixedDepositProductId); Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), SUBMITTED_ON_DATE, WHOLE_TERM); - Assert.assertNotNull(fixedDepositAccountId); + Assertions.assertNotNull(fixedDepositAccountId); HashMap fixedDepositAccountStatusHashMap = FixedDepositAccountStatusChecker.getStatusOfFixedDepositAccount(this.requestSpec, this.responseSpec, fixedDepositAccountId.toString()); @@ -1075,15 +1075,15 @@ public class FixedDepositTest { monthDayFormat.format(todaysDate.getTime()); Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientId); + Assertions.assertNotNull(clientId); final String accountingRule = NONE; Integer fixedDepositProductId = createFixedDepositProduct(VALID_FROM, VALID_TO, accountingRule); - Assert.assertNotNull(fixedDepositProductId); + Assertions.assertNotNull(fixedDepositProductId); Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), SUBMITTED_ON_DATE, WHOLE_TERM); - Assert.assertNotNull(fixedDepositAccountId); + Assertions.assertNotNull(fixedDepositAccountId); HashMap fixedDepositAccountStatusHashMap = FixedDepositAccountStatusChecker.getStatusOfFixedDepositAccount(this.requestSpec, this.responseSpec, fixedDepositAccountId.toString()); @@ -1116,15 +1116,15 @@ public class FixedDepositTest { monthDayFormat.format(todaysDate.getTime()); Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientId); + Assertions.assertNotNull(clientId); final String accountingRule = NONE; Integer fixedDepositProductId = createFixedDepositProduct(VALID_FROM, VALID_TO, accountingRule); - Assert.assertNotNull(fixedDepositProductId); + Assertions.assertNotNull(fixedDepositProductId); Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), SUBMITTED_ON_DATE, WHOLE_TERM); - Assert.assertNotNull(fixedDepositAccountId); + Assertions.assertNotNull(fixedDepositAccountId); HashMap fixedDepositAccountStatusHashMap = FixedDepositAccountStatusChecker.getStatusOfFixedDepositAccount(this.requestSpec, this.responseSpec, fixedDepositAccountId.toString()); @@ -1155,22 +1155,22 @@ public class FixedDepositTest { monthDayFormat.format(todaysDate.getTime()); Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientId); + Assertions.assertNotNull(clientId); final String accountingRule = NONE; Integer fixedDepositProductId = createFixedDepositProduct(VALID_FROM, VALID_TO, accountingRule); - Assert.assertNotNull(fixedDepositProductId); + Assertions.assertNotNull(fixedDepositProductId); Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), SUBMITTED_ON_DATE, WHOLE_TERM); - Assert.assertNotNull(fixedDepositAccountId); + Assertions.assertNotNull(fixedDepositAccountId); HashMap fixedDepositAccountStatusHashMap = FixedDepositAccountStatusChecker.getStatusOfFixedDepositAccount(this.requestSpec, this.responseSpec, fixedDepositAccountId.toString()); FixedDepositAccountStatusChecker.verifyFixedDepositIsPending(fixedDepositAccountStatusHashMap); fixedDepositAccountId = (Integer) this.fixedDepositAccountHelper.deleteFixedDepositApplication(fixedDepositAccountId, "resourceId"); - Assert.assertNotNull(fixedDepositAccountId); + Assertions.assertNotNull(fixedDepositAccountId); } @Test @@ -1198,15 +1198,15 @@ public class FixedDepositTest { monthDayFormat.format(todaysDate.getTime()); Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientId); + Assertions.assertNotNull(clientId); final String accountingRule = NONE; Integer fixedDepositProductId = createFixedDepositProduct(VALID_FROM, VALID_TO, accountingRule); - Assert.assertNotNull(fixedDepositProductId); + Assertions.assertNotNull(fixedDepositProductId); Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), SUBMITTED_ON_DATE, WHOLE_TERM); - Assert.assertNotNull(fixedDepositAccountId); + Assertions.assertNotNull(fixedDepositAccountId); HashMap fixedDepositAccountStatusHashMap = FixedDepositAccountStatusChecker.getStatusOfFixedDepositAccount(this.requestSpec, this.responseSpec, fixedDepositAccountId.toString()); @@ -1238,7 +1238,7 @@ public class FixedDepositTest { principal = (float) Math.floor(principal); maturityAmount = (float) Math.floor(maturityAmount); LOG.info("{}",principal.toString()); - Assert.assertEquals("Verifying Maturity amount for Fixed Deposit Account", principal, maturityAmount); + Assertions.assertEquals(principal, maturityAmount, "Verifying Maturity amount for Fixed Deposit Account"); } @Test @@ -1266,15 +1266,15 @@ public class FixedDepositTest { monthDayFormat.format(todaysDate.getTime()); Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientId); + Assertions.assertNotNull(clientId); final String accountingRule = NONE; Integer fixedDepositProductId = createFixedDepositProduct(VALID_FROM, VALID_TO, accountingRule); - Assert.assertNotNull(fixedDepositProductId); + Assertions.assertNotNull(fixedDepositProductId); Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), SUBMITTED_ON_DATE, WHOLE_TERM); - Assert.assertNotNull(fixedDepositAccountId); + Assertions.assertNotNull(fixedDepositAccountId); this.fixedDepositAccountHelper.updateInterestCalculationConfigForFixedDeposit(clientId.toString(), fixedDepositProductId.toString(), fixedDepositAccountId.toString(), SUBMITTED_ON_DATE, VALID_FROM, VALID_TO, DAYS_360, @@ -1310,7 +1310,7 @@ public class FixedDepositTest { principal = (float) Math.floor(principal); maturityAmount = (float) Math.floor(maturityAmount); LOG.info("{}",principal.toString()); - Assert.assertEquals("Verifying Maturity amount for Fixed Deposit Account", principal, maturityAmount); + Assertions.assertEquals(principal, maturityAmount, "Verifying Maturity amount for Fixed Deposit Account"); } @Test @@ -1342,15 +1342,15 @@ public class FixedDepositTest { final String CLOSED_ON_DATE = dateFormat.format(todaysDate.getTime()); Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientId); + Assertions.assertNotNull(clientId); final String accountingRule = NONE; Integer fixedDepositProductId = createFixedDepositProduct(VALID_FROM, VALID_TO, accountingRule); - Assert.assertNotNull(fixedDepositProductId); + Assertions.assertNotNull(fixedDepositProductId); Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), SUBMITTED_ON_DATE, WHOLE_TERM); - Assert.assertNotNull(fixedDepositAccountId); + Assertions.assertNotNull(fixedDepositAccountId); HashMap fixedDepositAccountStatusHashMap = FixedDepositAccountStatusChecker.getStatusOfFixedDepositAccount(this.requestSpec, this.responseSpec, fixedDepositAccountId.toString()); @@ -1399,7 +1399,7 @@ public class FixedDepositTest { Integer prematureClosureTransactionId = (Integer) this.fixedDepositAccountHelper.prematureCloseForFixedDeposit( fixedDepositAccountId, CLOSED_ON_DATE, CLOSURE_TYPE_WITHDRAW_DEPOSIT, null, CommonConstants.RESPONSE_RESOURCE_ID); - Assert.assertNotNull(prematureClosureTransactionId); + Assertions.assertNotNull(prematureClosureTransactionId); fixedDepositAccountStatusHashMap = FixedDepositAccountStatusChecker.getStatusOfFixedDepositAccount(this.requestSpec, this.responseSpec, fixedDepositAccountId.toString()); @@ -1411,7 +1411,7 @@ public class FixedDepositTest { principal = (float) Math.floor(principal); Float maturityAmount = (float) Math.floor((Float) fixedDepositAccountData.get("maturityAmount")); - Assert.assertEquals("Verifying Pre-Closure maturity amount", principal, maturityAmount); + Assertions.assertEquals(principal, maturityAmount, "Verifying Pre-Closure maturity amount"); } @@ -1444,15 +1444,15 @@ public class FixedDepositTest { final String CLOSED_ON_DATE = dateFormat.format(todaysDate.getTime()); Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientId); + Assertions.assertNotNull(clientId); final String accountingRule = NONE; Integer fixedDepositProductId = createFixedDepositProduct(VALID_FROM, VALID_TO, accountingRule); - Assert.assertNotNull(fixedDepositProductId); + Assertions.assertNotNull(fixedDepositProductId); Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), SUBMITTED_ON_DATE, WHOLE_TERM); - Assert.assertNotNull(fixedDepositAccountId); + Assertions.assertNotNull(fixedDepositAccountId); this.fixedDepositAccountHelper.updateInterestCalculationConfigForFixedDeposit(clientId.toString(), fixedDepositProductId.toString(), fixedDepositAccountId.toString(), SUBMITTED_ON_DATE, VALID_FROM, VALID_TO, DAYS_360, @@ -1505,7 +1505,7 @@ public class FixedDepositTest { Integer prematureClosureTransactionId = (Integer) this.fixedDepositAccountHelper.prematureCloseForFixedDeposit( fixedDepositAccountId, CLOSED_ON_DATE, CLOSURE_TYPE_WITHDRAW_DEPOSIT, null, CommonConstants.RESPONSE_RESOURCE_ID); - Assert.assertNotNull(prematureClosureTransactionId); + Assertions.assertNotNull(prematureClosureTransactionId); fixedDepositAccountStatusHashMap = FixedDepositAccountStatusChecker.getStatusOfFixedDepositAccount(this.requestSpec, this.responseSpec, fixedDepositAccountId.toString()); @@ -1517,7 +1517,7 @@ public class FixedDepositTest { principal = (float) Math.floor(principal); Float maturityAmount = (float) Math.floor((Float) fixedDepositAccountData.get("maturityAmount")); - Assert.assertEquals("Verifying Pre-Closure maturity amount", principal, maturityAmount); + Assertions.assertEquals(principal, maturityAmount, "Verifying Pre-Closure maturity amount"); } @@ -1550,15 +1550,15 @@ public class FixedDepositTest { final String CLOSED_ON_DATE = dateFormat.format(todaysDate.getTime()); Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientId); + Assertions.assertNotNull(clientId); final String accountingRule = NONE; Integer fixedDepositProductId = createFixedDepositProduct(VALID_FROM, VALID_TO, accountingRule); - Assert.assertNotNull(fixedDepositProductId); + Assertions.assertNotNull(fixedDepositProductId); Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), SUBMITTED_ON_DATE, TILL_PREMATURE_WITHDRAWAL); - Assert.assertNotNull(fixedDepositAccountId); + Assertions.assertNotNull(fixedDepositAccountId); HashMap fixedDepositAccountStatusHashMap = FixedDepositAccountStatusChecker.getStatusOfFixedDepositAccount(this.requestSpec, this.responseSpec, fixedDepositAccountId.toString()); @@ -1616,7 +1616,7 @@ public class FixedDepositTest { Integer prematureClosureTransactionId = (Integer) this.fixedDepositAccountHelper.prematureCloseForFixedDeposit( fixedDepositAccountId, CLOSED_ON_DATE, CLOSURE_TYPE_WITHDRAW_DEPOSIT, null, CommonConstants.RESPONSE_RESOURCE_ID); - Assert.assertNotNull(prematureClosureTransactionId); + Assertions.assertNotNull(prematureClosureTransactionId); fixedDepositAccountStatusHashMap = FixedDepositAccountStatusChecker.getStatusOfFixedDepositAccount(this.requestSpec, this.responseSpec, fixedDepositAccountId.toString()); @@ -1628,7 +1628,7 @@ public class FixedDepositTest { Double expectedPrematureAmount = Math.floor(principal); Double maturityAmount = Math.floor((float) fixedDepositAccountData.get("maturityAmount")); - Assert.assertEquals("Verifying Pre-Closure maturity amount", expectedPrematureAmount, maturityAmount); + Assertions.assertEquals(expectedPrematureAmount, maturityAmount, "Verifying Pre-Closure maturity amount"); } @@ -1661,15 +1661,15 @@ public class FixedDepositTest { final String CLOSED_ON_DATE = dateFormat.format(todaysDate.getTime()); Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientId); + Assertions.assertNotNull(clientId); final String accountingRule = NONE; Integer fixedDepositProductId = createFixedDepositProduct(VALID_FROM, VALID_TO, accountingRule); - Assert.assertNotNull(fixedDepositProductId); + Assertions.assertNotNull(fixedDepositProductId); Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), SUBMITTED_ON_DATE, TILL_PREMATURE_WITHDRAWAL); - Assert.assertNotNull(fixedDepositAccountId); + Assertions.assertNotNull(fixedDepositAccountId); this.fixedDepositAccountHelper.updateInterestCalculationConfigForFixedDeposit(clientId.toString(), fixedDepositProductId.toString(), fixedDepositAccountId.toString(), SUBMITTED_ON_DATE, VALID_FROM, VALID_TO, DAYS_360, @@ -1731,7 +1731,7 @@ public class FixedDepositTest { Integer prematureClosureTransactionId = (Integer) this.fixedDepositAccountHelper.prematureCloseForFixedDeposit( fixedDepositAccountId, CLOSED_ON_DATE, CLOSURE_TYPE_WITHDRAW_DEPOSIT, null, CommonConstants.RESPONSE_RESOURCE_ID); - Assert.assertNotNull(prematureClosureTransactionId); + Assertions.assertNotNull(prematureClosureTransactionId); fixedDepositAccountStatusHashMap = FixedDepositAccountStatusChecker.getStatusOfFixedDepositAccount(this.requestSpec, this.responseSpec, fixedDepositAccountId.toString()); @@ -1743,7 +1743,7 @@ public class FixedDepositTest { Float expectedPrematureAmount = (float) Math.floor(principal); Float maturityAmount = (float) Math.floor((Float) fixedDepositAccountData.get("maturityAmount")); - Assert.assertEquals("Verifying Pre-Closure maturity amount", expectedPrematureAmount, maturityAmount); + Assertions.assertEquals(expectedPrematureAmount, maturityAmount, "Verifying Pre-Closure maturity amount"); } @@ -1772,15 +1772,15 @@ public class FixedDepositTest { monthDayFormat.format(todaysDate.getTime()); Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientId); + Assertions.assertNotNull(clientId); final String accountingRule = NONE; Integer fixedDepositProductId = createFixedDepositProduct(VALID_FROM, VALID_TO, accountingRule); - Assert.assertNotNull(fixedDepositProductId); + Assertions.assertNotNull(fixedDepositProductId); Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), SUBMITTED_ON_DATE, WHOLE_TERM); - Assert.assertNotNull(fixedDepositAccountId); + Assertions.assertNotNull(fixedDepositAccountId); this.fixedDepositAccountHelper.updateInterestCalculationConfigForFixedDeposit(clientId.toString(), fixedDepositProductId.toString(), fixedDepositAccountId.toString(), SUBMITTED_ON_DATE, VALID_FROM, VALID_TO, DAYS_365, @@ -1817,7 +1817,7 @@ public class FixedDepositTest { principal = (float) Math.floor(principal); maturityAmount = (float) Math.floor(maturityAmount); LOG.info("{}",principal.toString()); - Assert.assertEquals("Verifying Maturity amount for Fixed Deposit Account", principal, maturityAmount); + Assertions.assertEquals(principal, maturityAmount, "Verifying Maturity amount for Fixed Deposit Account"); } @@ -1847,15 +1847,15 @@ public class FixedDepositTest { LOG.info("Submitted Date: {}" , SUBMITTED_ON_DATE); Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientId); + Assertions.assertNotNull(clientId); final String accountingRule = NONE; Integer fixedDepositProductId = createFixedDepositProduct(VALID_FROM, VALID_TO, accountingRule); - Assert.assertNotNull(fixedDepositProductId); + Assertions.assertNotNull(fixedDepositProductId); Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), SUBMITTED_ON_DATE, WHOLE_TERM); - Assert.assertNotNull(fixedDepositAccountId); + Assertions.assertNotNull(fixedDepositAccountId); this.fixedDepositAccountHelper.updateInterestCalculationConfigForFixedDeposit(clientId.toString(), fixedDepositProductId.toString(), fixedDepositAccountId.toString(), SUBMITTED_ON_DATE, VALID_FROM, VALID_TO, DAYS_360, @@ -1892,7 +1892,7 @@ public class FixedDepositTest { principal = new BigDecimal(principal).setScale(0, RoundingMode.FLOOR).floatValue(); maturityAmount = new BigDecimal(maturityAmount).setScale(0, RoundingMode.FLOOR).floatValue(); LOG.info("{}",principal.toString()); - Assert.assertEquals("Verifying Maturity amount for Fixed Deposit Account", principal, maturityAmount); + Assertions.assertEquals(principal, maturityAmount, "Verifying Maturity amount for Fixed Deposit Account"); } @@ -1927,15 +1927,15 @@ public class FixedDepositTest { monthDayFormat.format(todaysDate.getTime()); Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientId); + Assertions.assertNotNull(clientId); final String accountingRule = NONE; Integer fixedDepositProductId = createFixedDepositProduct(VALID_FROM, VALID_TO, accountingRule); - Assert.assertNotNull(fixedDepositProductId); + Assertions.assertNotNull(fixedDepositProductId); Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), SUBMITTED_ON_DATE, WHOLE_TERM); - Assert.assertNotNull(fixedDepositAccountId); + Assertions.assertNotNull(fixedDepositAccountId); this.fixedDepositAccountHelper.updateInterestCalculationConfigForFixedDeposit(clientId.toString(), fixedDepositProductId.toString(), fixedDepositAccountId.toString(), SUBMITTED_ON_DATE, VALID_FROM, VALID_TO, DAYS_365, @@ -1975,7 +1975,7 @@ public class FixedDepositTest { Double expectedPrematureAmount = Math.floor(principal); Double maturityAmount = Math.floor((Float) fixedDepositAccountData.get("maturityAmount")); - Assert.assertEquals("Verifying Maturity amount", expectedPrematureAmount, maturityAmount); + Assertions.assertEquals(expectedPrematureAmount, maturityAmount, "Verifying Maturity amount"); } @@ -2010,15 +2010,15 @@ public class FixedDepositTest { monthDayFormat.format(todaysDate.getTime()); Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientId); + Assertions.assertNotNull(clientId); final String accountingRule = NONE; Integer fixedDepositProductId = createFixedDepositProduct(VALID_FROM, VALID_TO, accountingRule); - Assert.assertNotNull(fixedDepositProductId); + Assertions.assertNotNull(fixedDepositProductId); Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), SUBMITTED_ON_DATE, WHOLE_TERM); - Assert.assertNotNull(fixedDepositAccountId); + Assertions.assertNotNull(fixedDepositAccountId); this.fixedDepositAccountHelper.updateInterestCalculationConfigForFixedDeposit(clientId.toString(), fixedDepositProductId.toString(), fixedDepositAccountId.toString(), SUBMITTED_ON_DATE, VALID_FROM, VALID_TO, DAYS_360, @@ -2058,7 +2058,7 @@ public class FixedDepositTest { Double expectedPrematureAmount = Math.floor(principal); Double maturityAmount = Math.floor((Float) fixedDepositAccountData.get("maturityAmount")); - Assert.assertEquals("Verifying Maturity amount", expectedPrematureAmount, maturityAmount); + Assertions.assertEquals(expectedPrematureAmount, maturityAmount, "Verifying Maturity amount"); } @@ -2094,15 +2094,15 @@ public class FixedDepositTest { monthDayFormat.format(todaysDate.getTime()); Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientId); + Assertions.assertNotNull(clientId); final String accountingRule = NONE; Integer fixedDepositProductId = createFixedDepositProduct(VALID_FROM, VALID_TO, accountingRule); - Assert.assertNotNull(fixedDepositProductId); + Assertions.assertNotNull(fixedDepositProductId); Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), SUBMITTED_ON_DATE, WHOLE_TERM); - Assert.assertNotNull(fixedDepositAccountId); + Assertions.assertNotNull(fixedDepositAccountId); this.fixedDepositAccountHelper.updateInterestCalculationConfigForFixedDeposit(clientId.toString(), fixedDepositProductId.toString(), fixedDepositAccountId.toString(), SUBMITTED_ON_DATE, VALID_FROM, VALID_TO, DAYS_365, @@ -2139,7 +2139,7 @@ public class FixedDepositTest { Double expectedPrematureAmount = Math.floor(principal); Double maturityAmount = Math.floor((Float) fixedDepositAccountData.get("maturityAmount")); - Assert.assertEquals("Verifying Pre-Closure maturity amount", expectedPrematureAmount, maturityAmount); + Assertions.assertEquals(expectedPrematureAmount, maturityAmount, "Verifying Pre-Closure maturity amount"); } @@ -2175,15 +2175,15 @@ public class FixedDepositTest { monthDayFormat.format(todaysDate.getTime()); Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientId); + Assertions.assertNotNull(clientId); final String accountingRule = NONE; Integer fixedDepositProductId = createFixedDepositProduct(VALID_FROM, VALID_TO, accountingRule); - Assert.assertNotNull(fixedDepositProductId); + Assertions.assertNotNull(fixedDepositProductId); Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), SUBMITTED_ON_DATE, WHOLE_TERM); - Assert.assertNotNull(fixedDepositAccountId); + Assertions.assertNotNull(fixedDepositAccountId); this.fixedDepositAccountHelper.updateInterestCalculationConfigForFixedDeposit(clientId.toString(), fixedDepositProductId.toString(), fixedDepositAccountId.toString(), SUBMITTED_ON_DATE, VALID_FROM, VALID_TO, DAYS_360, @@ -2220,7 +2220,7 @@ public class FixedDepositTest { Double expectedPrematureAmount = Math.floor(principal); Double maturityAmount = Math.floor((Float) fixedDepositAccountData.get("maturityAmount")); - Assert.assertEquals("Verifying Pre-Closure maturity amount", expectedPrematureAmount, maturityAmount); + Assertions.assertEquals(expectedPrematureAmount, maturityAmount, "Verifying Pre-Closure maturity amount"); } @@ -2256,15 +2256,15 @@ public class FixedDepositTest { monthDayFormat.format(todaysDate.getTime()); Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientId); + Assertions.assertNotNull(clientId); final String accountingRule = NONE; Integer fixedDepositProductId = createFixedDepositProduct(VALID_FROM, VALID_TO, accountingRule); - Assert.assertNotNull(fixedDepositProductId); + Assertions.assertNotNull(fixedDepositProductId); Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), SUBMITTED_ON_DATE, WHOLE_TERM); - Assert.assertNotNull(fixedDepositAccountId); + Assertions.assertNotNull(fixedDepositAccountId); this.fixedDepositAccountHelper.updateInterestCalculationConfigForFixedDeposit(clientId.toString(), fixedDepositProductId.toString(), fixedDepositAccountId.toString(), SUBMITTED_ON_DATE, VALID_FROM, VALID_TO, DAYS_365, @@ -2301,7 +2301,7 @@ public class FixedDepositTest { Double expectedPrematureAmount = Math.floor(principal); Double maturityAmount = Math.floor((Float) fixedDepositAccountData.get("maturityAmount")); - Assert.assertEquals("Verifying Pre-Closure maturity amount", expectedPrematureAmount, maturityAmount); + Assertions.assertEquals(expectedPrematureAmount, maturityAmount, "Verifying Pre-Closure maturity amount"); } @Test @@ -2336,15 +2336,15 @@ public class FixedDepositTest { monthDayFormat.format(todaysDate.getTime()); Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientId); + Assertions.assertNotNull(clientId); final String accountingRule = NONE; Integer fixedDepositProductId = createFixedDepositProduct(VALID_FROM, VALID_TO, accountingRule); - Assert.assertNotNull(fixedDepositProductId); + Assertions.assertNotNull(fixedDepositProductId); Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), SUBMITTED_ON_DATE, WHOLE_TERM); - Assert.assertNotNull(fixedDepositAccountId); + Assertions.assertNotNull(fixedDepositAccountId); this.fixedDepositAccountHelper.updateInterestCalculationConfigForFixedDeposit(clientId.toString(), fixedDepositProductId.toString(), fixedDepositAccountId.toString(), SUBMITTED_ON_DATE, VALID_FROM, VALID_TO, DAYS_360, @@ -2381,7 +2381,7 @@ public class FixedDepositTest { Double expectedPrematureAmount = Math.floor(principal); Double maturityAmount = Math.floor((Float) fixedDepositAccountData.get("maturityAmount")); - Assert.assertEquals("Verifying Pre-Closure maturity amount", expectedPrematureAmount, maturityAmount); + Assertions.assertEquals(expectedPrematureAmount, maturityAmount, "Verifying Pre-Closure maturity amount"); } /*** @@ -2425,7 +2425,7 @@ public class FixedDepositTest { todaysDate.add(Calendar.DATE, numberOfDaysLeft); Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientId); + Assertions.assertNotNull(clientId); /*** * Create FD product with CashBased accounting enabled @@ -2433,7 +2433,7 @@ public class FixedDepositTest { final String accountingRule = CASH_BASED; Integer fixedDepositProductId = createFixedDepositProduct(VALID_FROM, VALID_TO, accountingRule, assetAccount, liabilityAccount, incomeAccount, expenseAccount); - Assert.assertNotNull(fixedDepositProductId); + Assertions.assertNotNull(fixedDepositProductId); /*** * Set maturityInstructionId as re-invest principal+interest @@ -2446,7 +2446,7 @@ public class FixedDepositTest { Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), SUBMITTED_ON_DATE, WHOLE_TERM, maturityInstructionId); - Assert.assertNotNull(fixedDepositAccountId); + Assertions.assertNotNull(fixedDepositAccountId); HashMap fixedDepositAccountStatusHashMap = FixedDepositAccountStatusChecker.getStatusOfFixedDepositAccount(this.requestSpec, this.responseSpec, fixedDepositAccountId.toString()); @@ -2507,7 +2507,7 @@ public class FixedDepositTest { todaysDate.add(Calendar.DATE, numberOfDaysLeft); Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientId); + Assertions.assertNotNull(clientId); /*** * Create FD product with CashBased accounting enabled @@ -2515,7 +2515,7 @@ public class FixedDepositTest { final String accountingRule = CASH_BASED; Integer fixedDepositProductId = createFixedDepositProduct(VALID_FROM, VALID_TO, accountingRule, assetAccount, liabilityAccount, incomeAccount, expenseAccount); - Assert.assertNotNull(fixedDepositProductId); + Assertions.assertNotNull(fixedDepositProductId); /*** * Set maturityInstructionId as re-invest principal @@ -2528,7 +2528,7 @@ public class FixedDepositTest { Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), SUBMITTED_ON_DATE, WHOLE_TERM, maturityInstructionId); - Assert.assertNotNull(fixedDepositAccountId); + Assertions.assertNotNull(fixedDepositAccountId); HashMap fixedDepositAccountStatusHashMap = FixedDepositAccountStatusChecker.getStatusOfFixedDepositAccount(this.requestSpec, this.responseSpec, fixedDepositAccountId.toString()); @@ -2700,7 +2700,7 @@ public class FixedDepositTest { Integer financialActivityAccountId = (Integer) financialActivityAccountHelper.createFinancialActivityAccount( LIABILITY_TRANSFER_FINANCIAL_ACTIVITY_ID, liabilityAccountForMapping.getAccountID(), this.responseSpec, CommonConstants.RESPONSE_RESOURCE_ID); - Assert.assertNotNull(financialActivityAccountId); + Assertions.assertNotNull(financialActivityAccountId); assertFinancialActivityAccountCreation(financialActivityAccountId, LIABILITY_TRANSFER_FINANCIAL_ACTIVITY_ID, liabilityAccountForMapping); return liabilityAccountForMapping; } @@ -2708,8 +2708,8 @@ public class FixedDepositTest { private void assertFinancialActivityAccountCreation(Integer financialActivityAccountId, Integer financialActivityId, Account glAccount) { HashMap mappingDetails = this.financialActivityAccountHelper.getFinancialActivityAccount(financialActivityAccountId, this.responseSpec); - Assert.assertEquals(financialActivityId, ((HashMap) mappingDetails.get("financialActivityData")).get("id")); - Assert.assertEquals(glAccount.getAccountID(), ((HashMap) mappingDetails.get("glAccountData")).get("id")); + Assertions.assertEquals(financialActivityId, ((HashMap) mappingDetails.get("financialActivityData")).get("id")); + Assertions.assertEquals(glAccount.getAccountID(), ((HashMap) mappingDetails.get("glAccountData")).get("id")); } private Integer createTaxGroup(final String percentage, final Account liabilityAccountForTax){ @@ -2721,15 +2721,15 @@ public class FixedDepositTest { /** * Delete the Liability transfer account */ - @After + @AfterEach public void tearDown() { List financialActivities = this.financialActivityAccountHelper.getAllFinancialActivityAccounts(this.responseSpec); for (HashMap financialActivity : financialActivities) { Integer financialActivityAccountId = (Integer) financialActivity.get("id"); Integer deletedFinancialActivityAccountId = this.financialActivityAccountHelper.deleteFinancialActivityAccount( financialActivityAccountId, this.responseSpec, CommonConstants.RESPONSE_RESOURCE_ID); - Assert.assertNotNull(deletedFinancialActivityAccountId); - Assert.assertEquals(financialActivityAccountId, deletedFinancialActivityAccountId); + Assertions.assertNotNull(deletedFinancialActivityAccountId); + Assertions.assertEquals(financialActivityAccountId, deletedFinancialActivityAccountId); } } } diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/FlexibleSavingsInterestPostingIntegrationTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/FlexibleSavingsInterestPostingIntegrationTest.java index 59324fb6c..284b137f7 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/FlexibleSavingsInterestPostingIntegrationTest.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/FlexibleSavingsInterestPostingIntegrationTest.java @@ -18,7 +18,7 @@ */ package org.apache.fineract.integrationtests; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import io.restassured.builder.RequestSpecBuilder; import io.restassured.builder.ResponseSpecBuilder; @@ -35,10 +35,10 @@ import org.apache.fineract.integrationtests.common.Utils; import org.apache.fineract.integrationtests.common.savings.SavingsAccountHelper; import org.apache.fineract.integrationtests.common.savings.SavingsProductHelper; import org.apache.fineract.integrationtests.common.savings.SavingsStatusChecker; -import org.junit.After; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -52,7 +52,7 @@ public class FlexibleSavingsInterestPostingIntegrationTest { private SavingsProductHelper savingsProductHelper; private SavingsAccountHelper savingsAccountHelper; - @Before + @BeforeEach public void setup() { Utils.initializeRESTAssured(); this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build(); @@ -67,7 +67,7 @@ public class FlexibleSavingsInterestPostingIntegrationTest { // client activation, savings activation and 1st transaction date final String startDate = "01 December 2013"; final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec, startDate); - Assert.assertNotNull(clientID); + Assertions.assertNotNull(clientID); // Configuring global config flags configureInterestPosting(true, 4); @@ -97,10 +97,10 @@ public class FlexibleSavingsInterestPostingIntegrationTest { private Integer createSavingsAccount(final Integer clientID, final String startDate) { final Integer savingsProductID = createSavingsProduct(); - Assert.assertNotNull(savingsProductID); + Assertions.assertNotNull(savingsProductID); final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplicationOnDate(clientID, savingsProductID, ACCOUNT_TYPE_INDIVIDUAL, startDate); - Assert.assertNotNull(savingsId); + Assertions.assertNotNull(savingsId); HashMap savingsStatusHashMap = this.savingsAccountHelper.approveSavingsOnDate(savingsId, startDate); SavingsStatusChecker.verifySavingsIsApproved(savingsStatusHashMap); savingsStatusHashMap = this.savingsAccountHelper.activateSavingsAccount(savingsId, startDate); @@ -110,15 +110,15 @@ public class FlexibleSavingsInterestPostingIntegrationTest { private void configureInterestPosting(final Boolean periodEndEnable, final Integer financialYearBeginningMonth) { final ArrayList globalConfig = GlobalConfigurationHelper.getAllGlobalConfigurations(this.requestSpec, this.responseSpec); - Assert.assertNotNull(globalConfig); + Assertions.assertNotNull(globalConfig); // Updating flag for interest posting at period end Integer periodEndConfigId = (Integer) globalConfig.get(10).get("id"); - Assert.assertNotNull(periodEndConfigId); + Assertions.assertNotNull(periodEndConfigId); HashMap periodEndConfigData = GlobalConfigurationHelper.getGlobalConfigurationById(this.requestSpec, this.responseSpec, periodEndConfigId.toString()); - Assert.assertNotNull(periodEndConfigData); + Assertions.assertNotNull(periodEndConfigData); Boolean enabled = (Boolean) globalConfig.get(10).get("enabled"); @@ -129,15 +129,15 @@ public class FlexibleSavingsInterestPostingIntegrationTest { // Updating value for financial year beginning month Integer financialYearBeginningConfigId = (Integer) globalConfig.get(11).get("id"); - Assert.assertNotNull(financialYearBeginningConfigId); + Assertions.assertNotNull(financialYearBeginningConfigId); HashMap financialYearBeginningConfigData = GlobalConfigurationHelper.getGlobalConfigurationById(this.requestSpec, this.responseSpec, financialYearBeginningConfigId.toString()); - Assert.assertNotNull(financialYearBeginningConfigData); + Assertions.assertNotNull(financialYearBeginningConfigData); financialYearBeginningConfigId = GlobalConfigurationHelper.updateValueForGlobalConfiguration(this.requestSpec, this.responseSpec, financialYearBeginningConfigId.toString(), financialYearBeginningMonth.toString()); - Assert.assertNotNull(financialYearBeginningConfigId); + Assertions.assertNotNull(financialYearBeginningConfigId); } private Integer createSavingsProduct() { @@ -147,7 +147,7 @@ public class FlexibleSavingsInterestPostingIntegrationTest { } // Reset configuration fields - @After + @AfterEach public void tearDown() { GlobalConfigurationHelper.resetAllDefaultGlobalConfigurations(this.requestSpec, this.responseSpec); GlobalConfigurationHelper.verifyAllDefaultGlobalConfigurations(this.requestSpec, this.responseSpec); diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/FundsIntegrationTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/FundsIntegrationTest.java index 81800d4b7..c59039c58 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/FundsIntegrationTest.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/FundsIntegrationTest.java @@ -21,7 +21,7 @@ package org.apache.fineract.integrationtests; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.greaterThanOrEqualTo; import static org.hamcrest.Matchers.hasItem; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; @@ -35,9 +35,9 @@ import java.util.List; import org.apache.fineract.integrationtests.common.Utils; import org.apache.fineract.integrationtests.common.funds.FundsHelper; import org.apache.fineract.integrationtests.common.funds.FundsResourceHandler; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; /** * Funds Integration Test for checking Funds Application. @@ -47,7 +47,7 @@ public class FundsIntegrationTest { private ResponseSpecification statusOkResponseSpec; private RequestSpecification requestSpec; - @Before + @BeforeEach public void setup() { Utils.initializeRESTAssured(); this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build(); @@ -64,7 +64,7 @@ public class FundsIntegrationTest { String jsonData = fh.toJSON(); final Long fundID = createFund(jsonData, this.requestSpec, this.statusOkResponseSpec); - Assert.assertNotNull(fundID); + Assertions.assertNotNull(fundID); } @Test @@ -77,7 +77,7 @@ public class FundsIntegrationTest { ResponseSpecification responseSpec = new ResponseSpecBuilder().expectStatusCode(400).build(); final Long fundID = createFund(jsonData, this.requestSpec, responseSpec); - Assert.assertNull(fundID); + Assertions.assertNull(fundID); } @Test @@ -89,7 +89,7 @@ public class FundsIntegrationTest { String jsonData = fh.toJSON(); final Long fundID = createFund(jsonData, this.requestSpec, this.statusOkResponseSpec); - Assert.assertNotNull(fundID); + Assertions.assertNotNull(fundID); } @Test @@ -101,7 +101,7 @@ public class FundsIntegrationTest { String jsonData = fh.toJSON(); final Long fundID = createFund(jsonData, this.requestSpec, this.statusOkResponseSpec); - Assert.assertNotNull(fundID); + Assertions.assertNotNull(fundID); FundsHelper fh2 = FundsHelper .create(fh.getName()) @@ -111,7 +111,7 @@ public class FundsIntegrationTest { ResponseSpecification responseSpec = new ResponseSpecBuilder().expectStatusCode(403).build(); final Long fundID2 = createFund(jsonData, this.requestSpec, responseSpec); - Assert.assertNull(fundID2); + Assertions.assertNull(fundID2); } @Test @@ -123,7 +123,7 @@ public class FundsIntegrationTest { String jsonData = fh.toJSON(); final Long fundID = createFund(jsonData, this.requestSpec, this.statusOkResponseSpec); - Assert.assertNotNull(fundID); + Assertions.assertNotNull(fundID); FundsHelper fh2 = FundsHelper .create(Utils.randomNameGenerator("", 10)) @@ -133,7 +133,7 @@ public class FundsIntegrationTest { ResponseSpecification responseSpec = new ResponseSpecBuilder().expectStatusCode(403).build(); final Long fundID2 = createFund(jsonData, this.requestSpec, responseSpec); - Assert.assertNull(fundID2); + Assertions.assertNull(fundID2); } @Test @@ -146,7 +146,7 @@ public class FundsIntegrationTest { ResponseSpecification responseSpec = new ResponseSpecBuilder().expectStatusCode(400).build(); final Long fundID = createFund(jsonData, this.requestSpec, responseSpec); - Assert.assertNull(fundID); + Assertions.assertNull(fundID); } @Test @@ -159,7 +159,7 @@ public class FundsIntegrationTest { ResponseSpecification responseSpec = new ResponseSpecBuilder().expectStatusCode(400).build(); final Long fundID = createFund(jsonData, this.requestSpec, responseSpec); - Assert.assertNull(fundID); + Assertions.assertNull(fundID); } @Test @@ -171,7 +171,7 @@ public class FundsIntegrationTest { String jsonData = fh.toJSON(); final Long fundID = createFund(jsonData, this.requestSpec, this.statusOkResponseSpec); - Assert.assertNotNull(fundID); + Assertions.assertNotNull(fundID); jsonData = FundsResourceHandler.retrieveFund(fundID, this.requestSpec, this.statusOkResponseSpec); FundsHelper fh2 = FundsHelper.fromJSON(jsonData); @@ -188,11 +188,11 @@ public class FundsIntegrationTest { String jsonData = fh.toJSON(); final Long fundID = createFund(jsonData, this.requestSpec, this.statusOkResponseSpec); - Assert.assertNotNull(fundID); + Assertions.assertNotNull(fundID); List fhList = FundsResourceHandler.retrieveAllFunds(this.requestSpec, this.statusOkResponseSpec); - Assert.assertNotNull(fhList); + Assertions.assertNotNull(fhList); assertThat(fhList.size(), greaterThanOrEqualTo(1)); assertThat(fhList, hasItem(fh)); } @@ -214,14 +214,14 @@ public class FundsIntegrationTest { String jsonData = fh.toJSON(); final Long fundID = createFund(jsonData, this.requestSpec, this.statusOkResponseSpec); - Assert.assertNotNull(fundID); + Assertions.assertNotNull(fundID); String newName = Utils.randomNameGenerator("", 10); String newExternalId = Utils.randomNameGenerator("fund-", 5); FundsHelper fh2 = FundsResourceHandler.updateFund(fundID, newName, newExternalId, this.requestSpec, this.statusOkResponseSpec); - Assert.assertEquals(newName, fh2.getName()); - Assert.assertEquals(newExternalId, fh2.getExternalId()); + Assertions.assertEquals(newName, fh2.getName()); + Assertions.assertEquals(newExternalId, fh2.getExternalId()); } @Test @@ -231,7 +231,7 @@ public class FundsIntegrationTest { ResponseSpecification responseSpec = new ResponseSpecBuilder().expectStatusCode(404).build(); FundsHelper fh = FundsResourceHandler.updateFund(Long.MAX_VALUE, newName, newExternalId, this.requestSpec, responseSpec); - Assert.assertNull(fh); + Assertions.assertNull(fh); } @Test @@ -243,7 +243,7 @@ public class FundsIntegrationTest { String jsonData = fh.toJSON(); final Long fundID = createFund(jsonData, this.requestSpec, this.statusOkResponseSpec); - Assert.assertNotNull(fundID); + Assertions.assertNotNull(fundID); String newName = Utils.randomNameGenerator("", 120); String newExternalId = Utils.randomNameGenerator("fund-", 5); @@ -251,7 +251,7 @@ public class FundsIntegrationTest { FundsHelper fh2 = FundsResourceHandler.updateFund(fundID, newName, newExternalId, this.requestSpec, responseSpec); - Assert.assertNull(fh2); + Assertions.assertNull(fh2); } @Test @@ -263,12 +263,12 @@ public class FundsIntegrationTest { String jsonData = fh.toJSON(); final Long fundID = createFund(jsonData, this.requestSpec, this.statusOkResponseSpec); - Assert.assertNotNull(fundID); + Assertions.assertNotNull(fundID); String newExternalId = Utils.randomNameGenerator("fund-", 5); FundsHelper fh2 = FundsResourceHandler.updateFund(fundID, null, newExternalId, this.requestSpec, this.statusOkResponseSpec); - Assert.assertEquals(newExternalId, fh2.getExternalId()); + Assertions.assertEquals(newExternalId, fh2.getExternalId()); } @Test @@ -280,7 +280,7 @@ public class FundsIntegrationTest { String jsonData = fh.toJSON(); final Long fundID = createFund(jsonData, this.requestSpec, this.statusOkResponseSpec); - Assert.assertNotNull(fundID); + Assertions.assertNotNull(fundID); String newName = Utils.randomNameGenerator("", 10); String newExternalId = Utils.randomNameGenerator("fund-", 120); @@ -288,7 +288,7 @@ public class FundsIntegrationTest { FundsHelper fh2 = FundsResourceHandler.updateFund(fundID, newName, newExternalId, this.requestSpec, responseSpec); - Assert.assertNull(fh2); + Assertions.assertNull(fh2); } @Test @@ -300,12 +300,12 @@ public class FundsIntegrationTest { String jsonData = fh.toJSON(); final Long fundID = createFund(jsonData, this.requestSpec, this.statusOkResponseSpec); - Assert.assertNotNull(fundID); + Assertions.assertNotNull(fundID); String newName = Utils.randomNameGenerator("", 10); FundsHelper fh2 = FundsResourceHandler.updateFund(fundID, newName, null, this.requestSpec, this.statusOkResponseSpec); - Assert.assertEquals(newName, fh2.getName()); + Assertions.assertEquals(newName, fh2.getName()); } @Test @@ -317,20 +317,20 @@ public class FundsIntegrationTest { String jsonData = fh.toJSON(); final Long fundID = createFund(jsonData, this.requestSpec, this.statusOkResponseSpec); - Assert.assertNotNull(fundID); + Assertions.assertNotNull(fundID); FundsHelper fh2 = FundsResourceHandler.updateFund(fundID, null, null, this.requestSpec, this.statusOkResponseSpec); - Assert.assertNull(fh2.getName()); - Assert.assertNull(fh2.getExternalId()); + Assertions.assertNull(fh2.getName()); + Assertions.assertNull(fh2.getExternalId()); // assert that there was no change in // the name and external ID of the fund jsonData = FundsResourceHandler.retrieveFund(fundID, this.requestSpec, this.statusOkResponseSpec); FundsHelper fh3 = new Gson().fromJson(jsonData, FundsHelper.class); - Assert.assertEquals(fh.getName(), fh3.getName()); - Assert.assertEquals(fh.getExternalId(), fh3.getExternalId()); + Assertions.assertEquals(fh.getName(), fh3.getName()); + Assertions.assertEquals(fh.getExternalId(), fh3.getExternalId()); } private Long createFund(final String fundJSON, diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/GlobalConfigInterestChargedFromDateSameAsDisbursalDateTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/GlobalConfigInterestChargedFromDateSameAsDisbursalDateTest.java index fe7d1828f..94827ecd5 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/GlobalConfigInterestChargedFromDateSameAsDisbursalDateTest.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/GlobalConfigInterestChargedFromDateSameAsDisbursalDateTest.java @@ -27,10 +27,10 @@ import java.util.ArrayList; import java.util.HashMap; import org.apache.fineract.integrationtests.common.GlobalConfigurationHelper; import org.apache.fineract.integrationtests.common.Utils; -import org.junit.After; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class GlobalConfigInterestChargedFromDateSameAsDisbursalDateTest { @@ -39,7 +39,7 @@ public class GlobalConfigInterestChargedFromDateSameAsDisbursalDateTest { private RequestSpecification requestSpec; private GlobalConfigurationHelper globalConfigurationHelper; - @Before + @BeforeEach public void setup() { Utils.initializeRESTAssured(); this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build(); @@ -47,7 +47,7 @@ public class GlobalConfigInterestChargedFromDateSameAsDisbursalDateTest { this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build(); } - @After + @AfterEach public void tearDown() { GlobalConfigurationHelper.resetAllDefaultGlobalConfigurations(this.requestSpec, this.responseSpec); GlobalConfigurationHelper.verifyAllDefaultGlobalConfigurations(this.requestSpec, this.responseSpec); @@ -61,7 +61,7 @@ public class GlobalConfigInterestChargedFromDateSameAsDisbursalDateTest { // Retrieving All Global Configuration details final ArrayList globalConfig = this.globalConfigurationHelper .getAllGlobalConfigurations(this.requestSpec, this.responseSpec); - Assert.assertNotNull(globalConfig); + Assertions.assertNotNull(globalConfig); String configName = "interest-charged-from-date-same-as-disbursal-date"; boolean newBooleanValue = true; @@ -74,7 +74,7 @@ public class GlobalConfigInterestChargedFromDateSameAsDisbursalDateTest { Integer updateConfigId = this.globalConfigurationHelper .updateEnabledFlagForGlobalConfiguration(this.requestSpec, this.responseSpec, configId.toString(), newBooleanValue); - Assert.assertNotNull(updateConfigId); + Assertions.assertNotNull(updateConfigId); break; } } diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/GlobalConfigurationTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/GlobalConfigurationTest.java index 91a7579d8..c0dee4b5a 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/GlobalConfigurationTest.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/GlobalConfigurationTest.java @@ -28,10 +28,10 @@ import java.util.HashMap; import org.apache.fineract.integrationtests.common.CommonConstants; import org.apache.fineract.integrationtests.common.GlobalConfigurationHelper; import org.apache.fineract.integrationtests.common.Utils; -import org.junit.After; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; @SuppressWarnings({ "rawtypes", "unchecked", "static-access" }) public class GlobalConfigurationTest { @@ -41,7 +41,7 @@ public class GlobalConfigurationTest { private GlobalConfigurationHelper globalConfigurationHelper; private ResponseSpecification httpStatusForidden; - @Before + @BeforeEach public void setup() { Utils.initializeRESTAssured(); this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build(); @@ -50,7 +50,7 @@ public class GlobalConfigurationTest { this.httpStatusForidden = new ResponseSpecBuilder().expectStatusCode(403).build(); } - @After + @AfterEach public void tearDown() { GlobalConfigurationHelper.resetAllDefaultGlobalConfigurations(this.requestSpec, this.responseSpec); GlobalConfigurationHelper.verifyAllDefaultGlobalConfigurations(this.requestSpec, this.responseSpec); @@ -63,30 +63,30 @@ public class GlobalConfigurationTest { // Retrieving All Global Configuration details final ArrayList globalConfig = this.globalConfigurationHelper.getAllGlobalConfigurations(this.requestSpec, this.responseSpec); - Assert.assertNotNull(globalConfig); + Assertions.assertNotNull(globalConfig); String configName = "penalty-wait-period"; for (Integer configIndex = 0; configIndex < globalConfig.size() - 1; configIndex++) { if (globalConfig.get(configIndex).get("name").equals(configName)) { Integer configId = (Integer) globalConfig.get(configIndex).get("id"); - Assert.assertNotNull(configId); + Assertions.assertNotNull(configId); HashMap configDataBefore = this.globalConfigurationHelper.getGlobalConfigurationById(this.requestSpec, this.responseSpec, configId.toString()); - Assert.assertNotNull(configDataBefore); + Assertions.assertNotNull(configDataBefore); Integer value = (Integer) configDataBefore.get("value") + 1; // Updating Value for penalty-wait-period Global Configuration configId = this.globalConfigurationHelper.updateValueForGlobalConfiguration(this.requestSpec, this.responseSpec, configId.toString(), value.toString()); - Assert.assertNotNull(configId); + Assertions.assertNotNull(configId); HashMap configDataAfter = this.globalConfigurationHelper.getGlobalConfigurationById(this.requestSpec, this.responseSpec, configId.toString()); // Verifying Value for penalty-wait-period after Updation - Assert.assertEquals("Verifying Global Config Value after Updation", value, configDataAfter.get("value")); + Assertions.assertEquals(value, configDataAfter.get("value"), "Verifying Global Config Value after Updation"); // Updating Enabled Flag for penalty-wait-period Global // Configuration @@ -105,7 +105,7 @@ public class GlobalConfigurationTest { configId.toString()); // Verifying Enabled Flag for penalty-wait-period after Updation - Assert.assertEquals("Verifying Enabled Flag Global Config after Updation", enabled, configDataAfter.get("enabled")); + Assertions.assertEquals(enabled, configDataAfter.get("enabled"), "Verifying Enabled Flag Global Config after Updation"); break; } } @@ -118,13 +118,13 @@ public class GlobalConfigurationTest { // Retrieving Is Cache Enabled Global Configuration details ArrayList isCacheGlobalConfig = this.globalConfigurationHelper.getGlobalConfigurationIsCacheEnabled(this.requestSpec, this.responseSpec); - Assert.assertNotNull(isCacheGlobalConfig); + Assertions.assertNotNull(isCacheGlobalConfig); for (Integer cacheType = 0; cacheType <= isCacheGlobalConfig.size() - 1; cacheType++) { // Retrieving Is Cache Enabled Global Configuration details isCacheGlobalConfig = this.globalConfigurationHelper.getGlobalConfigurationIsCacheEnabled(this.requestSpec, this.responseSpec); - Assert.assertNotNull(isCacheGlobalConfig); + Assertions.assertNotNull(isCacheGlobalConfig); HashMap cacheTypeAsHashMap = (HashMap) isCacheGlobalConfig.get(cacheType).get("cacheType"); Integer cacheTypeId = (Integer) cacheTypeAsHashMap.get("id"); @@ -139,7 +139,7 @@ public class GlobalConfigurationTest { HashMap changes = this.globalConfigurationHelper.updateIsCacheEnabledForGlobalConfiguration(this.requestSpec, this.responseSpec, cacheTypeId.toString()); - Assert.assertEquals("Verifying Is Cache Enabled Global Config after Updation", cacheTypeId, changes.get("cacheType")); + Assertions.assertEquals(cacheTypeId, changes.get("cacheType"), "Verifying Is Cache Enabled Global Config after Updation"); } } @@ -149,7 +149,7 @@ public class GlobalConfigurationTest { // Retrieving All Global Configuration details final ArrayList globalConfig = this.globalConfigurationHelper .getAllGlobalConfigurations(this.requestSpec, this.responseSpec); - Assert.assertNotNull(globalConfig); + Assertions.assertNotNull(globalConfig); String configName = "force-password-reset-days"; String newValue = "0"; @@ -159,7 +159,7 @@ public class GlobalConfigurationTest { if (globalConfig.get(configIndex).get("name").equals(configName)) { Integer configId = (Integer) globalConfig.get(configIndex).get( "id"); - Assert.assertNotNull(configId); + Assertions.assertNotNull(configId); /* * Update force-password-reset-days with value as 0 and Enable @@ -172,10 +172,10 @@ public class GlobalConfigurationTest { CommonConstants.RESPONSE_ERROR); HashMap hash = (HashMap) error.get(0); - Assert.assertEquals( - "Force Password Reset days value must be greater than zero.", + Assertions.assertEquals( "error.msg.password.reset.days.value.must.be.greater.than.zero", - hash.get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE)); + hash.get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE), + "Force Password Reset days value must be greater than zero."); /* * Update force-password-reset-days with value as 50 and Enable @@ -185,14 +185,14 @@ public class GlobalConfigurationTest { .updatePasswordResetDaysForGlobalConfiguration( this.requestSpec, this.responseSpec, configId, "50", newBooleanValue, "changes"); - Assert.assertNotNull(updateSuccess); + Assertions.assertNotNull(updateSuccess); /* Update with value as 0 and Enable as false - success case */ final HashMap updateSuccess1 = (HashMap) this.globalConfigurationHelper .updatePasswordResetDaysForGlobalConfiguration( this.requestSpec, this.responseSpec, configId, newValue, "false", "changes"); - Assert.assertNotNull(updateSuccess1); + Assertions.assertNotNull(updateSuccess1); /* Update without sending value and Enable as true - failure case*/ ArrayList failure = (ArrayList) this.globalConfigurationHelper @@ -200,10 +200,10 @@ public class GlobalConfigurationTest { this.requestSpec, this.httpStatusForidden, configId, null, newBooleanValue, CommonConstants.RESPONSE_ERROR); HashMap failureHash = (HashMap) failure.get(0); - Assert.assertEquals( - "Force Password Reset days value must be greater than zero.", + Assertions.assertEquals( "error.msg.password.reset.days.value.must.be.greater.than.zero", - failureHash.get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE)); + failureHash.get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE), + "Force Password Reset days value must be greater than zero."); break; } @@ -218,7 +218,7 @@ public class GlobalConfigurationTest { Integer updateConfigId = this.globalConfigurationHelper .updateValueForGlobalConfiguration(this.requestSpec, this.responseSpec, configId, newValue); - Assert.assertNotNull(updateConfigId); + Assertions.assertNotNull(updateConfigId); break; } } diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/GroupLoanIntegrationTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/GroupLoanIntegrationTest.java index a99353549..057a93f6a 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/GroupLoanIntegrationTest.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/GroupLoanIntegrationTest.java @@ -18,7 +18,7 @@ */ package org.apache.fineract.integrationtests; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import io.restassured.builder.RequestSpecBuilder; import io.restassured.builder.ResponseSpecBuilder; @@ -38,9 +38,9 @@ import org.apache.fineract.integrationtests.common.loans.LoanApplicationTestBuil import org.apache.fineract.integrationtests.common.loans.LoanProductTestBuilder; import org.apache.fineract.integrationtests.common.loans.LoanStatusChecker; import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -55,7 +55,7 @@ public class GroupLoanIntegrationTest { private LoanTransactionHelper loanTransactionHelper; private final static Logger LOG = LoggerFactory.getLogger(GroupLoanIntegrationTest.class); - @Before + @BeforeEach public void setup() { Utils.initializeRESTAssured(); this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build(); @@ -125,16 +125,16 @@ public class GroupLoanIntegrationTest { this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec); final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientID); + Assertions.assertNotNull(clientID); Integer groupID = GroupHelper.createGroup(this.requestSpec, this.responseSpec, true); - Assert.assertNotNull(groupID); + Assertions.assertNotNull(groupID); groupID = GroupHelper.associateClient(this.requestSpec, this.responseSpec, groupID.toString(), clientID.toString()); - Assert.assertNotNull(groupID); + Assertions.assertNotNull(groupID); final Integer loanProductID = createLoanProduct(); - Assert.assertNotNull(loanProductID); + Assertions.assertNotNull(loanProductID); HashMap glim = applyForGlimApplication(clientID, groupID, loanProductID); LOG.info("Glim Loan Application: {} ", glim); @@ -146,7 +146,7 @@ public class GroupLoanIntegrationTest { LOG.info("LoanId: {} ", loanId); final List retrievedGlimId=GroupHelper.verifyRetrieveGlimAccountsByGroupId(this.requestSpec, this.responseSpec, groupID); - Assert.assertNotNull(retrievedGlimId.toString()); + Assertions.assertNotNull(retrievedGlimId.toString()); } @Test @@ -154,16 +154,16 @@ public class GroupLoanIntegrationTest { this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec); final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientID); + Assertions.assertNotNull(clientID); Integer groupID = GroupHelper.createGroup(this.requestSpec, this.responseSpec, true); - Assert.assertNotNull(groupID); + Assertions.assertNotNull(groupID); groupID = GroupHelper.associateClient(this.requestSpec, this.responseSpec, groupID.toString(), clientID.toString()); - Assert.assertNotNull(groupID); + Assertions.assertNotNull(groupID); final Integer loanProductID = createLoanProduct(); - Assert.assertNotNull(loanProductID); + Assertions.assertNotNull(loanProductID); HashMap glim = applyForGlimApplication(clientID, groupID, loanProductID); LOG.info("Glim Loan Application: {} ", glim); @@ -175,7 +175,7 @@ public class GroupLoanIntegrationTest { LOG.info("LoanId: {} ", loanId); final List retrievedGlimAccountId=GroupHelper.verifyRetrieveGlimAccountsByGlimId(this.requestSpec, this.responseSpec, glimId); - Assert.assertNotNull(retrievedGlimAccountId); + Assertions.assertNotNull(retrievedGlimAccountId); } private Map approvalFormData(final Integer loanId, final String approvedOnDate) { @@ -247,24 +247,26 @@ public class GroupLoanIntegrationTest { private void verifyLoanRepaymentSchedule(final ArrayList loanSchedule) { LOG.info("--------------------VERIFYING THE PRINCIPAL DUES,INTEREST DUE AND DUE DATE--------------------------"); - assertEquals("Checking for Due Date for 1st Month", new ArrayList<>(Arrays.asList(2011, 10, 20)), - loanSchedule.get(1).get("dueDate")); - assertEquals("Checking for Principal Due for 1st Month", Float.valueOf("2911.49"), loanSchedule.get(1).get("principalOriginalDue")); - assertEquals("Checking for Interest Due for 1st Month", Float.valueOf("240.00"), loanSchedule.get(1).get("interestOriginalDue")); + assertEquals(new ArrayList<>(Arrays.asList(2011, 10, 20)), loanSchedule.get(1).get("dueDate"), + "Checking for Due Date for 1st Month"); + assertEquals(Float.valueOf("2911.49"), loanSchedule.get(1).get("principalOriginalDue"), + "Checking for Principal Due for 1st Month"); + assertEquals(Float.valueOf("240.00"), loanSchedule.get(1).get("interestOriginalDue"), + "Checking for Interest Due for 1st Month"); - assertEquals("Checking for Due Date for 2nd Month", new ArrayList<>(Arrays.asList(2011, 11, 20)), - loanSchedule.get(2).get("dueDate")); - assertEquals("Checking for Principal Due for 2nd Month", Float.valueOf("2969.72"), loanSchedule.get(2).get("principalDue")); - assertEquals("Checking for Interest Due for 2nd Month", Float.valueOf("181.77"), loanSchedule.get(2).get("interestOriginalDue")); + assertEquals(new ArrayList<>(Arrays.asList(2011, 11, 20)), loanSchedule.get(2).get("dueDate"), + "Checking for Due Date for 2nd Month"); + assertEquals(Float.valueOf("2969.72"), loanSchedule.get(2).get("principalDue"), "Checking for Principal Due for 2nd Month"); + assertEquals(Float.valueOf("181.77"), loanSchedule.get(2).get("interestOriginalDue"), "Checking for Interest Due for 2nd Month"); - assertEquals("Checking for Due Date for 3rd Month", new ArrayList<>(Arrays.asList(2011, 12, 20)), - loanSchedule.get(3).get("dueDate")); - assertEquals("Checking for Principal Due for 3rd Month", Float.valueOf("3029.11"), loanSchedule.get(3).get("principalDue")); - assertEquals("Checking for Interest Due for 3rd Month", Float.valueOf("122.38"), loanSchedule.get(3).get("interestOriginalDue")); + assertEquals(new ArrayList<>(Arrays.asList(2011, 12, 20)), loanSchedule.get(3).get("dueDate"), + "Checking for Due Date for 3rd Month"); + assertEquals(Float.valueOf("3029.11"), loanSchedule.get(3).get("principalDue"), "Checking for Principal Due for 3rd Month"); + assertEquals(Float.valueOf("122.38"), loanSchedule.get(3).get("interestOriginalDue"), "Checking for Interest Due for 3rd Month"); - assertEquals("Checking for Due Date for 4th Month", new ArrayList<>(Arrays.asList(2012, 1, 20)), - loanSchedule.get(4).get("dueDate")); - assertEquals("Checking for Principal Due for 4th Month", Float.valueOf("3089.68"), loanSchedule.get(4).get("principalDue")); - assertEquals("Checking for Interest Due for 4th Month", Float.valueOf("61.79"), loanSchedule.get(4).get("interestOriginalDue")); + assertEquals(new ArrayList<>(Arrays.asList(2012, 1, 20)), loanSchedule.get(4).get("dueDate"), + "Checking for Due Date for 4th Month"); + assertEquals(Float.valueOf("3089.68"), loanSchedule.get(4).get("principalDue"), "Checking for Principal Due for 4th Month"); + assertEquals(Float.valueOf("61.79"), loanSchedule.get(4).get("interestOriginalDue"), "Checking for Interest Due for 4th Month"); } } diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/GroupSavingsIntegrationTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/GroupSavingsIntegrationTest.java index 5302debdf..09c1dc89b 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/GroupSavingsIntegrationTest.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/GroupSavingsIntegrationTest.java @@ -18,7 +18,7 @@ */ package org.apache.fineract.integrationtests; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import io.restassured.builder.RequestSpecBuilder; import io.restassured.builder.ResponseSpecBuilder; @@ -44,9 +44,9 @@ import org.apache.fineract.integrationtests.common.savings.SavingsAccountHelper; import org.apache.fineract.integrationtests.common.savings.SavingsProductHelper; import org.apache.fineract.integrationtests.common.savings.SavingsStatusChecker; import org.joda.time.LocalDate; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -67,7 +67,7 @@ public class GroupSavingsIntegrationTest { private SavingsAccountHelper savingsAccountHelper; private final static Logger LOG = LoggerFactory.getLogger(GroupSavingsIntegrationTest.class); - @Before + @BeforeEach public void setup() { Utils.initializeRESTAssured(); this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build(); @@ -80,26 +80,26 @@ public class GroupSavingsIntegrationTest { this.savingsAccountHelper = new SavingsAccountHelper(requestSpec, responseSpec); final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientID); + Assertions.assertNotNull(clientID); Integer groupID = GroupHelper.createGroup(this.requestSpec, this.responseSpec, true); - Assert.assertNotNull(groupID); + Assertions.assertNotNull(groupID); groupID = GroupHelper.associateClient(this.requestSpec, this.responseSpec, groupID.toString(), clientID.toString()); - Assert.assertNotNull(groupID); + Assertions.assertNotNull(groupID); final String minBalanceForInterestCalculation = null; final String minRequiredBalance = null; final String enforceMinRequiredBalance = "false"; final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE, minBalanceForInterestCalculation, minRequiredBalance, enforceMinRequiredBalance); - Assert.assertNotNull(savingsProductID); + Assertions.assertNotNull(savingsProductID); final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(groupID, savingsProductID, ACCOUNT_TYPE_GROUP); - Assert.assertNotNull(savingsId); + Assertions.assertNotNull(savingsId); HashMap modifications = this.savingsAccountHelper.updateSavingsAccount(groupID, savingsProductID, savingsId, ACCOUNT_TYPE_GROUP); - Assert.assertTrue(modifications.containsKey("submittedOnDate")); + Assertions.assertTrue(modifications.containsKey("submittedOnDate")); HashMap savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsId); SavingsStatusChecker.verifySavingsIsPending(savingsStatusHashMap); @@ -117,7 +117,7 @@ public class GroupSavingsIntegrationTest { this.savingsAccountHelper.postInterestForSavings(savingsId); summary = this.savingsAccountHelper.getSavingsSummary(savingsId); - Assert.assertFalse(summaryBefore.equals(summary)); + Assertions.assertFalse(summaryBefore.equals(summary)); final Object savingsInterest = this.savingsAccountHelper.getSavingsInterest(savingsId); @@ -131,23 +131,23 @@ public class GroupSavingsIntegrationTest { final SavingsAccountHelper validationErrorHelper = new SavingsAccountHelper(this.requestSpec, errorResponse); final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientID); + Assertions.assertNotNull(clientID); Integer groupID = GroupHelper.createGroup(this.requestSpec, this.responseSpec, true); - Assert.assertNotNull(groupID); + Assertions.assertNotNull(groupID); groupID = GroupHelper.associateClient(this.requestSpec, this.responseSpec, groupID.toString(), clientID.toString()); - Assert.assertNotNull(groupID); + Assertions.assertNotNull(groupID); final String minBalanceForInterestCalculation = null; final String minRequiredBalance = "1000.0"; final String enforceMinRequiredBalance = "true"; final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE, minBalanceForInterestCalculation, minRequiredBalance, enforceMinRequiredBalance); - Assert.assertNotNull(savingsProductID); + Assertions.assertNotNull(savingsProductID); final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(groupID, savingsProductID, ACCOUNT_TYPE_GROUP); - Assert.assertNotNull(savingsId); + Assertions.assertNotNull(savingsId); HashMap savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsId); SavingsStatusChecker.verifySavingsIsPending(savingsStatusHashMap); @@ -182,23 +182,23 @@ public class GroupSavingsIntegrationTest { new ResponseSpecBuilder().build()); final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientID); + Assertions.assertNotNull(clientID); Integer groupID = GroupHelper.createGroup(this.requestSpec, this.responseSpec, true); - Assert.assertNotNull(groupID); + Assertions.assertNotNull(groupID); groupID = GroupHelper.associateClient(this.requestSpec, this.responseSpec, groupID.toString(), clientID.toString()); - Assert.assertNotNull(groupID); + Assertions.assertNotNull(groupID); final String minBalanceForInterestCalculation = null; final String minRequiredBalance = null; final String enforceMinRequiredBalance = "false"; final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE, minBalanceForInterestCalculation, minRequiredBalance, enforceMinRequiredBalance); - Assert.assertNotNull(savingsProductID); + Assertions.assertNotNull(savingsProductID); final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(groupID, savingsProductID, ACCOUNT_TYPE_GROUP); - Assert.assertNotNull(savingsId); + Assertions.assertNotNull(savingsId); HashMap savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsId); SavingsStatusChecker.verifySavingsIsPending(savingsStatusHashMap); @@ -232,20 +232,20 @@ public class GroupSavingsIntegrationTest { new ResponseSpecBuilder().build()); final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientID); + Assertions.assertNotNull(clientID); Integer groupID = GroupHelper.createGroup(this.requestSpec, this.responseSpec, true); - Assert.assertNotNull(groupID); + Assertions.assertNotNull(groupID); groupID = GroupHelper.associateClient(this.requestSpec, this.responseSpec, groupID.toString(), clientID.toString()); - Assert.assertNotNull(groupID); + Assertions.assertNotNull(groupID); final String minBalanceForInterestCalculation = null; final String minRequiredBalance = null; final String enforceMinRequiredBalance = "false"; final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE, minBalanceForInterestCalculation, minRequiredBalance, enforceMinRequiredBalance); - Assert.assertNotNull(savingsProductID); + Assertions.assertNotNull(savingsProductID); List> clientArray = new ArrayList<>(); clientArray.add(clientArray(clientID, groupID, savingsProductID,"08 January 2013")); @@ -282,27 +282,27 @@ public class GroupSavingsIntegrationTest { this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec); final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientID); + Assertions.assertNotNull(clientID); Integer groupID = GroupHelper.createGroup(this.requestSpec, this.responseSpec, true); - Assert.assertNotNull(groupID); + Assertions.assertNotNull(groupID); groupID = GroupHelper.associateClient(this.requestSpec, this.responseSpec, groupID.toString(), clientID.toString()); - Assert.assertNotNull(groupID); + Assertions.assertNotNull(groupID); final String minBalanceForInterestCalculation = null; final String minRequiredBalance = null; final String enforceMinRequiredBalance = "false"; final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE, minBalanceForInterestCalculation, minRequiredBalance, enforceMinRequiredBalance); - Assert.assertNotNull(savingsProductID); + Assertions.assertNotNull(savingsProductID); List> clientArray = new ArrayList<>(); clientArray.add(clientArray(clientID, groupID, savingsProductID,"08 January 2013")); LOG.info("client Array : {} ", clientArray); final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(groupID, savingsProductID, ACCOUNT_TYPE_GROUP); - Assert.assertNotNull(savingsId); + Assertions.assertNotNull(savingsId); String name = PaymentTypeHelper.randomNameGenerator("P_T", 5); String description = PaymentTypeHelper.randomNameGenerator("PT_Desc", 15); @@ -310,7 +310,7 @@ public class GroupSavingsIntegrationTest { Integer position = 1; Integer paymentTypeId = PaymentTypeHelper.createPaymentType(requestSpec, responseSpec, name, description, isCashPayment, position); - Assert.assertNotNull(paymentTypeId); + Assertions.assertNotNull(paymentTypeId); List> savingsArray = new ArrayList<>(); final Integer transactionAmount=2500; @@ -326,7 +326,7 @@ public class GroupSavingsIntegrationTest { SavingsStatusChecker.verifySavingsIsActive(savingsStatusHashMap); final Integer depositId = this.savingsAccountHelper.depositGsimApplication(savingsId, savingsArray); - Assert.assertNotNull(depositId); + Assertions.assertNotNull(depositId); } @@ -338,20 +338,20 @@ public class GroupSavingsIntegrationTest { final SavingsAccountHelper validationErrorHelper = new SavingsAccountHelper(this.requestSpec, errorResponse); final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientID); + Assertions.assertNotNull(clientID); Integer groupID = GroupHelper.createGroup(this.requestSpec, this.responseSpec, true); - Assert.assertNotNull(groupID); + Assertions.assertNotNull(groupID); groupID = GroupHelper.associateClient(this.requestSpec, this.responseSpec, groupID.toString(), clientID.toString()); - Assert.assertNotNull(groupID); + Assertions.assertNotNull(groupID); final String minBalanceForInterestCalculation = null; final String minRequiredBalance = "1000.0"; final String enforceMinRequiredBalance = "true"; final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE, minBalanceForInterestCalculation, minRequiredBalance, enforceMinRequiredBalance); - Assert.assertNotNull(savingsProductID); + Assertions.assertNotNull(savingsProductID); List> clientArray = new ArrayList<>(); clientArray.add(clientArray(clientID, groupID, savingsProductID,"08 January 2013")); @@ -385,20 +385,20 @@ public class GroupSavingsIntegrationTest { final ResponseSpecification errorResponse = new ResponseSpecBuilder().expectStatusCode(400).build(); final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientID); + Assertions.assertNotNull(clientID); Integer groupID = GroupHelper.createGroup(this.requestSpec, this.responseSpec, true); - Assert.assertNotNull(groupID); + Assertions.assertNotNull(groupID); groupID = GroupHelper.associateClient(this.requestSpec, this.responseSpec, groupID.toString(), clientID.toString()); - Assert.assertNotNull(groupID); + Assertions.assertNotNull(groupID); final String minBalanceForInterestCalculation = null; final String minRequiredBalance = "1000.0"; final String enforceMinRequiredBalance = "true"; final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE, minBalanceForInterestCalculation, minRequiredBalance, enforceMinRequiredBalance); - Assert.assertNotNull(savingsProductID); + Assertions.assertNotNull(savingsProductID); List> clientArray = new ArrayList<>(); clientArray.add(clientArray(clientID, groupID, savingsProductID,"08 January 2013")); @@ -407,7 +407,7 @@ public class GroupSavingsIntegrationTest { HashMap savingsStatusHashMap = this.savingsAccountHelper.updateGsimApplication(gsimID, clientID, groupID, savingsProductID); LOG.info("savingsStatusHashMap: {} ",savingsStatusHashMap); - Assert.assertTrue(savingsStatusHashMap.containsKey("savingsId")); + Assertions.assertTrue(savingsStatusHashMap.containsKey("savingsId")); } @@ -418,27 +418,27 @@ public class GroupSavingsIntegrationTest { final ResponseSpecification errorResponse = new ResponseSpecBuilder().expectStatusCode(400).build(); final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientID); + Assertions.assertNotNull(clientID); Integer groupID = GroupHelper.createGroup(this.requestSpec, this.responseSpec, true); - Assert.assertNotNull(groupID); + Assertions.assertNotNull(groupID); groupID = GroupHelper.associateClient(this.requestSpec, this.responseSpec, groupID.toString(), clientID.toString()); - Assert.assertNotNull(groupID); + Assertions.assertNotNull(groupID); final String minBalanceForInterestCalculation = null; final String minRequiredBalance = "1000.0"; final String enforceMinRequiredBalance = "true"; final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE, minBalanceForInterestCalculation, minRequiredBalance, enforceMinRequiredBalance); - Assert.assertNotNull(savingsProductID); + Assertions.assertNotNull(savingsProductID); List> clientArray = new ArrayList<>(); clientArray.add(clientArray(clientID, groupID, savingsProductID,"08 January 2013")); final Integer gsimID = this.savingsAccountHelper.applyForGsimApplication(clientArray); final List retrievedGsimId=GroupHelper.verifyRetrieveGsimAccounts(this.requestSpec, this.responseSpec, groupID); - Assert.assertNotNull(retrievedGsimId.toString()); + Assertions.assertNotNull(retrievedGsimId.toString()); } @SuppressWarnings("unchecked") @@ -451,23 +451,23 @@ public class GroupSavingsIntegrationTest { new ResponseSpecBuilder().build()); final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientID); + Assertions.assertNotNull(clientID); Integer groupID = GroupHelper.createGroup(this.requestSpec, this.responseSpec, true); - Assert.assertNotNull(groupID); + Assertions.assertNotNull(groupID); groupID = GroupHelper.associateClient(this.requestSpec, this.responseSpec, groupID.toString(), clientID.toString()); - Assert.assertNotNull(groupID); + Assertions.assertNotNull(groupID); final String minBalanceForInterestCalculation = null; final String minRequiredBalance = null; final String enforceMinRequiredBalance = "false"; final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE, minBalanceForInterestCalculation, minRequiredBalance, enforceMinRequiredBalance); - Assert.assertNotNull(savingsProductID); + Assertions.assertNotNull(savingsProductID); final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(groupID, savingsProductID, ACCOUNT_TYPE_GROUP); - Assert.assertNotNull(savingsId); + Assertions.assertNotNull(savingsId); HashMap savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsId); SavingsStatusChecker.verifySavingsIsPending(savingsStatusHashMap); @@ -502,23 +502,23 @@ public class GroupSavingsIntegrationTest { this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec); final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientID); + Assertions.assertNotNull(clientID); Integer groupID = GroupHelper.createGroup(this.requestSpec, this.responseSpec, true); - Assert.assertNotNull(groupID); + Assertions.assertNotNull(groupID); groupID = GroupHelper.associateClient(this.requestSpec, this.responseSpec, groupID.toString(), clientID.toString()); - Assert.assertNotNull(groupID); + Assertions.assertNotNull(groupID); final String minBalanceForInterestCalculation = null; final String minRequiredBalance = null; final String enforceMinRequiredBalance = "false"; final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE, minBalanceForInterestCalculation, minRequiredBalance, enforceMinRequiredBalance); - Assert.assertNotNull(savingsProductID); + Assertions.assertNotNull(savingsProductID); final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(groupID, savingsProductID, ACCOUNT_TYPE_GROUP); - Assert.assertNotNull(savingsId); + Assertions.assertNotNull(savingsId); HashMap savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsId); SavingsStatusChecker.verifySavingsIsPending(savingsStatusHashMap); @@ -536,23 +536,23 @@ public class GroupSavingsIntegrationTest { new ResponseSpecBuilder().build()); final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientID); + Assertions.assertNotNull(clientID); Integer groupID = GroupHelper.createGroup(this.requestSpec, this.responseSpec, true); - Assert.assertNotNull(groupID); + Assertions.assertNotNull(groupID); groupID = GroupHelper.associateClient(this.requestSpec, this.responseSpec, groupID.toString(), clientID.toString()); - Assert.assertNotNull(groupID); + Assertions.assertNotNull(groupID); final String minBalanceForInterestCalculation = null; final String minRequiredBalance = null; final String enforceMinRequiredBalance = "false"; final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE, minBalanceForInterestCalculation, minRequiredBalance, enforceMinRequiredBalance); - Assert.assertNotNull(savingsProductID); + Assertions.assertNotNull(savingsProductID); final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(groupID, savingsProductID, ACCOUNT_TYPE_GROUP); - Assert.assertNotNull(savingsId); + Assertions.assertNotNull(savingsId); HashMap savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsId); SavingsStatusChecker.verifySavingsIsPending(savingsStatusHashMap); @@ -575,39 +575,39 @@ public class GroupSavingsIntegrationTest { HashMap summary = this.savingsAccountHelper.getSavingsSummary(savingsId); Float balance = Float.valueOf(MINIMUM_OPENING_BALANCE); - assertEquals("Verifying opening Balance", balance, summary.get("accountBalance")); + assertEquals(balance, summary.get("accountBalance"), "Verifying opening Balance"); Integer depositTransactionId = (Integer) this.savingsAccountHelper.depositToSavingsAccount(savingsId, DEPOSIT_AMOUNT, SavingsAccountHelper.TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID); HashMap depositTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, depositTransactionId); balance += Float.valueOf(DEPOSIT_AMOUNT); - assertEquals("Verifying Deposit Amount", Float.valueOf(DEPOSIT_AMOUNT), depositTransaction.get("amount")); - assertEquals("Verifying Balance after Deposit", balance, depositTransaction.get("runningBalance")); + assertEquals(Float.valueOf(DEPOSIT_AMOUNT), depositTransaction.get("amount"), "Verifying Deposit Amount"); + assertEquals(balance, depositTransaction.get("runningBalance"), "Verifying Balance after Deposit"); Integer withdrawTransactionId = (Integer) this.savingsAccountHelper.withdrawalFromSavingsAccount(savingsId, WITHDRAW_AMOUNT, SavingsAccountHelper.TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID); HashMap withdrawTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, withdrawTransactionId); balance -= Float.valueOf(WITHDRAW_AMOUNT); - assertEquals("Verifying Withdrawal Amount", Float.valueOf(WITHDRAW_AMOUNT), withdrawTransaction.get("amount")); - assertEquals("Verifying Balance after Withdrawal", balance, withdrawTransaction.get("runningBalance")); + assertEquals(Float.valueOf(WITHDRAW_AMOUNT), withdrawTransaction.get("amount"), "Verifying Withdrawal Amount"); + assertEquals(balance, withdrawTransaction.get("runningBalance"), "Verifying Balance after Withdrawal"); Integer newWithdrawTransactionId = this.savingsAccountHelper.updateSavingsAccountTransaction(savingsId, withdrawTransactionId, WITHDRAW_AMOUNT_ADJUSTED); HashMap newWithdrawTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, newWithdrawTransactionId); balance = balance + Float.valueOf(WITHDRAW_AMOUNT) - Float.valueOf(WITHDRAW_AMOUNT_ADJUSTED); - assertEquals("Verifying adjusted Amount", Float.valueOf(WITHDRAW_AMOUNT_ADJUSTED), newWithdrawTransaction.get("amount")); - assertEquals("Verifying Balance after adjust", balance, newWithdrawTransaction.get("runningBalance")); + assertEquals(Float.valueOf(WITHDRAW_AMOUNT_ADJUSTED), newWithdrawTransaction.get("amount"), "Verifying adjusted Amount"); + assertEquals(balance, newWithdrawTransaction.get("runningBalance"), "Verifying Balance after adjust"); summary = this.savingsAccountHelper.getSavingsSummary(savingsId); - assertEquals("Verifying Adjusted Balance", balance, summary.get("accountBalance")); + assertEquals(balance, summary.get("accountBalance"), "Verifying Adjusted Balance"); withdrawTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, withdrawTransactionId); - Assert.assertTrue((Boolean) withdrawTransaction.get("reversed")); + Assertions.assertTrue((Boolean) withdrawTransaction.get("reversed")); this.savingsAccountHelper.undoSavingsAccountTransaction(savingsId, newWithdrawTransactionId); newWithdrawTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, withdrawTransactionId); - Assert.assertTrue((Boolean) newWithdrawTransaction.get("reversed")); + Assertions.assertTrue((Boolean) newWithdrawTransaction.get("reversed")); summary = this.savingsAccountHelper.getSavingsSummary(savingsId); balance += Float.valueOf(WITHDRAW_AMOUNT_ADJUSTED); - assertEquals("Verifying Balance After Undo Transaction", balance, summary.get("accountBalance")); + assertEquals(balance, summary.get("accountBalance"), "Verifying Balance After Undo Transaction"); error = (List) savingsAccountHelperValidationError.withdrawalFromSavingsAccount(savingsId, "5000", SavingsAccountHelper.TRANSACTION_DATE, CommonConstants.RESPONSE_ERROR); @@ -640,44 +640,44 @@ public class GroupSavingsIntegrationTest { this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec); final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientID); + Assertions.assertNotNull(clientID); Integer groupID = GroupHelper.createGroup(this.requestSpec, this.responseSpec, true); - Assert.assertNotNull(groupID); + Assertions.assertNotNull(groupID); groupID = GroupHelper.associateClient(this.requestSpec, this.responseSpec, groupID.toString(), clientID.toString()); - Assert.assertNotNull(groupID); + Assertions.assertNotNull(groupID); final String minBalanceForInterestCalculation = null; final String minRequiredBalance = null; final String enforceMinRequiredBalance = "false"; final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE, minBalanceForInterestCalculation, minRequiredBalance, enforceMinRequiredBalance); - Assert.assertNotNull(savingsProductID); + Assertions.assertNotNull(savingsProductID); final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(groupID, savingsProductID, ACCOUNT_TYPE_GROUP); - Assert.assertNotNull(savingsId); + Assertions.assertNotNull(savingsId); HashMap savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsId); SavingsStatusChecker.verifySavingsIsPending(savingsStatusHashMap); final Integer withdrawalChargeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec, ChargesHelper.getSavingsWithdrawalFeeJSON()); - Assert.assertNotNull(withdrawalChargeId); + Assertions.assertNotNull(withdrawalChargeId); this.savingsAccountHelper.addChargesForSavings(savingsId, withdrawalChargeId, false); ArrayList chargesPendingState = this.savingsAccountHelper.getSavingsCharges(savingsId); - Assert.assertEquals(1, chargesPendingState.size()); + Assertions.assertEquals(1, chargesPendingState.size()); Integer savingsChargeId = (Integer) chargesPendingState.get(0).get("id"); HashMap chargeChanges = this.savingsAccountHelper.updateCharges(savingsChargeId, savingsId); - Assert.assertTrue(chargeChanges.containsKey("amount")); + Assertions.assertTrue(chargeChanges.containsKey("amount")); Integer deletedChargeId = this.savingsAccountHelper.deleteCharge(savingsChargeId, savingsId); assertEquals(savingsChargeId, deletedChargeId); chargesPendingState = this.savingsAccountHelper.getSavingsCharges(savingsId); - Assert.assertTrue(chargesPendingState == null || chargesPendingState.size() == 0); + Assertions.assertTrue(chargesPendingState == null || chargesPendingState.size() == 0); savingsStatusHashMap = this.savingsAccountHelper.approveSavings(savingsId); SavingsStatusChecker.verifySavingsIsApproved(savingsStatusHashMap); @@ -686,14 +686,14 @@ public class GroupSavingsIntegrationTest { SavingsStatusChecker.verifySavingsIsActive(savingsStatusHashMap); final Integer chargeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec, ChargesHelper.getSavingsAnnualFeeJSON()); - Assert.assertNotNull(chargeId); + Assertions.assertNotNull(chargeId); ArrayList charges = this.savingsAccountHelper.getSavingsCharges(savingsId); - Assert.assertTrue(charges == null || charges.size() == 0); + Assertions.assertTrue(charges == null || charges.size() == 0); this.savingsAccountHelper.addChargesForSavings(savingsId, chargeId, true); charges = this.savingsAccountHelper.getSavingsCharges(savingsId); - Assert.assertEquals(1, charges.size()); + Assertions.assertEquals(1, charges.size()); HashMap savingsChargeForPay = charges.get(0); SimpleDateFormat sdf = new SimpleDateFormat(CommonConstants.DATE_FORMAT, Locale.US); @@ -710,11 +710,11 @@ public class GroupSavingsIntegrationTest { final Integer monthlyFeechargeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec, ChargesHelper.getSavingsMonthlyFeeJSON()); - Assert.assertNotNull(monthlyFeechargeId); + Assertions.assertNotNull(monthlyFeechargeId); this.savingsAccountHelper.addChargesForSavings(savingsId, monthlyFeechargeId, true); charges = this.savingsAccountHelper.getSavingsCharges(savingsId); - Assert.assertEquals(2, charges.size()); + Assertions.assertEquals(2, charges.size()); HashMap savingsChargeForWaive = charges.get(1); this.savingsAccountHelper.waiveCharge((Integer) savingsChargeForWaive.get("id"), savingsId); @@ -728,11 +728,11 @@ public class GroupSavingsIntegrationTest { assertEquals(totalWaiveAmount.floatValue(), waiveCharge.get("amountWaived")); final Integer weeklyFeeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec, ChargesHelper.getSavingsWeeklyFeeJSON()); - Assert.assertNotNull(weeklyFeeId); + Assertions.assertNotNull(weeklyFeeId); this.savingsAccountHelper.addChargesForSavings(savingsId, weeklyFeeId, true); charges = this.savingsAccountHelper.getSavingsCharges(savingsId); - Assert.assertEquals(3, charges.size()); + Assertions.assertEquals(3, charges.size()); savingsChargeForPay = charges.get(2); cal = Calendar.getInstance(); @@ -744,7 +744,7 @@ public class GroupSavingsIntegrationTest { // Depositing huge amount as scheduler job deducts the fee amount Integer depositTransactionId = (Integer) this.savingsAccountHelper.depositToSavingsAccount(savingsId, "100000", SavingsAccountHelper.TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID); - Assert.assertNotNull(depositTransactionId); + Assertions.assertNotNull(depositTransactionId); this.savingsAccountHelper.payCharge((Integer) savingsChargeForPay.get("id"), savingsId, ((Float) savingsChargeForPay.get("amount")).toString(), sdf.format(cal.getTime())); diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/GroupTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/GroupTest.java index 2a3d0a631..6cc413d04 100755 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/GroupTest.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/GroupTest.java @@ -18,8 +18,8 @@ */ package org.apache.fineract.integrationtests; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotEquals; import io.restassured.builder.RequestSpecBuilder; import io.restassured.builder.ResponseSpecBuilder; @@ -34,9 +34,9 @@ import org.apache.fineract.integrationtests.common.loans.LoanApplicationTestBuil import org.apache.fineract.integrationtests.common.loans.LoanProductTestBuilder; import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper; import org.apache.fineract.integrationtests.common.organisation.StaffHelper; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -54,7 +54,7 @@ public class GroupTest { private final String numberOfRepayments = "5"; private final String interestRatePerPeriod = "18"; - @Before + @BeforeEach public void setup() { Utils.initializeRESTAssured(); this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build(); @@ -110,21 +110,21 @@ public class GroupTest { // create staff Integer createStaffId1 = StaffHelper.createStaff(this.requestSpec, this.responseSpec); LOG.info("--------------creating first staff with id------------- {}" , createStaffId1); - Assert.assertNotNull(createStaffId1); + Assertions.assertNotNull(createStaffId1); Integer createStaffId2 = StaffHelper.createStaff(this.requestSpec, this.responseSpec); LOG.info("--------------creating second staff with id------------- {}" , createStaffId2); - Assert.assertNotNull(createStaffId2); + Assertions.assertNotNull(createStaffId2); // assign staff "createStaffId1" to group HashMap assignStaffGroupId = (HashMap) GroupHelper.assignStaff(this.requestSpec, this.responseSpec, groupID.toString(), createStaffId1.longValue()); - assertEquals("Verify assigned staff id is the same as id sent", assignStaffGroupId.get("staffId"), createStaffId1); + assertEquals(assignStaffGroupId.get("staffId"), createStaffId1, "Verify assigned staff id is the same as id sent"); // assign staff "createStaffId2" to client final HashMap assignStaffToClientChanges = (HashMap) ClientHelper.assignStaffToClient(this.requestSpec, this.responseSpec, clientID.toString(), createStaffId2.toString()); - assertEquals("Verify assigned staff id is the same as id sent", assignStaffToClientChanges.get("staffId"), createStaffId2); + assertEquals(assignStaffToClientChanges.get("staffId"), createStaffId2, "Verify assigned staff id is the same as id sent"); final Integer loanProductId = this.createLoanProduct(); @@ -139,13 +139,13 @@ public class GroupTest { // assert if client staff officer has change Note client was assigned // staff with createStaffId2 - assertNotEquals("Verify if client stuff has changed", assignStaffAndInheritStaffForClientAccounts.get("staffId"), createStaffId2); - assertEquals("Verify if client inherited staff assigned above", assignStaffAndInheritStaffForClientAccounts.get("staffId"), - getClientStaffId); + assertNotEquals(assignStaffAndInheritStaffForClientAccounts.get("staffId"), createStaffId2, "Verify if client stuff has changed"); + assertEquals(assignStaffAndInheritStaffForClientAccounts.get("staffId"), getClientStaffId, + "Verify if client inherited staff assigned above"); // assert if clients loan officer has changed final Integer loanOfficerId = this.loanTransactionHelper.getLoanOfficerId(loanId.toString()); - assertEquals("Verify if client loan inherited staff", assignStaffAndInheritStaffForClientAccounts.get("staffId"), loanOfficerId); + assertEquals(assignStaffAndInheritStaffForClientAccounts.get("staffId"), loanOfficerId, "Verify if client loan inherited staff"); } diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/HookIntegrationTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/HookIntegrationTest.java index 0e214a79c..b5582f628 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/HookIntegrationTest.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/HookIntegrationTest.java @@ -18,7 +18,7 @@ */ package org.apache.fineract.integrationtests; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.fail; import io.restassured.RestAssured; import io.restassured.builder.RequestSpecBuilder; @@ -33,9 +33,9 @@ import org.apache.fineract.integrationtests.common.HookHelper; import org.apache.fineract.integrationtests.common.OfficeHelper; import org.apache.fineract.integrationtests.common.Utils; import org.apache.http.conn.HttpHostConnectException; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -47,7 +47,7 @@ public class HookIntegrationTest { private HookHelper hookHelper; private OfficeHelper officeHelper; - @Before + @BeforeEach public void setUp() throws Exception { Utils.initializeRESTAssured(); this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build(); @@ -77,8 +77,8 @@ public class HookIntegrationTest { try { final String json = RestAssured.get(payloadURL.replace("?", "")).asString(); final Integer notificationOfficeId = JsonPath.with(json).get("officeId"); - Assert.assertEquals("Equality check for created officeId and hook received payload officeId", createdOfficeID, - notificationOfficeId); + Assertions.assertEquals(createdOfficeID, notificationOfficeId, + "Equality check for created officeId and hook received payload officeId"); LOG.info("Notification Office Id - {}" , notificationOfficeId); i = 6; } catch (Exception e) { @@ -102,7 +102,7 @@ public class HookIntegrationTest { final String updateURL = "http://localhost"; Long hookId = this.hookHelper.createHook(payloadURL).longValue(); - Assert.assertNotNull(hookId); + Assertions.assertNotNull(hookId); this.hookHelper.verifyHookCreatedOnServer(hookId); LOG.info("---------------------SUCCESSFULLY CREATED AND VERIFIED HOOK------------------------- {}",hookId); this.hookHelper.updateHook(updateURL, hookId); diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/LoanApplicationApprovalTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/LoanApplicationApprovalTest.java index 81d4fae6d..6a314e539 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/LoanApplicationApprovalTest.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/LoanApplicationApprovalTest.java @@ -18,7 +18,7 @@ */ package org.apache.fineract.integrationtests; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import io.restassured.builder.RequestSpecBuilder; import io.restassured.builder.ResponseSpecBuilder; @@ -35,8 +35,8 @@ import org.apache.fineract.integrationtests.common.loans.LoanApplicationTestBuil import org.apache.fineract.integrationtests.common.loans.LoanProductTestBuilder; import org.apache.fineract.integrationtests.common.loans.LoanStatusChecker; import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -49,7 +49,7 @@ public class LoanApplicationApprovalTest { private RequestSpecification requestSpec; private LoanTransactionHelper loanTransactionHelper; - @Before + @BeforeEach public void setup() { Utils.initializeRESTAssured(); this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build(); diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/LoanApplicationUndoLastTrancheTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/LoanApplicationUndoLastTrancheTest.java index 76e788425..b8a0cc297 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/LoanApplicationUndoLastTrancheTest.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/LoanApplicationUndoLastTrancheTest.java @@ -32,9 +32,9 @@ import org.apache.fineract.integrationtests.common.loans.LoanApplicationTestBuil import org.apache.fineract.integrationtests.common.loans.LoanProductTestBuilder; import org.apache.fineract.integrationtests.common.loans.LoanStatusChecker; import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -46,7 +46,7 @@ public class LoanApplicationUndoLastTrancheTest { private LoanTransactionHelper loanTransactionHelper; private LoanApplicationApprovalTest loanApplicationApprovalTest; - @Before + @BeforeEach public void setup() { Utils.initializeRESTAssured(); this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build(); @@ -125,7 +125,7 @@ public class LoanApplicationUndoLastTrancheTest { } private void validateDisbursedAmount(Float disbursedAmount) { - Assert.assertEquals(Float.valueOf("1000.0"), disbursedAmount); + Assertions.assertEquals(Float.valueOf("1000.0"), disbursedAmount); } diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/LoanDisbursalDateValidationTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/LoanDisbursalDateValidationTest.java index 63ab0d6fe..639fc1f08 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/LoanDisbursalDateValidationTest.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/LoanDisbursalDateValidationTest.java @@ -32,9 +32,9 @@ import org.apache.fineract.integrationtests.common.loans.LoanApplicationTestBuil import org.apache.fineract.integrationtests.common.loans.LoanProductTestBuilder; import org.apache.fineract.integrationtests.common.loans.LoanStatusChecker; import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -46,7 +46,7 @@ public class LoanDisbursalDateValidationTest { private LoanTransactionHelper loanTransactionHelper; private ResponseSpecification responseForbiddenError; - @Before + @BeforeEach public void setup() { Utils.initializeRESTAssured(); this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build(); @@ -94,8 +94,8 @@ public class LoanDisbursalDateValidationTest { @SuppressWarnings("unchecked") List disbursalError = (List) this.loanTransactionHelper.disburseLoan(disbursalDate, loanID, this.responseForbiddenError); - Assert.assertEquals("error.msg.actual.disbursement.date.does.not.match.with.expected.disbursal.date", - disbursalError.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE)); + Assertions.assertEquals(disbursalError.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE), + "error.msg.actual.disbursement.date.does.not.match.with.expected.disbursal.date"); } diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/LoanDisbursementDetailsIntegrationTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/LoanDisbursementDetailsIntegrationTest.java index d125806c4..68124c9d5 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/LoanDisbursementDetailsIntegrationTest.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/LoanDisbursementDetailsIntegrationTest.java @@ -18,7 +18,7 @@ */ package org.apache.fineract.integrationtests; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import io.restassured.builder.RequestSpecBuilder; import io.restassured.builder.ResponseSpecBuilder; @@ -37,8 +37,8 @@ import org.apache.fineract.integrationtests.common.loans.LoanDisbursementTestBui import org.apache.fineract.integrationtests.common.loans.LoanProductTestBuilder; import org.apache.fineract.integrationtests.common.loans.LoanStatusChecker; import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -55,7 +55,7 @@ public class LoanDisbursementDetailsIntegrationTest { final String proposedAmount = "5000"; final String approvalAmount = "5000"; - @Before + @BeforeEach public void setup() { Utils.initializeRESTAssured(); this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build(); diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/LoanRepaymentRescheduleAtDisbursementTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/LoanRepaymentRescheduleAtDisbursementTest.java index b208fa989..803c01356 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/LoanRepaymentRescheduleAtDisbursementTest.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/LoanRepaymentRescheduleAtDisbursementTest.java @@ -18,7 +18,7 @@ */ package org.apache.fineract.integrationtests; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import io.restassured.builder.RequestSpecBuilder; import io.restassured.builder.ResponseSpecBuilder; @@ -38,8 +38,8 @@ import org.apache.fineract.integrationtests.common.loans.LoanApplicationTestBuil import org.apache.fineract.integrationtests.common.loans.LoanProductTestBuilder; import org.apache.fineract.integrationtests.common.loans.LoanStatusChecker; import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -52,7 +52,7 @@ public class LoanRepaymentRescheduleAtDisbursementTest { private LoanApplicationApprovalTest loanApplicationApprovalTest; private ResponseSpecification generalResponseSpec; - @Before + @BeforeEach public void setup() { Utils.initializeRESTAssured(); this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build(); diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/LoanRescheduleRequestTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/LoanRescheduleRequestTest.java index 60a76be10..33bf33af9 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/LoanRescheduleRequestTest.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/LoanRescheduleRequestTest.java @@ -18,8 +18,8 @@ */ package org.apache.fineract.integrationtests; -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.assertTrue; import io.restassured.builder.RequestSpecBuilder; import io.restassured.builder.ResponseSpecBuilder; @@ -34,8 +34,8 @@ import org.apache.fineract.integrationtests.common.loans.LoanApplicationTestBuil import org.apache.fineract.integrationtests.common.loans.LoanProductTestBuilder; import org.apache.fineract.integrationtests.common.loans.LoanRescheduleRequestTestBuilder; import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -59,7 +59,7 @@ public class LoanRescheduleRequestTest { private String interestRatePerPeriod = "18"; private String dateString = "4 September 2014"; - @Before + @BeforeEach public void initialize() { Utils.initializeRESTAssured(); this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build(); diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/LoanReschedulingWithinCenterTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/LoanReschedulingWithinCenterTest.java index 2ed745ca7..80e1b2e6e 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/LoanReschedulingWithinCenterTest.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/LoanReschedulingWithinCenterTest.java @@ -19,7 +19,7 @@ package org.apache.fineract.integrationtests; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import com.google.gson.Gson; import io.restassured.builder.RequestSpecBuilder; @@ -49,9 +49,9 @@ import org.apache.fineract.integrationtests.common.loans.LoanProductTestBuilder; import org.apache.fineract.integrationtests.common.loans.LoanStatusChecker; import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper; import org.apache.fineract.integrationtests.common.organisation.StaffHelper; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -63,7 +63,7 @@ public class LoanReschedulingWithinCenterTest { private ResponseSpecification generalResponseSpec; private LoanApplicationApprovalTest loanApplicationApprovalTest; - @Before + @BeforeEach public void setup() { Utils.initializeRESTAssured(); this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build(); @@ -90,9 +90,9 @@ public class LoanReschedulingWithinCenterTest { responseSpec); CenterDomain center = CenterHelper.retrieveByID(centerId, requestSpec, responseSpec); Integer groupId = groupMembers[0]; - Assert.assertNotNull(center); - Assert.assertTrue(center.getStaffId() == staffId); - Assert.assertTrue(center.isActive() == true); + Assertions.assertNotNull(center); + Assertions.assertTrue(center.getStaffId() == staffId); + Assertions.assertTrue(center.isActive() == true); Integer calendarId = createCalendarMeeting(centerId); @@ -122,7 +122,7 @@ public class LoanReschedulingWithinCenterTest { recalculationRestFrequencyDate, LoanApplicationTestBuilder.RBI_INDIA_STRATEGY, new ArrayList(0), null); // Test for loan account is created - Assert.assertNotNull(loanId); + Assertions.assertNotNull(loanId); HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanId); // Test for loan account is created, can be approved @@ -201,9 +201,9 @@ public class LoanReschedulingWithinCenterTest { responseSpec); CenterDomain center = CenterHelper.retrieveByID(centerId, requestSpec, responseSpec); Integer groupId = groupMembers[0]; - Assert.assertNotNull(center); - Assert.assertTrue(center.getStaffId() == staffId); - Assert.assertTrue(center.isActive() == true); + Assertions.assertNotNull(center); + Assertions.assertTrue(center.getStaffId() == staffId); + Assertions.assertTrue(center.isActive() == true); Integer calendarId = createCalendarMeeting(centerId); diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/LoanWithWaiveInterestAndWriteOffIntegrationTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/LoanWithWaiveInterestAndWriteOffIntegrationTest.java index c0f186d56..eccb78c44 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/LoanWithWaiveInterestAndWriteOffIntegrationTest.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/LoanWithWaiveInterestAndWriteOffIntegrationTest.java @@ -30,9 +30,9 @@ import org.apache.fineract.integrationtests.common.loans.LoanApplicationTestBuil import org.apache.fineract.integrationtests.common.loans.LoanProductTestBuilder; import org.apache.fineract.integrationtests.common.loans.LoanStatusChecker; import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -62,7 +62,7 @@ public class LoanWithWaiveInterestAndWriteOffIntegrationTest { private final String INTEREST_VALUE_AMOUNT = "40.00"; private LoanTransactionHelper loanTransactionHelper; - @Before + @BeforeEach public void setup() { Utils.initializeRESTAssured(); this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build(); @@ -170,22 +170,22 @@ public class LoanWithWaiveInterestAndWriteOffIntegrationTest { this.loanTransactionHelper.makeRepayment("1 January 2011", repayment_with_interest, loanID); HashMap toLoanSummaryAfter = this.loanTransactionHelper.getLoanSummary(requestSpec, responseSpec, loanID); - Assert.assertTrue("Checking for Principal paid ", - Float.valueOf("500.0").compareTo(Float.valueOf(String.valueOf(toLoanSummaryAfter.get("principalPaid")))) == 0); - Assert.assertTrue("Checking for interestPaid paid ", - Float.valueOf("180.0").compareTo(Float.valueOf(String.valueOf(toLoanSummaryAfter.get("interestPaid")))) == 0); - Assert.assertTrue("Checking for total paid ", - Float.valueOf("680.0").compareTo(Float.valueOf(String.valueOf(toLoanSummaryAfter.get("totalRepayment")))) == 0); + Assertions.assertTrue(Float.valueOf("500.0").compareTo(Float.valueOf(String.valueOf(toLoanSummaryAfter.get("principalPaid")))) == 0, + "Checking for Principal paid "); + Assertions.assertTrue(Float.valueOf("180.0").compareTo(Float.valueOf(String.valueOf(toLoanSummaryAfter.get("interestPaid")))) == 0, + "Checking for interestPaid paid "); + Assertions.assertTrue(Float.valueOf("680.0").compareTo(Float.valueOf(String.valueOf(toLoanSummaryAfter.get("totalRepayment")))) == 0, + "Checking for total paid "); // WRITE OFF LOAN AND CHECK ACCOUNT IS CLOSED LoanStatusChecker.verifyLoanAccountIsClosed(this.loanTransactionHelper.writeOffLoan("1 January 2011", loanID)); toLoanSummaryAfter = this.loanTransactionHelper.getLoanSummary(requestSpec, responseSpec, loanID); - Assert.assertTrue("Checking for Principal written off ", - Float.valueOf("4000.0").compareTo(Float.valueOf(String.valueOf(toLoanSummaryAfter.get("principalWrittenOff")))) == 0); - Assert.assertTrue("Checking for interestPaid written off ", - Float.valueOf("1440.0").compareTo(Float.valueOf(String.valueOf(toLoanSummaryAfter.get("interestWrittenOff")))) == 0); - Assert.assertTrue("Checking for total written off ", - Float.valueOf("5440.0").compareTo(Float.valueOf(String.valueOf(toLoanSummaryAfter.get("totalWrittenOff")))) == 0); + Assertions.assertTrue(Float.valueOf("4000.0").compareTo(Float.valueOf(String.valueOf(toLoanSummaryAfter.get("principalWrittenOff")))) == 0, + "Checking for Principal written off "); + Assertions.assertTrue(Float.valueOf("1440.0").compareTo(Float.valueOf(String.valueOf(toLoanSummaryAfter.get("interestWrittenOff")))) == 0, + "Checking for interestPaid written off "); + Assertions.assertTrue(Float.valueOf("5440.0").compareTo(Float.valueOf(String.valueOf(toLoanSummaryAfter.get("totalWrittenOff")))) == 0, + "Checking for total written off "); } diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/LoanWithdrawnByApplicantIntegrationTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/LoanWithdrawnByApplicantIntegrationTest.java index ce6e73fe0..d3493846b 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/LoanWithdrawnByApplicantIntegrationTest.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/LoanWithdrawnByApplicantIntegrationTest.java @@ -30,8 +30,8 @@ import org.apache.fineract.integrationtests.common.loans.LoanApplicationTestBuil import org.apache.fineract.integrationtests.common.loans.LoanProductTestBuilder; import org.apache.fineract.integrationtests.common.loans.LoanStatusChecker; import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; @SuppressWarnings("rawtypes") public class LoanWithdrawnByApplicantIntegrationTest { @@ -40,7 +40,7 @@ public class LoanWithdrawnByApplicantIntegrationTest { private RequestSpecification requestSpec; private LoanTransactionHelper loanTransactionHelper; - @Before + @BeforeEach public void setup() { Utils.initializeRESTAssured(); this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build(); diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/MinimumDaysBetweenDisbursalAndFirstRepaymentTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/MinimumDaysBetweenDisbursalAndFirstRepaymentTest.java index 393bf5517..7a9ae199d 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/MinimumDaysBetweenDisbursalAndFirstRepaymentTest.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/MinimumDaysBetweenDisbursalAndFirstRepaymentTest.java @@ -18,7 +18,7 @@ */ package org.apache.fineract.integrationtests; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import io.restassured.builder.RequestSpecBuilder; import io.restassured.builder.ResponseSpecBuilder; @@ -36,9 +36,9 @@ import org.apache.fineract.integrationtests.common.loans.LoanApplicationTestBuil import org.apache.fineract.integrationtests.common.loans.LoanProductTestBuilder; import org.apache.fineract.integrationtests.common.loans.LoanStatusChecker; import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; /** * Test the creation, approval and rejection of a loan reschedule request @@ -60,7 +60,7 @@ public class MinimumDaysBetweenDisbursalAndFirstRepaymentTest { private final String interestRatePerPeriod = "18"; private final String groupActivationDate = "1 August 2014"; - @Before + @BeforeEach public void setup() { Utils.initializeRESTAssured(); } @@ -95,7 +95,7 @@ public class MinimumDaysBetweenDisbursalAndFirstRepaymentTest { this.loanId = this.loanTransactionHelper.getLoanId(loanApplicationJSON); // Test for loan account is created - Assert.assertNotNull(this.loanId); + Assertions.assertNotNull(this.loanId); HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, this.loanId); LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap); diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/NotificationApiTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/NotificationApiTest.java index e4925d0a1..e1f8bb3f8 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/NotificationApiTest.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/NotificationApiTest.java @@ -26,9 +26,9 @@ import io.restassured.specification.ResponseSpecification; import java.util.HashMap; import org.apache.fineract.integrationtests.common.NotificationHelper; import org.apache.fineract.integrationtests.common.Utils; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -37,7 +37,7 @@ public class NotificationApiTest { private ResponseSpecification responseSpec; private RequestSpecification requestSpec; - @Before + @BeforeEach public void setUp() { Utils.initializeRESTAssured(); this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build(); @@ -51,6 +51,6 @@ public class NotificationApiTest { HashMap response = (HashMap) NotificationHelper.getNotifications(this.requestSpec, this.responseSpec, ""); LOG.info("Response : {}" , response.toString()); - Assert.assertNotNull(response); + Assertions.assertNotNull(response); } } diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/OfficeIntegrationTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/OfficeIntegrationTest.java index c9ff85fdd..7138f83b0 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/OfficeIntegrationTest.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/OfficeIntegrationTest.java @@ -26,16 +26,16 @@ import io.restassured.specification.ResponseSpecification; import org.apache.fineract.integrationtests.common.OfficeDomain; import org.apache.fineract.integrationtests.common.OfficeHelper; import org.apache.fineract.integrationtests.common.Utils; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class OfficeIntegrationTest { private ResponseSpecification responseSpec; private RequestSpecification requestSpec; - @Before + @BeforeEach public void setup() { Utils.initializeRESTAssured(); this.requestSpec = new RequestSpecBuilder().setContentType( @@ -59,7 +59,7 @@ public class OfficeIntegrationTest { oh.updateOffice(officeId, name, date); OfficeDomain newOffice = oh.retrieveOfficeByID(officeId); - Assert.assertTrue(name.equals(newOffice.getName())); - Assert.assertArrayEquals(dateArr, newOffice.getOpeningDate()); + Assertions.assertTrue(name.equals(newOffice.getName())); + Assertions.assertArrayEquals(dateArr, newOffice.getOpeningDate()); } } diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/PasswordPreferencesIntegrationTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/PasswordPreferencesIntegrationTest.java index f670693e1..693cc0db5 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/PasswordPreferencesIntegrationTest.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/PasswordPreferencesIntegrationTest.java @@ -18,7 +18,7 @@ */ package org.apache.fineract.integrationtests; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import io.restassured.builder.RequestSpecBuilder; import io.restassured.builder.ResponseSpecBuilder; @@ -30,8 +30,8 @@ import java.util.List; import org.apache.fineract.integrationtests.common.CommonConstants; import org.apache.fineract.integrationtests.common.PasswordPreferencesHelper; import org.apache.fineract.integrationtests.common.Utils; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -42,7 +42,7 @@ public class PasswordPreferencesIntegrationTest { private RequestSpecification requestSpec; private ResponseSpecification generalResponseSpec; - @Before + @BeforeEach public void setUp() { Utils.initializeRESTAssured(); this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build(); @@ -71,8 +71,8 @@ public class PasswordPreferencesIntegrationTest { String invalidValidationPolicyId = "2000"; final List error = (List) PasswordPreferencesHelper.updateWithInvalidValidationPolicyId(requestSpec, generalResponseSpec, invalidValidationPolicyId, CommonConstants.RESPONSE_ERROR); - assertEquals("Password Validation Policy with identifier 2000 does not exist", "error.msg.password.validation.policy.id.invalid", - error.get(0).get("userMessageGlobalisationCode")); + assertEquals("error.msg.password.validation.policy.id.invalid", error.get(0).get("userMessageGlobalisationCode"), + "Password Validation Policy with identifier 2000 does not exist"); } } diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/PaymentTypeIntegrationTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/PaymentTypeIntegrationTest.java index f05a1459b..ef7cf27a8 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/PaymentTypeIntegrationTest.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/PaymentTypeIntegrationTest.java @@ -27,16 +27,16 @@ import java.util.HashMap; import org.apache.fineract.integrationtests.common.PaymentTypeDomain; import org.apache.fineract.integrationtests.common.PaymentTypeHelper; import org.apache.fineract.integrationtests.common.Utils; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class PaymentTypeIntegrationTest { private ResponseSpecification responseSpec; private RequestSpecification requestSpec; - @Before + @BeforeEach public void setup() { Utils.initializeRESTAssured(); this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build(); @@ -54,13 +54,13 @@ public class PaymentTypeIntegrationTest { Integer position = 1; Integer paymentTypeId = PaymentTypeHelper.createPaymentType(requestSpec, responseSpec, name, description, isCashPayment, position); - Assert.assertNotNull(paymentTypeId); + Assertions.assertNotNull(paymentTypeId); PaymentTypeHelper.verifyPaymentTypeCreatedOnServer(requestSpec, responseSpec, paymentTypeId); PaymentTypeDomain paymentTypeResponse = PaymentTypeHelper.retrieveById(requestSpec, responseSpec, paymentTypeId); - Assert.assertEquals(name, paymentTypeResponse.getName()); - Assert.assertEquals(description, paymentTypeResponse.getDescription()); - Assert.assertEquals(isCashPayment, paymentTypeResponse.getIsCashPayment()); - Assert.assertEquals(position, paymentTypeResponse.getPosition()); + Assertions.assertEquals(name, paymentTypeResponse.getName()); + Assertions.assertEquals(description, paymentTypeResponse.getDescription()); + Assertions.assertEquals(isCashPayment, paymentTypeResponse.getIsCashPayment()); + Assertions.assertEquals(position, paymentTypeResponse.getPosition()); // Update Payment Type String newName = PaymentTypeHelper.randomNameGenerator("P_TU", 5); @@ -75,14 +75,14 @@ public class PaymentTypeIntegrationTest { request.put("position", newPosition); PaymentTypeHelper.updatePaymentType(paymentTypeId, request, requestSpec, responseSpec); PaymentTypeDomain paymentTypeUpdatedResponse = PaymentTypeHelper.retrieveById(requestSpec, responseSpec, paymentTypeId); - Assert.assertEquals(newName, paymentTypeUpdatedResponse.getName()); - Assert.assertEquals(newDescription, paymentTypeUpdatedResponse.getDescription()); - Assert.assertEquals(isCashPaymentUpdatedValue, paymentTypeUpdatedResponse.getIsCashPayment()); - Assert.assertEquals(newPosition, paymentTypeUpdatedResponse.getPosition()); + Assertions.assertEquals(newName, paymentTypeUpdatedResponse.getName()); + Assertions.assertEquals(newDescription, paymentTypeUpdatedResponse.getDescription()); + Assertions.assertEquals(isCashPaymentUpdatedValue, paymentTypeUpdatedResponse.getIsCashPayment()); + Assertions.assertEquals(newPosition, paymentTypeUpdatedResponse.getPosition()); // Delete Integer deletedPaymentTypeId = PaymentTypeHelper.deletePaymentType(paymentTypeId, requestSpec, responseSpec); - Assert.assertEquals(paymentTypeId, deletedPaymentTypeId); + Assertions.assertEquals(paymentTypeId, deletedPaymentTypeId); ResponseSpecification responseSpecification = new ResponseSpecBuilder().expectStatusCode(404).build(); PaymentTypeHelper.retrieveById(requestSpec, responseSpecification, paymentTypeId); diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/RatesTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/RatesTest.java index f84ddea09..c18705272 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/RatesTest.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/RatesTest.java @@ -27,9 +27,9 @@ import java.util.ArrayList; import java.util.HashMap; import org.apache.fineract.integrationtests.common.Utils; import org.apache.fineract.integrationtests.common.rates.RatesHelper; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; @SuppressWarnings({"rawtypes"}) public class RatesTest { @@ -37,7 +37,7 @@ public class RatesTest { private ResponseSpecification responseSpec; private RequestSpecification requestSpec; - @Before + @BeforeEach public void setup() { Utils.initializeRESTAssured(); this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build(); @@ -51,12 +51,12 @@ public class RatesTest { // Retrieving all Rates ArrayList allRatesData = RatesHelper.getRates(this.requestSpec, this.responseSpec); - Assert.assertNotNull(allRatesData); + Assertions.assertNotNull(allRatesData); // Testing Creation and Update of Loan Rate final Integer loanRateId = RatesHelper.createRates(this.requestSpec, this.responseSpec, RatesHelper.getLoanRateJSON()); - Assert.assertNotNull(loanRateId); + Assertions.assertNotNull(loanRateId); //Update Rate percentage HashMap changes = RatesHelper.updateRates(this.requestSpec, this.responseSpec, loanRateId, @@ -64,8 +64,8 @@ public class RatesTest { HashMap rateDataAfterChanges = RatesHelper .getRateById(this.requestSpec, this.responseSpec, loanRateId); - Assert.assertEquals("Verifying Rate after modification", rateDataAfterChanges.get("percentage"), - changes.get("percentage")); + Assertions.assertEquals(rateDataAfterChanges.get("percentage"), + changes.get("percentage"), "Verifying Rate after modification"); } diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/RecurringDepositTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/RecurringDepositTest.java index 4e6233ac1..b86ba2d47 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/RecurringDepositTest.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/RecurringDepositTest.java @@ -18,7 +18,7 @@ */ package org.apache.fineract.integrationtests; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import io.restassured.builder.RequestSpecBuilder; import io.restassured.builder.ResponseSpecBuilder; @@ -55,10 +55,10 @@ import org.apache.fineract.integrationtests.common.savings.SavingsProductHelper; import org.apache.fineract.integrationtests.common.savings.SavingsStatusChecker; import org.joda.time.DateTime; import org.joda.time.Months; -import org.junit.After; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -106,7 +106,7 @@ public class RecurringDepositTest { // digits. A proper solution would be to implement the exact interest calculation in this test, // and then to compare the exact results - @Before + @BeforeEach public void setup() { Utils.initializeRESTAssured(); this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build(); @@ -164,7 +164,7 @@ public class RecurringDepositTest { * Create client for applying Deposit account */ Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientId); + Assertions.assertNotNull(clientId); /*** * Create RD product with CashBased accounting enabled @@ -172,14 +172,14 @@ public class RecurringDepositTest { final String accountingRule = CASH_BASED; Integer recurringDepositProductId = createRecurringDepositProduct(VALID_FROM, VALID_TO, accountingRule, assetAccount, liabilityAccount, incomeAccount, expenseAccount); - Assert.assertNotNull(recurringDepositProductId); + Assertions.assertNotNull(recurringDepositProductId); /*** * Apply for RD account with created product and verify status */ Integer recurringDepositAccountId = applyForRecurringDepositApplication(clientId.toString(), recurringDepositProductId.toString(), VALID_FROM, VALID_TO, SUBMITTED_ON_DATE, WHOLE_TERM, EXPECTED_FIRST_DEPOSIT_ON_DATE); - Assert.assertNotNull(recurringDepositAccountId); + Assertions.assertNotNull(recurringDepositAccountId); HashMap recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker.getStatusOfRecurringDepositAccount( this.requestSpec, this.responseSpec, recurringDepositAccountId.toString()); @@ -209,7 +209,7 @@ public class RecurringDepositTest { */ Integer depositTransactionId = this.recurringDepositAccountHelper.depositToRecurringDepositAccount(recurringDepositAccountId, depositAmount, EXPECTED_FIRST_DEPOSIT_ON_DATE); - Assert.assertNotNull(depositTransactionId); + Assertions.assertNotNull(depositTransactionId); this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, EXPECTED_FIRST_DEPOSIT_ON_DATE, new JournalEntry( depositAmount, JournalEntry.TransactionType.DEBIT)); @@ -220,14 +220,14 @@ public class RecurringDepositTest { * Update interest earned field for RD account */ recurringDepositAccountId = this.recurringDepositAccountHelper.calculateInterestForRecurringDeposit(recurringDepositAccountId); - Assert.assertNotNull(recurringDepositAccountId); + Assertions.assertNotNull(recurringDepositAccountId); /*** * Post interest and verify journal entries */ Integer transactionIdForPostInterest = this.recurringDepositAccountHelper .postInterestForRecurringDeposit(recurringDepositAccountId); - Assert.assertNotNull(transactionIdForPostInterest); + Assertions.assertNotNull(transactionIdForPostInterest); HashMap accountSummary = this.recurringDepositAccountHelper.getRecurringDepositSummary(recurringDepositAccountId); Float totalInterestPosted = (Float) accountSummary.get("totalInterestPosted"); @@ -248,7 +248,7 @@ public class RecurringDepositTest { */ Integer prematureClosureTransactionId = (Integer) this.recurringDepositAccountHelper.prematureCloseForRecurringDeposit( recurringDepositAccountId, CLOSED_ON_DATE, CLOSURE_TYPE_WITHDRAW_DEPOSIT, null, CommonConstants.RESPONSE_RESOURCE_ID); - Assert.assertNotNull(prematureClosureTransactionId); + Assertions.assertNotNull(prematureClosureTransactionId); recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker.getStatusOfRecurringDepositAccount(this.requestSpec, this.responseSpec, recurringDepositAccountId.toString()); @@ -316,7 +316,7 @@ public class RecurringDepositTest { * Create client for applying Deposit and Savings accounts */ Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientId); + Assertions.assertNotNull(clientId); /*** * Create Savings product with CashBased accounting enabled @@ -324,13 +324,13 @@ public class RecurringDepositTest { final String accountingRule = CASH_BASED; final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE, accountingRule, assetAccount, liabilityAccount, incomeAccount, expenseAccount); - Assert.assertNotNull(savingsProductID); + Assertions.assertNotNull(savingsProductID); /*** * Create Savings account and verify status is pending */ final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(clientId, savingsProductID, ACCOUNT_TYPE_INDIVIDUAL); - Assert.assertNotNull(savingsProductID); + Assertions.assertNotNull(savingsProductID); HashMap savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsId); SavingsStatusChecker.verifySavingsIsPending(savingsStatusHashMap); @@ -352,14 +352,14 @@ public class RecurringDepositTest { */ Integer recurringDepositProductId = createRecurringDepositProduct(VALID_FROM, VALID_TO, accountingRule, assetAccount, liabilityAccount, incomeAccount, expenseAccount); - Assert.assertNotNull(recurringDepositProductId); + Assertions.assertNotNull(recurringDepositProductId); /*** * Apply for RD account with created product and verify status */ Integer recurringDepositAccountId = applyForRecurringDepositApplication(clientId.toString(), recurringDepositProductId.toString(), VALID_FROM, VALID_TO, SUBMITTED_ON_DATE, WHOLE_TERM, EXPECTED_FIRST_DEPOSIT_ON_DATE); - Assert.assertNotNull(recurringDepositAccountId); + Assertions.assertNotNull(recurringDepositAccountId); HashMap recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker.getStatusOfRecurringDepositAccount( this.requestSpec, this.responseSpec, recurringDepositAccountId.toString()); @@ -389,7 +389,7 @@ public class RecurringDepositTest { */ Integer depositTransactionId = this.recurringDepositAccountHelper.depositToRecurringDepositAccount(recurringDepositAccountId, depositAmount, EXPECTED_FIRST_DEPOSIT_ON_DATE); - Assert.assertNotNull(depositTransactionId); + Assertions.assertNotNull(depositTransactionId); this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, EXPECTED_FIRST_DEPOSIT_ON_DATE, new JournalEntry( depositAmount, JournalEntry.TransactionType.DEBIT)); @@ -400,14 +400,14 @@ public class RecurringDepositTest { * Update interest earned field for RD account */ recurringDepositAccountId = this.recurringDepositAccountHelper.calculateInterestForRecurringDeposit(recurringDepositAccountId); - Assert.assertNotNull(recurringDepositAccountId); + Assertions.assertNotNull(recurringDepositAccountId); /*** * Post interest and verify journal entries */ Integer transactionIdForPostInterest = this.recurringDepositAccountHelper .postInterestForRecurringDeposit(recurringDepositAccountId); - Assert.assertNotNull(transactionIdForPostInterest); + Assertions.assertNotNull(transactionIdForPostInterest); HashMap accountSummary = this.recurringDepositAccountHelper.getRecurringDepositSummary(recurringDepositAccountId); Float totalInterestPosted = (Float) accountSummary.get("totalInterestPosted"); @@ -437,7 +437,7 @@ public class RecurringDepositTest { Integer prematureClosureTransactionId = (Integer) this.recurringDepositAccountHelper.prematureCloseForRecurringDeposit( recurringDepositAccountId, CLOSED_ON_DATE, CLOSURE_TYPE_TRANSFER_TO_SAVINGS, savingsId, CommonConstants.RESPONSE_RESOURCE_ID); - Assert.assertNotNull(prematureClosureTransactionId); + Assertions.assertNotNull(prematureClosureTransactionId); recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker.getStatusOfRecurringDepositAccount(this.requestSpec, this.responseSpec, recurringDepositAccountId.toString()); @@ -468,8 +468,8 @@ public class RecurringDepositTest { Double balanceAfter = Math.floor((Float) savingsSummaryAfter.get("accountBalance")); Double expectedSavingsBalance = Math.floor(balanceBefore + prematurityAmount); - Assert.assertEquals("Verifying Savings Account Balance after Premature Closure", expectedSavingsBalance, - balanceAfter); + Assertions.assertEquals(expectedSavingsBalance, balanceAfter, + "Verifying Savings Account Balance after Premature Closure"); } @@ -519,7 +519,7 @@ public class RecurringDepositTest { * Create client for applying Deposit and Savings accounts */ Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientId); + Assertions.assertNotNull(clientId); /*** * Create Savings product with CashBased accounting enabled @@ -527,13 +527,13 @@ public class RecurringDepositTest { final String accountingRule = CASH_BASED; final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE, accountingRule, assetAccount, liabilityAccount, incomeAccount, expenseAccount); - Assert.assertNotNull(savingsProductID); + Assertions.assertNotNull(savingsProductID); /*** * Create Savings account and verify status is pending */ final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(clientId, savingsProductID, ACCOUNT_TYPE_INDIVIDUAL); - Assert.assertNotNull(savingsProductID); + Assertions.assertNotNull(savingsProductID); HashMap savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsId); SavingsStatusChecker.verifySavingsIsPending(savingsStatusHashMap); @@ -556,14 +556,14 @@ public class RecurringDepositTest { final Integer taxGroupId = createTaxGroup("10", liabilityAccountForTax); Integer recurringDepositProductId = createRecurringDepositProductWithWithHoldTax(VALID_FROM, VALID_TO,String.valueOf(taxGroupId), accountingRule, assetAccount, liabilityAccount, incomeAccount, expenseAccount); - Assert.assertNotNull(recurringDepositProductId); + Assertions.assertNotNull(recurringDepositProductId); /*** * Apply for RD account with created product and verify status */ Integer recurringDepositAccountId = applyForRecurringDepositApplication(clientId.toString(), recurringDepositProductId.toString(), VALID_FROM, VALID_TO, SUBMITTED_ON_DATE, WHOLE_TERM, EXPECTED_FIRST_DEPOSIT_ON_DATE); - Assert.assertNotNull(recurringDepositAccountId); + Assertions.assertNotNull(recurringDepositAccountId); HashMap recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker.getStatusOfRecurringDepositAccount( this.requestSpec, this.responseSpec, recurringDepositAccountId.toString()); @@ -593,7 +593,7 @@ public class RecurringDepositTest { */ Integer depositTransactionId = this.recurringDepositAccountHelper.depositToRecurringDepositAccount(recurringDepositAccountId, depositAmount, EXPECTED_FIRST_DEPOSIT_ON_DATE); - Assert.assertNotNull(depositTransactionId); + Assertions.assertNotNull(depositTransactionId); this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, EXPECTED_FIRST_DEPOSIT_ON_DATE, new JournalEntry( depositAmount, JournalEntry.TransactionType.DEBIT)); @@ -604,19 +604,19 @@ public class RecurringDepositTest { * Update interest earned field for RD account */ recurringDepositAccountId = this.recurringDepositAccountHelper.calculateInterestForRecurringDeposit(recurringDepositAccountId); - Assert.assertNotNull(recurringDepositAccountId); + Assertions.assertNotNull(recurringDepositAccountId); /*** * Post interest and verify journal entries */ Integer transactionIdForPostInterest = this.recurringDepositAccountHelper .postInterestForRecurringDeposit(recurringDepositAccountId); - Assert.assertNotNull(transactionIdForPostInterest); + Assertions.assertNotNull(transactionIdForPostInterest); HashMap accountSummary = this.recurringDepositAccountHelper.getRecurringDepositSummary(recurringDepositAccountId); Float totalInterestPosted = (Float) accountSummary.get("totalInterestPosted"); - Assert.assertNull(accountSummary.get("totalWithholdTax")); + Assertions.assertNull(accountSummary.get("totalWithholdTax")); final JournalEntry[] expenseAccountEntry = { new JournalEntry(totalInterestPosted, JournalEntry.TransactionType.DEBIT) }; @@ -644,7 +644,7 @@ public class RecurringDepositTest { Integer prematureClosureTransactionId = (Integer) this.recurringDepositAccountHelper.prematureCloseForRecurringDeposit( recurringDepositAccountId, CLOSED_ON_DATE, CLOSURE_TYPE_TRANSFER_TO_SAVINGS, savingsId, CommonConstants.RESPONSE_RESOURCE_ID); - Assert.assertNotNull(prematureClosureTransactionId); + Assertions.assertNotNull(prematureClosureTransactionId); recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker.getStatusOfRecurringDepositAccount(this.requestSpec, this.responseSpec, recurringDepositAccountId.toString()); @@ -670,7 +670,7 @@ public class RecurringDepositTest { this.responseSpec, recurringDepositAccountId); Float prematurityAmount = (Float) recurringDepositData.get("maturityAmount"); HashMap summary = (HashMap) recurringDepositData.get("summary"); - Assert.assertNotNull(summary.get("totalWithholdTax")); + Assertions.assertNotNull(summary.get("totalWithholdTax")); Float withHoldTax = (Float) summary.get("totalWithholdTax"); this.journalEntryHelper.checkJournalEntryForLiabilityAccount(liabilityAccountForTax, CLOSED_ON_DATE, new JournalEntry(withHoldTax, JournalEntry.TransactionType.CREDIT)); @@ -680,8 +680,8 @@ public class RecurringDepositTest { Double balanceAfter = Math.floor((Float) savingsSummaryAfter.get("accountBalance")); Double expectedSavingsBalance = Math.floor(balanceBefore + prematurityAmount); - Assert.assertEquals("Verifying Savings Account Balance after Premature Closure", expectedSavingsBalance, - balanceAfter); + Assertions.assertEquals(expectedSavingsBalance, balanceAfter, + "Verifying Savings Account Balance after Premature Closure"); } @@ -735,7 +735,7 @@ public class RecurringDepositTest { * Create client for applying Deposit and Savings accounts */ Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientId); + Assertions.assertNotNull(clientId); /*** * Create Savings product with CashBased accounting enabled @@ -743,13 +743,13 @@ public class RecurringDepositTest { final String accountingRule = CASH_BASED; final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE, accountingRule, assetAccount, liabilityAccount, incomeAccount, expenseAccount); - Assert.assertNotNull(savingsProductID); + Assertions.assertNotNull(savingsProductID); /*** * Create Savings account and verify status is pending */ final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(clientId, savingsProductID, ACCOUNT_TYPE_INDIVIDUAL); - Assert.assertNotNull(savingsProductID); + Assertions.assertNotNull(savingsProductID); HashMap savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsId); SavingsStatusChecker.verifySavingsIsPending(savingsStatusHashMap); @@ -772,14 +772,14 @@ public class RecurringDepositTest { final Integer taxGroupId = createTaxGroup("10", liabilityAccountForTax); Integer recurringDepositProductId = createRecurringDepositProductWithWithHoldTax(VALID_FROM, VALID_TO,String.valueOf(taxGroupId), accountingRule, assetAccount, liabilityAccount, incomeAccount, expenseAccount); - Assert.assertNotNull(recurringDepositProductId); + Assertions.assertNotNull(recurringDepositProductId); /*** * Apply for RD account with created product and verify status */ Integer recurringDepositAccountId = applyForRecurringDepositApplication(clientId.toString(), recurringDepositProductId.toString(), VALID_FROM, VALID_TO, SUBMITTED_ON_DATE, WHOLE_TERM, EXPECTED_FIRST_DEPOSIT_ON_DATE); - Assert.assertNotNull(recurringDepositAccountId); + Assertions.assertNotNull(recurringDepositAccountId); HashMap recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker.getStatusOfRecurringDepositAccount( this.requestSpec, this.responseSpec, recurringDepositAccountId.toString()); @@ -813,7 +813,7 @@ public class RecurringDepositTest { for (int i = 0; i < 14; i++) { Integer depositTransactionId = this.recurringDepositAccountHelper.depositToRecurringDepositAccount(recurringDepositAccountId, depositAmount, dateFormat.format(todaysDate.getTime())); - Assert.assertNotNull(depositTransactionId); + Assertions.assertNotNull(depositTransactionId); this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, dateFormat.format(todaysDate.getTime()), new JournalEntry( depositAmount, JournalEntry.TransactionType.DEBIT)); @@ -834,7 +834,7 @@ public class RecurringDepositTest { recurringDepositAccountId); HashMap summary = (HashMap) accountDetails.get("summary"); - Assert.assertNotNull(summary.get("totalWithholdTax")); + Assertions.assertNotNull(summary.get("totalWithholdTax")); Float withHoldTax = (Float) summary.get("totalWithholdTax"); this.journalEntryHelper.checkJournalEntryForLiabilityAccount(liabilityAccountForTax, CLOSED_ON_DATE, new JournalEntry(withHoldTax, JournalEntry.TransactionType.CREDIT)); @@ -900,7 +900,7 @@ public class RecurringDepositTest { * Create client for applying Deposit account */ Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientId); + Assertions.assertNotNull(clientId); /*** * Create RD product with CashBased accounting enabled @@ -908,7 +908,7 @@ public class RecurringDepositTest { final String accountingRule = CASH_BASED; Integer recurringDepositProductId = createRecurringDepositProduct(VALID_FROM, VALID_TO, accountingRule, assetAccount, liabilityAccount, incomeAccount, expenseAccount); - Assert.assertNotNull(recurringDepositProductId); + Assertions.assertNotNull(recurringDepositProductId); ArrayList allRecurringDepositProductsData = this.recurringDepositProductHelper.retrieveAllRecurringDepositProducts( this.requestSpec, this.responseSpec); @@ -920,7 +920,7 @@ public class RecurringDepositTest { */ Integer recurringDepositAccountId = applyForRecurringDepositApplication(clientId.toString(), recurringDepositProductId.toString(), VALID_FROM, VALID_TO, SUBMITTED_ON_DATE, WHOLE_TERM, EXPECTED_FIRST_DEPOSIT_ON_DATE); - Assert.assertNotNull(recurringDepositAccountId); + Assertions.assertNotNull(recurringDepositAccountId); HashMap recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker.getStatusOfRecurringDepositAccount( this.requestSpec, this.responseSpec, recurringDepositAccountId.toString()); @@ -950,7 +950,7 @@ public class RecurringDepositTest { */ Integer depositTransactionId = this.recurringDepositAccountHelper.depositToRecurringDepositAccount(recurringDepositAccountId, DEPOSIT_AMOUNT, EXPECTED_FIRST_DEPOSIT_ON_DATE); - Assert.assertNotNull(depositTransactionId); + Assertions.assertNotNull(depositTransactionId); this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, EXPECTED_FIRST_DEPOSIT_ON_DATE, new JournalEntry( depositAmount, JournalEntry.TransactionType.DEBIT)); @@ -961,14 +961,14 @@ public class RecurringDepositTest { * Update interest earned field for RD account */ recurringDepositAccountId = this.recurringDepositAccountHelper.calculateInterestForRecurringDeposit(recurringDepositAccountId); - Assert.assertNotNull(recurringDepositAccountId); + Assertions.assertNotNull(recurringDepositAccountId); /*** * Post interest and verify journal entries */ Integer transactionIdForPostInterest = this.recurringDepositAccountHelper .postInterestForRecurringDeposit(recurringDepositAccountId); - Assert.assertNotNull(transactionIdForPostInterest); + Assertions.assertNotNull(transactionIdForPostInterest); HashMap accountSummary = this.recurringDepositAccountHelper.getRecurringDepositSummary(recurringDepositAccountId); Float totalInterestPosted = (Float) accountSummary.get("totalInterestPosted"); @@ -1021,22 +1021,22 @@ public class RecurringDepositTest { final String MONTH_DAY = monthDayFormat.format(todaysDate.getTime()); Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientId); + Assertions.assertNotNull(clientId); final String accountingRule = NONE; Integer recurringDepositProductId = createRecurringDepositProduct(VALID_FROM, VALID_TO, accountingRule); - Assert.assertNotNull(recurringDepositProductId); + Assertions.assertNotNull(recurringDepositProductId); Integer recurringDepositAccountId = applyForRecurringDepositApplication(clientId.toString(), recurringDepositProductId.toString(), VALID_FROM, VALID_TO, SUBMITTED_ON_DATE, WHOLE_TERM, EXPECTED_FIRST_DEPOSIT_ON_DATE); - Assert.assertNotNull(recurringDepositAccountId); + Assertions.assertNotNull(recurringDepositAccountId); todaysDate.add(Calendar.DATE, -1); HashMap modificationsHashMap = this.recurringDepositAccountHelper.updateRecurringDepositAccount(clientId.toString(), recurringDepositProductId.toString(), recurringDepositAccountId.toString(), VALID_FROM, VALID_TO, WHOLE_TERM, SUBMITTED_ON_DATE); - Assert.assertTrue(modificationsHashMap.containsKey("submittedOnDate")); + Assertions.assertTrue(modificationsHashMap.containsKey("submittedOnDate")); } @@ -1065,15 +1065,15 @@ public class RecurringDepositTest { final String MONTH_DAY = monthDayFormat.format(todaysDate.getTime()); Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientId); + Assertions.assertNotNull(clientId); final String accountingRule = NONE; Integer recurringDepositProductId = createRecurringDepositProduct(VALID_FROM, VALID_TO, accountingRule); - Assert.assertNotNull(recurringDepositProductId); + Assertions.assertNotNull(recurringDepositProductId); Integer recurringDepositAccountId = applyForRecurringDepositApplication(clientId.toString(), recurringDepositProductId.toString(), VALID_FROM, VALID_TO, SUBMITTED_ON_DATE, WHOLE_TERM, EXPECTED_FIRST_DEPOSIT_ON_DATE); - Assert.assertNotNull(recurringDepositAccountId); + Assertions.assertNotNull(recurringDepositAccountId); HashMap recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker.getStatusOfRecurringDepositAccount( this.requestSpec, this.responseSpec, recurringDepositAccountId.toString()); @@ -1113,15 +1113,15 @@ public class RecurringDepositTest { final String MONTH_DAY = monthDayFormat.format(todaysDate.getTime()); Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientId); + Assertions.assertNotNull(clientId); final String accountingRule = NONE; Integer recurringDepositProductId = createRecurringDepositProduct(VALID_FROM, VALID_TO, accountingRule); - Assert.assertNotNull(recurringDepositProductId); + Assertions.assertNotNull(recurringDepositProductId); Integer recurringDepositAccountId = applyForRecurringDepositApplication(clientId.toString(), recurringDepositProductId.toString(), VALID_FROM, VALID_TO, SUBMITTED_ON_DATE, WHOLE_TERM, EXPECTED_FIRST_DEPOSIT_ON_DATE); - Assert.assertNotNull(recurringDepositAccountId); + Assertions.assertNotNull(recurringDepositAccountId); HashMap recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker.getStatusOfRecurringDepositAccount( this.requestSpec, this.responseSpec, recurringDepositAccountId.toString()); @@ -1160,15 +1160,15 @@ public class RecurringDepositTest { final String MONTH_DAY = monthDayFormat.format(todaysDate.getTime()); Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientId); + Assertions.assertNotNull(clientId); final String accountingRule = NONE; Integer recurringDepositProductId = createRecurringDepositProduct(VALID_FROM, VALID_TO, accountingRule); - Assert.assertNotNull(recurringDepositProductId); + Assertions.assertNotNull(recurringDepositProductId); Integer recurringDepositAccountId = applyForRecurringDepositApplication(clientId.toString(), recurringDepositProductId.toString(), VALID_FROM, VALID_TO, SUBMITTED_ON_DATE, WHOLE_TERM, EXPECTED_FIRST_DEPOSIT_ON_DATE); - Assert.assertNotNull(recurringDepositAccountId); + Assertions.assertNotNull(recurringDepositAccountId); HashMap recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker.getStatusOfRecurringDepositAccount( this.requestSpec, this.responseSpec, recurringDepositAccountId.toString()); @@ -1204,15 +1204,15 @@ public class RecurringDepositTest { final String MONTH_DAY = monthDayFormat.format(todaysDate.getTime()); Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientId); + Assertions.assertNotNull(clientId); final String accountingRule = NONE; Integer recurringDepositProductId = createRecurringDepositProduct(VALID_FROM, VALID_TO, accountingRule); - Assert.assertNotNull(recurringDepositProductId); + Assertions.assertNotNull(recurringDepositProductId); Integer recurringDepositAccountId = applyForRecurringDepositApplication(clientId.toString(), recurringDepositProductId.toString(), VALID_FROM, VALID_TO, SUBMITTED_ON_DATE, WHOLE_TERM, EXPECTED_FIRST_DEPOSIT_ON_DATE); - Assert.assertNotNull(recurringDepositAccountId); + Assertions.assertNotNull(recurringDepositAccountId); HashMap recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker.getStatusOfRecurringDepositAccount( this.requestSpec, this.responseSpec, recurringDepositAccountId.toString()); @@ -1220,7 +1220,7 @@ public class RecurringDepositTest { recurringDepositAccountId = (Integer) this.recurringDepositAccountHelper.deleteRecurringDepositApplication( recurringDepositAccountId, "resourceId"); - Assert.assertNotNull(recurringDepositAccountId); + Assertions.assertNotNull(recurringDepositAccountId); } /*** @@ -1263,7 +1263,7 @@ public class RecurringDepositTest { * Create client for applying Deposit account */ Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientId); + Assertions.assertNotNull(clientId); /*** * Create RD product with CashBased accounting enabled @@ -1271,14 +1271,14 @@ public class RecurringDepositTest { final String accountingRule = CASH_BASED; Integer recurringDepositProductId = createRecurringDepositProduct(VALID_FROM, VALID_TO, accountingRule, assetAccount, liabilityAccount, incomeAccount, expenseAccount); - Assert.assertNotNull(recurringDepositProductId); + Assertions.assertNotNull(recurringDepositProductId); /*** * Apply for RD account with created product and verify status */ Integer recurringDepositAccountId = applyForRecurringDepositApplication(clientId.toString(), recurringDepositProductId.toString(), VALID_FROM, VALID_TO, SUBMITTED_ON_DATE, WHOLE_TERM, EXPECTED_FIRST_DEPOSIT_ON_DATE); - Assert.assertNotNull(recurringDepositAccountId); + Assertions.assertNotNull(recurringDepositAccountId); HashMap recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker.getStatusOfRecurringDepositAccount( this.requestSpec, this.responseSpec, recurringDepositAccountId.toString()); @@ -1307,7 +1307,7 @@ public class RecurringDepositTest { */ Integer transactionIdForDeposit = this.recurringDepositAccountHelper.depositToRecurringDepositAccount(recurringDepositAccountId, DEPOSIT_AMOUNT, DEPOSIT_DATE); - Assert.assertNotNull(transactionIdForDeposit); + Assertions.assertNotNull(transactionIdForDeposit); this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, DEPOSIT_DATE, new JournalEntry(DEPOSIT_AMOUNT, JournalEntry.TransactionType.DEBIT)); @@ -1321,7 +1321,7 @@ public class RecurringDepositTest { HashMap recurringDepositSummaryAfter = this.recurringDepositAccountHelper.getRecurringDepositSummary(recurringDepositAccountId); Float balanceAfter = (Float) recurringDepositSummaryAfter.get("accountBalance"); - Assert.assertEquals("Verifying account balance after deposit", expectedBalanceAfter, balanceAfter); + Assertions.assertEquals(expectedBalanceAfter, balanceAfter, "Verifying account balance after deposit"); /*** * Update transaction and verify account balance after transaction @@ -1329,7 +1329,7 @@ public class RecurringDepositTest { Float updatedTransactionAmount = DEPOSIT_AMOUNT - 1000.0f; Integer updateTransactionId = this.recurringDepositAccountHelper.updateTransactionForRecurringDeposit(recurringDepositAccountId, transactionIdForDeposit, DEPOSIT_DATE, updatedTransactionAmount); - Assert.assertNotNull(updateTransactionId); + Assertions.assertNotNull(updateTransactionId); this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, DEPOSIT_DATE, new JournalEntry(updatedTransactionAmount, JournalEntry.TransactionType.DEBIT)); @@ -1340,17 +1340,17 @@ public class RecurringDepositTest { recurringDepositSummaryAfter = this.recurringDepositAccountHelper.getRecurringDepositSummary(recurringDepositAccountId); balanceAfter = (Float) recurringDepositSummaryAfter.get("accountBalance"); - Assert.assertEquals("Verifying account balance after updating Transaction", expectedBalanceAfter, balanceAfter); + Assertions.assertEquals(expectedBalanceAfter, balanceAfter, "Verifying account balance after updating Transaction"); Integer undoTransactionId = this.recurringDepositAccountHelper.undoTransactionForRecurringDeposit(recurringDepositAccountId, updateTransactionId, DEPOSIT_DATE, 0.0f); - Assert.assertNotNull(undoTransactionId); + Assertions.assertNotNull(undoTransactionId); expectedBalanceAfter = expectedBalanceAfter - updatedTransactionAmount; recurringDepositSummaryAfter = this.recurringDepositAccountHelper.getRecurringDepositSummary(recurringDepositAccountId); balanceAfter = (Float) recurringDepositSummaryAfter.get("accountBalance"); - Assert.assertEquals("Verifying account balance after Undo Transaction", expectedBalanceAfter, balanceAfter); + Assertions.assertEquals(expectedBalanceAfter, balanceAfter, "Verifying account balance after Undo Transaction"); } @@ -1384,15 +1384,15 @@ public class RecurringDepositTest { final String MONTH_DAY = monthDayFormat.format(todaysDate.getTime()); Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientId); + Assertions.assertNotNull(clientId); final String accountingRule = NONE; Integer recurringDepositProductId = createRecurringDepositProduct(VALID_FROM, VALID_TO, accountingRule); - Assert.assertNotNull(recurringDepositProductId); + Assertions.assertNotNull(recurringDepositProductId); Integer recurringDepositAccountId = applyForRecurringDepositApplication(clientId.toString(), recurringDepositProductId.toString(), VALID_FROM, VALID_TO, SUBMITTED_ON_DATE, WHOLE_TERM, EXPECTED_FIRST_DEPOSIT_ON_DATE); - Assert.assertNotNull(recurringDepositAccountId); + Assertions.assertNotNull(recurringDepositAccountId); HashMap recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker.getStatusOfRecurringDepositAccount( this.requestSpec, this.responseSpec, recurringDepositAccountId.toString()); @@ -1429,7 +1429,7 @@ public class RecurringDepositTest { principal = (float) Math.floor(principal); maturityAmount = (float) Math.floor(maturityAmount); LOG.info("{}",principal.toString()); - Assert.assertEquals("Verifying Maturity amount for Recurring Deposit Account", principal, maturityAmount); + Assertions.assertEquals(principal, maturityAmount, "Verifying Maturity amount for Recurring Deposit Account"); } /*** @@ -1462,15 +1462,15 @@ public class RecurringDepositTest { final String MONTH_DAY = monthDayFormat.format(todaysDate.getTime()); Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientId); + Assertions.assertNotNull(clientId); final String accountingRule = NONE; Integer recurringDepositProductId = createRecurringDepositProduct(VALID_FROM, VALID_TO, accountingRule); - Assert.assertNotNull(recurringDepositProductId); + Assertions.assertNotNull(recurringDepositProductId); Integer recurringDepositAccountId = applyForRecurringDepositApplication(clientId.toString(), recurringDepositProductId.toString(), VALID_FROM, VALID_TO, SUBMITTED_ON_DATE, WHOLE_TERM, EXPECTED_FIRST_DEPOSIT_ON_DATE); - Assert.assertNotNull(recurringDepositAccountId); + Assertions.assertNotNull(recurringDepositAccountId); HashMap modificationsHashMap = this.recurringDepositAccountHelper.updateInterestCalculationConfigForRecurringDeposit( clientId.toString(), recurringDepositProductId.toString(), recurringDepositAccountId.toString(), SUBMITTED_ON_DATE, @@ -1512,7 +1512,7 @@ public class RecurringDepositTest { principal = (float) Math.floor(principal); maturityAmount = (float) Math.floor(maturityAmount); LOG.info("{}",principal.toString()); - Assert.assertEquals("Verifying Maturity amount for Recurring Deposit Account", principal, maturityAmount); + Assertions.assertEquals(principal, maturityAmount, "Verifying Maturity amount for Recurring Deposit Account"); } /*** @@ -1542,15 +1542,15 @@ public class RecurringDepositTest { final String MONTH_DAY = monthDayFormat.format(todaysDate.getTime()); Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientId); + Assertions.assertNotNull(clientId); final String accountingRule = NONE; Integer recurringDepositProductId = createRecurringDepositProduct(VALID_FROM, VALID_TO, accountingRule); - Assert.assertNotNull(recurringDepositProductId); + Assertions.assertNotNull(recurringDepositProductId); Integer recurringDepositAccountId = applyForRecurringDepositApplication(clientId.toString(), recurringDepositProductId.toString(), VALID_FROM, VALID_TO, SUBMITTED_ON_DATE, WHOLE_TERM, EXPECTED_FIRST_DEPOSIT_ON_DATE); - Assert.assertNotNull(recurringDepositAccountId); + Assertions.assertNotNull(recurringDepositAccountId); HashMap recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker.getStatusOfRecurringDepositAccount( this.requestSpec, this.responseSpec, recurringDepositAccountId.toString()); @@ -1574,7 +1574,7 @@ public class RecurringDepositTest { Integer depositTransactionId = this.recurringDepositAccountHelper.depositToRecurringDepositAccount(recurringDepositAccountId, DEPOSIT_AMOUNT, EXPECTED_FIRST_DEPOSIT_ON_DATE); - Assert.assertNotNull(depositTransactionId); + Assertions.assertNotNull(depositTransactionId); HashMap recurringDepositSummary = this.recurringDepositAccountHelper.getRecurringDepositSummary(recurringDepositAccountId); Float principal = (Float) recurringDepositSummary.get("totalDeposits"); @@ -1596,15 +1596,15 @@ public class RecurringDepositTest { Integer transactionIdForPostInterest = this.recurringDepositAccountHelper .postInterestForRecurringDeposit(recurringDepositAccountId); - Assert.assertNotNull(transactionIdForPostInterest); + Assertions.assertNotNull(transactionIdForPostInterest); HashMap recurringDepositAccountSummary = this.recurringDepositAccountHelper.getRecurringDepositSummary(recurringDepositAccountId); Float interestAmountPosted = (float) Math.floor((Float) recurringDepositAccountSummary.get("totalInterestPosted")); Float principalAfter = (float) Math.floor((Float) recurringDepositAccountSummary.get("accountBalance")); interestToBePosted = (float) Math.floor(interestToBePosted); - Assert.assertEquals("Verifying Amount of Interest Posted to Recurring Deposit Account", interestToBePosted, interestAmountPosted); - Assert.assertEquals("Verifying Principal Amount after Interest Posting", expectedBalanceAfter, principalAfter); + Assertions.assertEquals(interestToBePosted, interestAmountPosted, "Verifying Amount of Interest Posted to Recurring Deposit Account"); + Assertions.assertEquals(expectedBalanceAfter, principalAfter, "Verifying Principal Amount after Interest Posting"); } @@ -1645,15 +1645,15 @@ public class RecurringDepositTest { final Account liabilityAccount = this.accountHelper.createLiabilityAccount(); Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientId); + Assertions.assertNotNull(clientId); final String accountingRule = NONE; Integer recurringDepositProductId = createRecurringDepositProduct(VALID_FROM, VALID_TO, accountingRule); - Assert.assertNotNull(recurringDepositProductId); + Assertions.assertNotNull(recurringDepositProductId); Integer recurringDepositAccountId = applyForRecurringDepositApplication(clientId.toString(), recurringDepositProductId.toString(), VALID_FROM, VALID_TO, SUBMITTED_ON_DATE, WHOLE_TERM, EXPECTED_FIRST_DEPOSIT_ON_DATE); - Assert.assertNotNull(recurringDepositAccountId); + Assertions.assertNotNull(recurringDepositAccountId); HashMap recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker.getStatusOfRecurringDepositAccount( this.requestSpec, this.responseSpec, recurringDepositAccountId.toString()); @@ -1679,7 +1679,7 @@ public class RecurringDepositTest { Integer depositTransactionId = this.recurringDepositAccountHelper.depositToRecurringDepositAccount(recurringDepositAccountId, DEPOSIT_AMOUNT, EXPECTED_FIRST_DEPOSIT_ON_DATE); - Assert.assertNotNull(depositTransactionId); + Assertions.assertNotNull(depositTransactionId); HashMap recurringDepositSummary = this.recurringDepositAccountHelper.getRecurringDepositSummary(recurringDepositAccountId); Float principal = (Float) recurringDepositSummary.get("totalDeposits"); @@ -1704,7 +1704,7 @@ public class RecurringDepositTest { EXPECTED_FIRST_DEPOSIT_ON_DATE = dateFormat.format(calendar.getTime()); Integer transactionIdForDeposit = this.recurringDepositAccountHelper.depositToRecurringDepositAccount(recurringDepositAccountId, DEPOSIT_AMOUNT, EXPECTED_FIRST_DEPOSIT_ON_DATE); - Assert.assertNotNull(transactionIdForDeposit); + Assertions.assertNotNull(transactionIdForDeposit); currentDate = currentDate - 1; interestPerMonth = (float) (interestPerDay * principal * currentDate); @@ -1717,7 +1717,7 @@ public class RecurringDepositTest { Integer prematureClosureTransactionId = (Integer) this.recurringDepositAccountHelper.prematureCloseForRecurringDeposit( recurringDepositAccountId, CLOSED_ON_DATE, CLOSURE_TYPE_WITHDRAW_DEPOSIT, null, CommonConstants.RESPONSE_RESOURCE_ID); - Assert.assertNotNull(prematureClosureTransactionId); + Assertions.assertNotNull(prematureClosureTransactionId); recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker.getStatusOfRecurringDepositAccount(this.requestSpec, this.responseSpec, recurringDepositAccountId.toString()); @@ -1729,7 +1729,7 @@ public class RecurringDepositTest { principal = (float) Math.floor(principal); Float maturityAmount = (float) Math.floor((Float) recurringDepositAccountData.get("maturityAmount")); - Assert.assertEquals("Verifying Pre-Closure maturity amount", principal, maturityAmount); + Assertions.assertEquals(principal, maturityAmount, "Verifying Pre-Closure maturity amount"); } @@ -1770,15 +1770,15 @@ public class RecurringDepositTest { final Account liabilityAccount = this.accountHelper.createLiabilityAccount(); Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientId); + Assertions.assertNotNull(clientId); final String accountingRule = NONE; Integer recurringDepositProductId = createRecurringDepositProduct(VALID_FROM, VALID_TO, accountingRule); - Assert.assertNotNull(recurringDepositProductId); + Assertions.assertNotNull(recurringDepositProductId); Integer recurringDepositAccountId = applyForRecurringDepositApplication(clientId.toString(), recurringDepositProductId.toString(), VALID_FROM, VALID_TO, SUBMITTED_ON_DATE, WHOLE_TERM, EXPECTED_FIRST_DEPOSIT_ON_DATE); - Assert.assertNotNull(recurringDepositAccountId); + Assertions.assertNotNull(recurringDepositAccountId); HashMap modificationsHashMap = this.recurringDepositAccountHelper.updateInterestCalculationConfigForRecurringDeposit( clientId.toString(), recurringDepositProductId.toString(), recurringDepositAccountId.toString(), SUBMITTED_ON_DATE, @@ -1809,7 +1809,7 @@ public class RecurringDepositTest { Integer depositTransactionId = this.recurringDepositAccountHelper.depositToRecurringDepositAccount(recurringDepositAccountId, DEPOSIT_AMOUNT, EXPECTED_FIRST_DEPOSIT_ON_DATE); - Assert.assertNotNull(depositTransactionId); + Assertions.assertNotNull(depositTransactionId); HashMap recurringDepositSummary = this.recurringDepositAccountHelper.getRecurringDepositSummary(recurringDepositAccountId); Float principal = (Float) recurringDepositSummary.get("totalDeposits"); @@ -1834,7 +1834,7 @@ public class RecurringDepositTest { EXPECTED_FIRST_DEPOSIT_ON_DATE = dateFormat.format(calendar.getTime()); Integer transactionIdForDeposit = this.recurringDepositAccountHelper.depositToRecurringDepositAccount(recurringDepositAccountId, DEPOSIT_AMOUNT, EXPECTED_FIRST_DEPOSIT_ON_DATE); - Assert.assertNotNull(transactionIdForDeposit); + Assertions.assertNotNull(transactionIdForDeposit); currentDate = currentDate - 1; interestPerMonth = (float) (interestPerDay * principal * currentDate); @@ -1847,7 +1847,7 @@ public class RecurringDepositTest { Integer prematureClosureTransactionId = (Integer) this.recurringDepositAccountHelper.prematureCloseForRecurringDeposit( recurringDepositAccountId, CLOSED_ON_DATE, CLOSURE_TYPE_WITHDRAW_DEPOSIT, null, CommonConstants.RESPONSE_RESOURCE_ID); - Assert.assertNotNull(prematureClosureTransactionId); + Assertions.assertNotNull(prematureClosureTransactionId); recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker.getStatusOfRecurringDepositAccount(this.requestSpec, this.responseSpec, recurringDepositAccountId.toString()); @@ -1859,7 +1859,7 @@ public class RecurringDepositTest { principal = (float) Math.floor(principal); Float maturityAmount = (float) Math.floor((Float) recurringDepositAccountData.get("maturityAmount")); - Assert.assertEquals("Verifying Pre-Closure maturity amount", principal, maturityAmount); + Assertions.assertEquals(principal, maturityAmount, "Verifying Pre-Closure maturity amount"); } @@ -1903,15 +1903,15 @@ public class RecurringDepositTest { final Account liabilityAccount = this.accountHelper.createLiabilityAccount(); Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientId); + Assertions.assertNotNull(clientId); final String accountingRule = NONE; Integer recurringDepositProductId = createRecurringDepositProduct(VALID_FROM, VALID_TO, accountingRule); - Assert.assertNotNull(recurringDepositProductId); + Assertions.assertNotNull(recurringDepositProductId); Integer recurringDepositAccountId = applyForRecurringDepositApplication(clientId.toString(), recurringDepositProductId.toString(), VALID_FROM, VALID_TO, SUBMITTED_ON_DATE, TILL_PREMATURE_WITHDRAWAL, EXPECTED_FIRST_DEPOSIT_ON_DATE); - Assert.assertNotNull(recurringDepositAccountId); + Assertions.assertNotNull(recurringDepositAccountId); HashMap recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker.getStatusOfRecurringDepositAccount( this.requestSpec, this.responseSpec, recurringDepositAccountId.toString()); @@ -1946,7 +1946,7 @@ public class RecurringDepositTest { Integer depositTransactionId = this.recurringDepositAccountHelper.depositToRecurringDepositAccount(recurringDepositAccountId, DEPOSIT_AMOUNT, EXPECTED_FIRST_DEPOSIT_ON_DATE); - Assert.assertNotNull(depositTransactionId); + Assertions.assertNotNull(depositTransactionId); HashMap recurringDepositSummary = this.recurringDepositAccountHelper.getRecurringDepositSummary(recurringDepositAccountId); Float principal = (Float) recurringDepositSummary.get("totalDeposits"); @@ -1972,7 +1972,7 @@ public class RecurringDepositTest { EXPECTED_FIRST_DEPOSIT_ON_DATE = dateFormat.format(calendar.getTime()); Integer transactionIdForDeposit = this.recurringDepositAccountHelper.depositToRecurringDepositAccount(recurringDepositAccountId, DEPOSIT_AMOUNT, EXPECTED_FIRST_DEPOSIT_ON_DATE); - Assert.assertNotNull(transactionIdForDeposit); + Assertions.assertNotNull(transactionIdForDeposit); currentDate = currentDate - 1; interestPerMonth = (float) (interestPerDay * principal * currentDate); @@ -1985,7 +1985,7 @@ public class RecurringDepositTest { Integer prematureClosureTransactionId = (Integer) this.recurringDepositAccountHelper.prematureCloseForRecurringDeposit( recurringDepositAccountId, CLOSED_ON_DATE, CLOSURE_TYPE_WITHDRAW_DEPOSIT, null, CommonConstants.RESPONSE_RESOURCE_ID); - Assert.assertNotNull(prematureClosureTransactionId); + Assertions.assertNotNull(prematureClosureTransactionId); recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker.getStatusOfRecurringDepositAccount(this.requestSpec, this.responseSpec, recurringDepositAccountId.toString()); @@ -1997,7 +1997,7 @@ public class RecurringDepositTest { principal = (float) Math.floor(principal); Float maturityAmount = (float) Math.floor((Float) recurringDepositAccountData.get("maturityAmount")); - Assert.assertEquals("Verifying Pre-Closure maturity amount", principal, maturityAmount); + Assertions.assertEquals(principal, maturityAmount, "Verifying Pre-Closure maturity amount"); } @@ -2041,15 +2041,15 @@ public class RecurringDepositTest { final Account liabilityAccount = this.accountHelper.createLiabilityAccount(); Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientId); + Assertions.assertNotNull(clientId); final String accountingRule = NONE; Integer recurringDepositProductId = createRecurringDepositProduct(VALID_FROM, VALID_TO, accountingRule); - Assert.assertNotNull(recurringDepositProductId); + Assertions.assertNotNull(recurringDepositProductId); Integer recurringDepositAccountId = applyForRecurringDepositApplication(clientId.toString(), recurringDepositProductId.toString(), VALID_FROM, VALID_TO, SUBMITTED_ON_DATE, TILL_PREMATURE_WITHDRAWAL, EXPECTED_FIRST_DEPOSIT_ON_DATE); - Assert.assertNotNull(recurringDepositAccountId); + Assertions.assertNotNull(recurringDepositAccountId); HashMap modificationsHashMap = this.recurringDepositAccountHelper.updateInterestCalculationConfigForRecurringDeposit( clientId.toString(), recurringDepositProductId.toString(), recurringDepositAccountId.toString(), SUBMITTED_ON_DATE, @@ -2089,7 +2089,7 @@ public class RecurringDepositTest { Integer transactionIdForDeposit = this.recurringDepositAccountHelper.depositToRecurringDepositAccount(recurringDepositAccountId, DEPOSIT_AMOUNT, EXPECTED_FIRST_DEPOSIT_ON_DATE); - Assert.assertNotNull(transactionIdForDeposit); + Assertions.assertNotNull(transactionIdForDeposit); HashMap recurringDepositSummary = this.recurringDepositAccountHelper.getRecurringDepositSummary(recurringDepositAccountId); Float principal = (Float) recurringDepositSummary.get("totalDeposits"); @@ -2115,7 +2115,7 @@ public class RecurringDepositTest { EXPECTED_FIRST_DEPOSIT_ON_DATE = dateFormat.format(calendar.getTime()); Integer newTransactionIdForDeposit = this.recurringDepositAccountHelper.depositToRecurringDepositAccount(recurringDepositAccountId, DEPOSIT_AMOUNT, EXPECTED_FIRST_DEPOSIT_ON_DATE); - Assert.assertNotNull(newTransactionIdForDeposit); + Assertions.assertNotNull(newTransactionIdForDeposit); currentDate = currentDate - 1; interestPerMonth = (float) (interestPerDay * principal * currentDate); @@ -2128,7 +2128,7 @@ public class RecurringDepositTest { Integer prematureClosureTransactionId = (Integer) this.recurringDepositAccountHelper.prematureCloseForRecurringDeposit( recurringDepositAccountId, CLOSED_ON_DATE, CLOSURE_TYPE_WITHDRAW_DEPOSIT, null, CommonConstants.RESPONSE_RESOURCE_ID); - Assert.assertNotNull(prematureClosureTransactionId); + Assertions.assertNotNull(prematureClosureTransactionId); recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker.getStatusOfRecurringDepositAccount(this.requestSpec, this.responseSpec, recurringDepositAccountId.toString()); @@ -2140,7 +2140,7 @@ public class RecurringDepositTest { principal = (float) Math.floor(principal); Float maturityAmount = (float) Math.floor((Float) recurringDepositAccountData.get("maturityAmount")); - Assert.assertEquals("Verifying Pre-Closure maturity amount", principal, maturityAmount); + Assertions.assertEquals(principal, maturityAmount, "Verifying Pre-Closure maturity amount"); } @@ -2174,14 +2174,14 @@ public class RecurringDepositTest { final String MONTH_DAY = monthDayFormat.format(todaysDate.getTime()); Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientId); + Assertions.assertNotNull(clientId); final String accountingRule = NONE; Integer recurringDepositProductId = createRecurringDepositProduct(VALID_FROM, VALID_TO, accountingRule); - Assert.assertNotNull(recurringDepositProductId); + Assertions.assertNotNull(recurringDepositProductId); Integer recurringDepositAccountId = applyForRecurringDepositApplication(clientId.toString(), recurringDepositProductId.toString(), VALID_FROM, VALID_TO, SUBMITTED_ON_DATE, WHOLE_TERM, EXPECTED_FIRST_DEPOSIT_ON_DATE); - Assert.assertNotNull(recurringDepositAccountId); + Assertions.assertNotNull(recurringDepositAccountId); HashMap modificationsHashMap = this.recurringDepositAccountHelper.updateInterestCalculationConfigForRecurringDeposit( clientId.toString(), recurringDepositProductId.toString(), recurringDepositAccountId.toString(), SUBMITTED_ON_DATE, @@ -2222,7 +2222,7 @@ public class RecurringDepositTest { principal = (float) Math.floor(principal); maturityAmount = (float) Math.floor(maturityAmount); LOG.info("{}",principal.toString()); - Assert.assertEquals("Verifying Maturity amount for Recurring Deposit Account", principal, maturityAmount); + Assertions.assertEquals(principal, maturityAmount, "Verifying Maturity amount for Recurring Deposit Account"); } @@ -2256,15 +2256,15 @@ public class RecurringDepositTest { final String MONTH_DAY = monthDayFormat.format(todaysDate.getTime()); Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientId); + Assertions.assertNotNull(clientId); final String accountingRule = NONE; Integer recurringDepositProductId = createRecurringDepositProduct(VALID_FROM, VALID_TO, accountingRule); - Assert.assertNotNull(recurringDepositProductId); + Assertions.assertNotNull(recurringDepositProductId); Integer recurringDepositAccountId = applyForRecurringDepositApplication(clientId.toString(), recurringDepositProductId.toString(), VALID_FROM, VALID_TO, SUBMITTED_ON_DATE, WHOLE_TERM, EXPECTED_FIRST_DEPOSIT_ON_DATE); - Assert.assertNotNull(recurringDepositAccountId); + Assertions.assertNotNull(recurringDepositAccountId); HashMap modificationsHashMap = this.recurringDepositAccountHelper.updateInterestCalculationConfigForRecurringDeposit( clientId.toString(), recurringDepositProductId.toString(), recurringDepositAccountId.toString(), SUBMITTED_ON_DATE, @@ -2305,7 +2305,7 @@ public class RecurringDepositTest { principal = (float) Math.floor(principal); maturityAmount = (float) Math.floor(maturityAmount); LOG.info("{}",principal.toString()); - Assert.assertEquals("Verifying Maturity amount for Recurring Deposit Account", principal, maturityAmount); + Assertions.assertEquals(principal, maturityAmount, "Verifying Maturity amount for Recurring Deposit Account"); } @@ -2346,15 +2346,15 @@ public class RecurringDepositTest { final String MONTH_DAY = monthDayFormat.format(todaysDate.getTime()); Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientId); + Assertions.assertNotNull(clientId); final String accountingRule = NONE; Integer recurringDepositProductId = createRecurringDepositProduct(VALID_FROM, VALID_TO, accountingRule); - Assert.assertNotNull(recurringDepositProductId); + Assertions.assertNotNull(recurringDepositProductId); Integer recurringDepositAccountId = applyForRecurringDepositApplication(clientId.toString(), recurringDepositProductId.toString(), VALID_FROM, VALID_TO, SUBMITTED_ON_DATE, WHOLE_TERM, EXPECTED_FIRST_DEPOSIT_ON_DATE); - Assert.assertNotNull(recurringDepositAccountId); + Assertions.assertNotNull(recurringDepositAccountId); HashMap modificationsHashMap = this.recurringDepositAccountHelper.updateInterestCalculationConfigForRecurringDeposit( clientId.toString(), recurringDepositProductId.toString(), recurringDepositAccountId.toString(), SUBMITTED_ON_DATE, @@ -2395,7 +2395,7 @@ public class RecurringDepositTest { Double expectedPrematureAmount = Math.floor(principal); Double maturityAmount = Math.floor((Float) recurringDepositAccountData.get("maturityAmount")); - Assert.assertEquals("Verifying Pre-Closure maturity amount", expectedPrematureAmount, maturityAmount); + Assertions.assertEquals(expectedPrematureAmount, maturityAmount, "Verifying Pre-Closure maturity amount"); } @@ -2436,15 +2436,15 @@ public class RecurringDepositTest { final String MONTH_DAY = monthDayFormat.format(todaysDate.getTime()); Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientId); + Assertions.assertNotNull(clientId); final String accountingRule = NONE; Integer recurringDepositProductId = createRecurringDepositProduct(VALID_FROM, VALID_TO, accountingRule); - Assert.assertNotNull(recurringDepositProductId); + Assertions.assertNotNull(recurringDepositProductId); Integer recurringDepositAccountId = applyForRecurringDepositApplication(clientId.toString(), recurringDepositProductId.toString(), VALID_FROM, VALID_TO, SUBMITTED_ON_DATE, WHOLE_TERM, EXPECTED_FIRST_DEPOSIT_ON_DATE); - Assert.assertNotNull(recurringDepositAccountId); + Assertions.assertNotNull(recurringDepositAccountId); HashMap modificationsHashMap = this.recurringDepositAccountHelper.updateInterestCalculationConfigForRecurringDeposit( clientId.toString(), recurringDepositProductId.toString(), recurringDepositAccountId.toString(), SUBMITTED_ON_DATE, @@ -2485,7 +2485,7 @@ public class RecurringDepositTest { Double expectedPrematureAmount = Math.floor(principal); Double maturityAmount = Math.floor((Float) recurringDepositAccountData.get("maturityAmount")); - Assert.assertEquals("Verifying Pre-Closure maturity amount", expectedPrematureAmount, maturityAmount); + Assertions.assertEquals(expectedPrematureAmount, maturityAmount, "Verifying Pre-Closure maturity amount"); } @@ -2525,15 +2525,15 @@ public class RecurringDepositTest { final String MONTH_DAY = monthDayFormat.format(todaysDate.getTime()); Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientId); + Assertions.assertNotNull(clientId); final String accountingRule = NONE; Integer recurringDepositProductId = createRecurringDepositProduct(VALID_FROM, VALID_TO, accountingRule); - Assert.assertNotNull(recurringDepositProductId); + Assertions.assertNotNull(recurringDepositProductId); Integer recurringDepositAccountId = applyForRecurringDepositApplication(clientId.toString(), recurringDepositProductId.toString(), VALID_FROM, VALID_TO, SUBMITTED_ON_DATE, WHOLE_TERM, EXPECTED_FIRST_DEPOSIT_ON_DATE); - Assert.assertNotNull(recurringDepositAccountId); + Assertions.assertNotNull(recurringDepositAccountId); HashMap modificationsHashMap = this.recurringDepositAccountHelper.updateInterestCalculationConfigForRecurringDeposit( clientId.toString(), recurringDepositProductId.toString(), recurringDepositAccountId.toString(), SUBMITTED_ON_DATE, @@ -2575,7 +2575,7 @@ public class RecurringDepositTest { Double expectedPrematureAmount = Math.floor(principal); Double maturityAmount = Math.floor((Float) recurringDepositAccountData.get("maturityAmount")); - Assert.assertEquals("Verifying Maturity amount", expectedPrematureAmount, maturityAmount); + Assertions.assertEquals(expectedPrematureAmount, maturityAmount, "Verifying Maturity amount"); } @@ -2615,15 +2615,15 @@ public class RecurringDepositTest { final String MONTH_DAY = monthDayFormat.format(todaysDate.getTime()); Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientId); + Assertions.assertNotNull(clientId); final String accountingRule = NONE; Integer recurringDepositProductId = createRecurringDepositProduct(VALID_FROM, VALID_TO, accountingRule); - Assert.assertNotNull(recurringDepositProductId); + Assertions.assertNotNull(recurringDepositProductId); Integer recurringDepositAccountId = applyForRecurringDepositApplication(clientId.toString(), recurringDepositProductId.toString(), VALID_FROM, VALID_TO, SUBMITTED_ON_DATE, WHOLE_TERM, EXPECTED_FIRST_DEPOSIT_ON_DATE); - Assert.assertNotNull(recurringDepositAccountId); + Assertions.assertNotNull(recurringDepositAccountId); HashMap modificationsHashMap = this.recurringDepositAccountHelper.updateInterestCalculationConfigForRecurringDeposit( clientId.toString(), recurringDepositProductId.toString(), recurringDepositAccountId.toString(), SUBMITTED_ON_DATE, @@ -2665,7 +2665,7 @@ public class RecurringDepositTest { Double expectedPrematureAmount = Math.floor(principal); Double maturityAmount = Math.floor((Float) recurringDepositAccountData.get("maturityAmount")); - Assert.assertEquals("Verifying Maturity amount", expectedPrematureAmount, maturityAmount); + Assertions.assertEquals(expectedPrematureAmount, maturityAmount, "Verifying Maturity amount"); } @@ -2706,15 +2706,15 @@ public class RecurringDepositTest { final String MONTH_DAY = monthDayFormat.format(todaysDate.getTime()); Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientId); + Assertions.assertNotNull(clientId); final String accountingRule = NONE; Integer recurringDepositProductId = createRecurringDepositProduct(VALID_FROM, VALID_TO, accountingRule); - Assert.assertNotNull(recurringDepositProductId); + Assertions.assertNotNull(recurringDepositProductId); Integer recurringDepositAccountId = applyForRecurringDepositApplication(clientId.toString(), recurringDepositProductId.toString(), VALID_FROM, VALID_TO, SUBMITTED_ON_DATE, WHOLE_TERM, EXPECTED_FIRST_DEPOSIT_ON_DATE); - Assert.assertNotNull(recurringDepositAccountId); + Assertions.assertNotNull(recurringDepositAccountId); HashMap modificationsHashMap = this.recurringDepositAccountHelper.updateInterestCalculationConfigForRecurringDeposit( clientId.toString(), recurringDepositProductId.toString(), recurringDepositAccountId.toString(), SUBMITTED_ON_DATE, @@ -2755,7 +2755,7 @@ public class RecurringDepositTest { Double expectedPrematureAmount = Math.floor(principal); Double maturityAmount = Math.floor((Float) recurringDepositAccountData.get("maturityAmount")); - Assert.assertEquals("Verifying Pre-Closure maturity amount", expectedPrematureAmount, maturityAmount); + Assertions.assertEquals(expectedPrematureAmount, maturityAmount, "Verifying Pre-Closure maturity amount"); } @@ -2796,15 +2796,15 @@ public class RecurringDepositTest { final String MONTH_DAY = monthDayFormat.format(todaysDate.getTime()); Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientId); + Assertions.assertNotNull(clientId); final String accountingRule = NONE; Integer recurringDepositProductId = createRecurringDepositProduct(VALID_FROM, VALID_TO, accountingRule); - Assert.assertNotNull(recurringDepositProductId); + Assertions.assertNotNull(recurringDepositProductId); Integer recurringDepositAccountId = applyForRecurringDepositApplication(clientId.toString(), recurringDepositProductId.toString(), VALID_FROM, VALID_TO, SUBMITTED_ON_DATE, WHOLE_TERM, EXPECTED_FIRST_DEPOSIT_ON_DATE); - Assert.assertNotNull(recurringDepositAccountId); + Assertions.assertNotNull(recurringDepositAccountId); HashMap modificationsHashMap = this.recurringDepositAccountHelper.updateInterestCalculationConfigForRecurringDeposit( clientId.toString(), recurringDepositProductId.toString(), recurringDepositAccountId.toString(), SUBMITTED_ON_DATE, @@ -2845,7 +2845,7 @@ public class RecurringDepositTest { Double expectedPrematureAmount = Math.floor(principal); Double maturityAmount = Math.floor((Float) recurringDepositAccountData.get("maturityAmount")); - Assert.assertEquals("Verifying Pre-Closure maturity amount", expectedPrematureAmount, maturityAmount); + Assertions.assertEquals(expectedPrematureAmount, maturityAmount, "Verifying Pre-Closure maturity amount"); } @@ -2972,21 +2972,21 @@ public class RecurringDepositTest { final String ACTIVATION_DATE = "01 March 2015"; Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientId); + Assertions.assertNotNull(clientId); /*** * Create FD product with CashBased accounting enabled */ final String accountingRule = NONE; Integer recurringDepositProductId = createRecurringDepositProduct(VALID_FROM, VALID_TO, accountingRule, chartToUse); - Assert.assertNotNull(recurringDepositProductId); + Assertions.assertNotNull(recurringDepositProductId); /*** * Apply for FD account with created product and verify status */ Integer recurringDepositAccountId = applyForRecurringDepositApplication(clientId.toString(), recurringDepositProductId.toString(), VALID_FROM, VALID_TO, SUBMITTED_ON_DATE, WHOLE_TERM, SUBMITTED_ON_DATE, depositAmount, depositPeriod); - Assert.assertNotNull(recurringDepositAccountId); + Assertions.assertNotNull(recurringDepositAccountId); HashMap recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker.getStatusOfRecurringDepositAccount( this.requestSpec, this.responseSpec, recurringDepositAccountId.toString()); @@ -3009,7 +3009,7 @@ public class RecurringDepositTest { HashMap recurringDepositAccountData = this.recurringDepositAccountHelper.getRecurringDepositAccountById(this.requestSpec, this.responseSpec, recurringDepositAccountId); - Assert.assertEquals(interestRate, recurringDepositAccountData.get("nominalAnnualInterestRate")); + Assertions.assertEquals(interestRate, recurringDepositAccountData.get("nominalAnnualInterestRate")); } private Integer createRecurringDepositProduct(final String validFrom, final String validTo, final String accountingRule, @@ -3150,7 +3150,7 @@ public class RecurringDepositTest { Integer financialActivityAccountId = (Integer) financialActivityAccountHelper.createFinancialActivityAccount( LIABILITY_TRANSFER_FINANCIAL_ACTIVITY_ID, liabilityAccountForMapping.getAccountID(), this.responseSpec, CommonConstants.RESPONSE_RESOURCE_ID); - Assert.assertNotNull(financialActivityAccountId); + Assertions.assertNotNull(financialActivityAccountId); assertFinancialActivityAccountCreation(financialActivityAccountId, LIABILITY_TRANSFER_FINANCIAL_ACTIVITY_ID, liabilityAccountForMapping); return liabilityAccountForMapping; } @@ -3158,8 +3158,8 @@ public class RecurringDepositTest { private void assertFinancialActivityAccountCreation(Integer financialActivityAccountId, Integer financialActivityId, Account glAccount) { HashMap mappingDetails = this.financialActivityAccountHelper.getFinancialActivityAccount(financialActivityAccountId, this.responseSpec); - Assert.assertEquals(financialActivityId, ((HashMap) mappingDetails.get("financialActivityData")).get("id")); - Assert.assertEquals(glAccount.getAccountID(), ((HashMap) mappingDetails.get("glAccountData")).get("id")); + Assertions.assertEquals(financialActivityId, ((HashMap) mappingDetails.get("financialActivityData")).get("id")); + Assertions.assertEquals(glAccount.getAccountID(), ((HashMap) mappingDetails.get("glAccountData")).get("id")); } private Integer createTaxGroup(final String percentage, final Account liabilityAccountForTax){ @@ -3172,15 +3172,15 @@ public class RecurringDepositTest { /** * Delete the Liability transfer account */ - @After + @AfterEach public void tearDown() { List financialActivities = this.financialActivityAccountHelper.getAllFinancialActivityAccounts(this.responseSpec); for (HashMap financialActivity : financialActivities) { Integer financialActivityAccountId = (Integer) financialActivity.get("id"); Integer deletedFinancialActivityAccountId = this.financialActivityAccountHelper.deleteFinancialActivityAccount( financialActivityAccountId, this.responseSpec, CommonConstants.RESPONSE_RESOURCE_ID); - Assert.assertNotNull(deletedFinancialActivityAccountId); - Assert.assertEquals(financialActivityAccountId, deletedFinancialActivityAccountId); + Assertions.assertNotNull(deletedFinancialActivityAccountId); + Assertions.assertEquals(financialActivityAccountId, deletedFinancialActivityAccountId); } } } diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/RolesTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/RolesTest.java index 5f13c2518..a0dcd5775 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/RolesTest.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/RolesTest.java @@ -18,8 +18,8 @@ */ package org.apache.fineract.integrationtests; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotEquals; import io.restassured.builder.RequestSpecBuilder; import io.restassured.builder.ResponseSpecBuilder; @@ -31,9 +31,9 @@ import org.apache.fineract.integrationtests.common.Utils; import org.apache.fineract.integrationtests.common.organisation.StaffHelper; import org.apache.fineract.integrationtests.useradministration.roles.RolesHelper; import org.apache.fineract.integrationtests.useradministration.users.UserHelper; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -42,7 +42,7 @@ public class RolesTest { private ResponseSpecification responseSpec; private RequestSpecification requestSpec; - @Before + @BeforeEach public void setup() { Utils.initializeRESTAssured(); this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build(); @@ -56,7 +56,7 @@ public class RolesTest { LOG.info("---------------------------------CREATING A ROLE---------------------------------------------"); final Integer roleId = RolesHelper.createRole(this.requestSpec, this.responseSpec); - Assert.assertNotNull(roleId); + Assertions.assertNotNull(roleId); LOG.info("--------------------------------- Getting ROLE -------------------------------"); HashMap role = RolesHelper.getRoleDetails(requestSpec, responseSpec, roleId); @@ -70,7 +70,7 @@ public class RolesTest { LOG.info("---------------------------------CREATING A ROLE---------------------------------------------"); final Integer roleId = RolesHelper.createRole(this.requestSpec, this.responseSpec); - Assert.assertNotNull(roleId); + Assertions.assertNotNull(roleId); LOG.info("--------------------------------- Getting ROLE -------------------------------"); HashMap role = RolesHelper.getRoleDetails(requestSpec, responseSpec, roleId); @@ -91,7 +91,7 @@ public class RolesTest { LOG.info("---------------------------------CREATING A ROLE---------------------------------------------"); final Integer roleId = RolesHelper.createRole(this.requestSpec, this.responseSpec); - Assert.assertNotNull(roleId); + Assertions.assertNotNull(roleId); LOG.info("--------------------------------- Getting ROLE -------------------------------"); HashMap role = RolesHelper.getRoleDetails(requestSpec, responseSpec, roleId); @@ -119,7 +119,7 @@ public class RolesTest { LOG.info("-------------------------------- CREATING A ROLE---------------------------------------------"); final Integer roleId = RolesHelper.createRole(this.requestSpec, this.responseSpec); - Assert.assertNotNull(roleId); + Assertions.assertNotNull(roleId); LOG.info("--------------------------------- Getting ROLE -------------------------------"); HashMap role = RolesHelper.getRoleDetails(requestSpec, responseSpec, roleId); @@ -133,16 +133,16 @@ public class RolesTest { @Test public void testRoleShouldGetDeletedIfNoActiveUserExists() { final Integer roleId = RolesHelper.createRole(this.requestSpec, this.responseSpec); - Assert.assertNotNull(roleId); + Assertions.assertNotNull(roleId); final Integer staffId = StaffHelper.createStaff(this.requestSpec, this.responseSpec); - Assert.assertNotNull(staffId); + Assertions.assertNotNull(staffId); final Integer userId = UserHelper.createUser(this.requestSpec, this.responseSpec, roleId, staffId); - Assert.assertNotNull(userId); + Assertions.assertNotNull(userId); final Integer deletedUserId = UserHelper.deleteUser(this.requestSpec, this.responseSpec, userId); - Assert.assertEquals(deletedUserId, userId); + Assertions.assertEquals(deletedUserId, userId); final Integer deletedRoleId = RolesHelper.deleteRole(this.requestSpec, this.responseSpec, roleId); assertEquals(deletedRoleId, roleId); @@ -151,13 +151,13 @@ public class RolesTest { @Test public void testRoleShouldNotGetDeletedIfActiveUserExists() { final Integer roleId = RolesHelper.createRole(this.requestSpec, this.responseSpec); - Assert.assertNotNull(roleId); + Assertions.assertNotNull(roleId); final Integer staffId = StaffHelper.createStaff(this.requestSpec, this.responseSpec); - Assert.assertNotNull(staffId); + Assertions.assertNotNull(staffId); final Integer userId = UserHelper.createUser(this.requestSpec, this.responseSpec, roleId, staffId); - Assert.assertNotNull(userId); + Assertions.assertNotNull(userId); this.responseSpec = new ResponseSpecBuilder().expectStatusCode(403).build(); final Integer deletedRoleId = RolesHelper.deleteRole(this.requestSpec, this.responseSpec, roleId); diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/SchedulerJobsTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/SchedulerJobsTest.java index 5739a86dc..adda06585 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/SchedulerJobsTest.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/SchedulerJobsTest.java @@ -19,7 +19,7 @@ package org.apache.fineract.integrationtests; import static org.awaitility.Awaitility.await; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import io.restassured.builder.RequestSpecBuilder; import io.restassured.http.ContentType; @@ -31,9 +31,9 @@ import java.util.Map; import org.apache.fineract.infrastructure.jobs.service.JobName; import org.apache.fineract.integrationtests.common.SchedulerJobHelper; import org.apache.fineract.integrationtests.common.Utils; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class SchedulerJobsTest { @@ -42,7 +42,7 @@ public class SchedulerJobsTest { private Boolean originalSchedulerStatus; private final Map originalJobStatus = new HashMap<>(); - @Before + @BeforeEach public void setup() { Utils.initializeRESTAssured(); requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build(); @@ -57,7 +57,7 @@ public class SchedulerJobsTest { } } - @After + @AfterEach public void tearDown() { schedulerJobHelper.updateSchedulerStatus(originalSchedulerStatus); for (int jobId = 1; jobId < JobName.values().length; jobId++) { @@ -85,19 +85,19 @@ public class SchedulerJobsTest { schedulerJobHelper.updateSchedulerStatus(false); schedulerStatus = schedulerJobHelper.getSchedulerStatus(); // Verifying Status of the Scheduler after stopping - assertEquals("Verifying Scheduler Job Status", false, schedulerStatus); + assertEquals(false, schedulerStatus, "Verifying Scheduler Job Status"); } else { schedulerJobHelper.updateSchedulerStatus(true); schedulerStatus = schedulerJobHelper.getSchedulerStatus(); // Verifying Status of the Scheduler after starting - assertEquals("Verifying Scheduler Job Status", true, schedulerStatus); + assertEquals(true, schedulerStatus, "Verifying Scheduler Job Status"); } } @Test public void testNumberOfJobs() { List jobIds = schedulerJobHelper.getAllSchedulerJobIds(); - assertEquals("Number of jobs in database and code do not match: " + jobIds, JobName.values().length, jobIds.size()); + assertEquals(JobName.values().length, jobIds.size(), "Number of jobs in database and code do not match: " + jobIds); } @Test @@ -118,10 +118,10 @@ public class SchedulerJobsTest { Map changes = schedulerJobHelper.updateSchedulerJob(jobId, active); // Verifying Scheduler Job updates - assertEquals("Verifying Scheduler Job Updates", active, changes.get("active")); + assertEquals(active, changes.get("active"), "Verifying Scheduler Job Updates"); schedulerJob = schedulerJobHelper.getSchedulerJobById(jobId); - assertEquals("Verifying Get Scheduler Job", active, schedulerJob.get("active")); + assertEquals(active, schedulerJob.get("active"), "Verifying Get Scheduler Job"); } } diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/SchedulerJobsTestResults.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/SchedulerJobsTestResults.java index c7f5f6023..dc7dc28c5 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/SchedulerJobsTestResults.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/SchedulerJobsTestResults.java @@ -18,7 +18,7 @@ */ package org.apache.fineract.integrationtests; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import io.restassured.builder.RequestSpecBuilder; import io.restassured.builder.ResponseSpecBuilder; @@ -60,11 +60,11 @@ import org.apache.fineract.integrationtests.common.savings.SavingsProductHelper; import org.apache.fineract.integrationtests.common.savings.SavingsStatusChecker; import org.apache.fineract.portfolio.account.PortfolioAccountType; import org.apache.fineract.portfolio.account.domain.AccountTransferType; -import org.junit.After; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; @SuppressWarnings({ "unused", "unchecked", "rawtypes", "static-access", "cast" }) public class SchedulerJobsTestResults { @@ -93,7 +93,7 @@ public class SchedulerJobsTestResults { private JournalEntryHelper journalEntryHelper; private StandingInstructionsHelper standingInstructionsHelper; - @Before + @BeforeEach public void setup() { Utils.initializeRESTAssured(); this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build(); @@ -106,28 +106,28 @@ public class SchedulerJobsTestResults { this.journalEntryHelper = new JournalEntryHelper(this.requestSpec, this.responseSpec); } - @After + @AfterEach public void tearDown() { GlobalConfigurationHelper.resetAllDefaultGlobalConfigurations(this.requestSpec, this.responseSpec); GlobalConfigurationHelper.verifyAllDefaultGlobalConfigurations(this.requestSpec, this.responseSpec); } @Test - @Ignore // TODO FINERACT-924 + @Disabled // TODO FINERACT-924 public void testApplyAnnualFeeForSavingsJobOutcome() throws InterruptedException { this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec); this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec); final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientID); + Assertions.assertNotNull(clientID); final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, ClientSavingsIntegrationTest.MINIMUM_OPENING_BALANCE); - Assert.assertNotNull(savingsProductID); + Assertions.assertNotNull(savingsProductID); final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(clientID, savingsProductID, ClientSavingsIntegrationTest.ACCOUNT_TYPE_INDIVIDUAL); - Assert.assertNotNull(savingsProductID); + Assertions.assertNotNull(savingsProductID); HashMap savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsId); @@ -135,11 +135,11 @@ public class SchedulerJobsTestResults { final Integer annualFeeChargeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec, ChargesHelper.getSavingsAnnualFeeJSON()); - Assert.assertNotNull(annualFeeChargeId); + Assertions.assertNotNull(annualFeeChargeId); this.savingsAccountHelper.addChargesForSavings(savingsId, annualFeeChargeId, true); ArrayList chargesPendingState = this.savingsAccountHelper.getSavingsCharges(savingsId); - Assert.assertEquals(1, chargesPendingState.size()); + Assertions.assertEquals(1, chargesPendingState.size()); savingsStatusHashMap = this.savingsAccountHelper.approveSavings(savingsId); SavingsStatusChecker.verifySavingsIsApproved(savingsStatusHashMap); @@ -162,27 +162,27 @@ public class SchedulerJobsTestResults { annualFeeDueDateAsArrayList.get(1), annualFeeDueDateAsArrayList.get(2)); LocalDate todaysDate = LocalDate.now(ZoneId.of("Asia/Kolkata")); - Assert.assertTrue("Verifying that all due Annual Fees have been paid ", - nextDueDateForAnnualFee.isAfter(todaysDate)); + Assertions.assertTrue(nextDueDateForAnnualFee.isAfter(todaysDate), + "Verifying that all due Annual Fees have been paid "); } @Test - @Ignore + @Disabled public void testInterestPostingForSavingsJobOutcome() throws InterruptedException { this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec); this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec); final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientID); + Assertions.assertNotNull(clientID); final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, ClientSavingsIntegrationTest.MINIMUM_OPENING_BALANCE); - Assert.assertNotNull(savingsProductID); + Assertions.assertNotNull(savingsProductID); final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(clientID, savingsProductID, ClientSavingsIntegrationTest.ACCOUNT_TYPE_INDIVIDUAL); - Assert.assertNotNull(savingsProductID); + Assertions.assertNotNull(savingsProductID); HashMap savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsId); @@ -201,28 +201,28 @@ public class SchedulerJobsTestResults { this.schedulerJobHelper.executeJob(JobName); final HashMap summaryAfter = this.savingsAccountHelper.getSavingsSummary(savingsId); - Assert.assertNotSame("Verifying the Balance after running Post Interest for Savings Job", - summaryBefore.get("accountBalance"), summaryAfter.get("accountBalance")); + Assertions.assertNotSame(summaryBefore.get("accountBalance"), summaryAfter.get("accountBalance"), + "Verifying the Balance after running Post Interest for Savings Job"); } @Test - @Ignore // TODO FINERACT-857 + @Disabled // TODO FINERACT-857 public void testTransferFeeForLoansFromSavingsJobOutcome() throws InterruptedException { this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec); this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec); this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec); final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientID); + Assertions.assertNotNull(clientID); final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, ClientSavingsIntegrationTest.MINIMUM_OPENING_BALANCE); - Assert.assertNotNull(savingsProductID); + Assertions.assertNotNull(savingsProductID); final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(clientID, savingsProductID, ClientSavingsIntegrationTest.ACCOUNT_TYPE_INDIVIDUAL); - Assert.assertNotNull(savingsProductID); + Assertions.assertNotNull(savingsProductID); HashMap savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsId); @@ -235,11 +235,11 @@ public class SchedulerJobsTestResults { SavingsStatusChecker.verifySavingsIsActive(savingsStatusHashMap); final Integer loanProductID = createLoanProduct(null); - Assert.assertNotNull(loanProductID); + Assertions.assertNotNull(loanProductID); final Integer loanID = applyForLoanApplication(clientID.toString(), loanProductID.toString(), savingsId.toString()); - Assert.assertNotNull(loanID); + Assertions.assertNotNull(loanID); HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID); @@ -251,13 +251,13 @@ public class SchedulerJobsTestResults { Integer specifiedDueDateChargeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec, ChargesHelper.getLoanSpecifiedDueDateWithAccountTransferJSON()); - Assert.assertNotNull(specifiedDueDateChargeId); + Assertions.assertNotNull(specifiedDueDateChargeId); this.loanTransactionHelper.addChargesForLoan(loanID, LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON( specifiedDueDateChargeId.toString(), "12 March 2013", "100")); ArrayList chargesPendingState = this.loanTransactionHelper.getLoanCharges(loanID); - Assert.assertEquals(1, chargesPendingState.size()); + Assertions.assertEquals(1, chargesPendingState.size()); loanStatusHashMap = this.loanTransactionHelper.disburseLoan(AccountTransferTest.LOAN_DISBURSAL_DATE, loanID); @@ -275,13 +275,13 @@ public class SchedulerJobsTestResults { final Float balance = (Float) summaryBefore.get("accountBalance") - chargeAmount; - Assert.assertEquals("Verifying the Balance after running Transfer Fee for Loans from Savings", balance, - (Float) summaryAfter.get("accountBalance")); + Assertions.assertEquals(balance, (Float) summaryAfter.get("accountBalance"), + "Verifying the Balance after running Transfer Fee for Loans from Savings"); } @Test - @Ignore // TODO FINERACT-923 + @Disabled // TODO FINERACT-923 public void testApplyHolidaysToLoansJobOutcome() throws InterruptedException { this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec); this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec); @@ -289,16 +289,16 @@ public class SchedulerJobsTestResults { this.globalConfigurationHelper = new GlobalConfigurationHelper(this.requestSpec, this.responseSpec); final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientID); + Assertions.assertNotNull(clientID); Integer holidayId = this.holidayHelper.createHolidays(this.requestSpec, this.responseSpec); - Assert.assertNotNull(holidayId); + Assertions.assertNotNull(holidayId); final Integer loanProductID = createLoanProduct(null); - Assert.assertNotNull(loanProductID); + Assertions.assertNotNull(loanProductID); final Integer loanID = applyForLoanApplication(clientID.toString(), loanProductID.toString(), null); - Assert.assertNotNull(loanID); + Assertions.assertNotNull(loanID); HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID); @@ -315,16 +315,16 @@ public class SchedulerJobsTestResults { // Retrieving All Global Configuration details final ArrayList globalConfig = this.globalConfigurationHelper .getAllGlobalConfigurations(this.requestSpec, this.responseSpec); - Assert.assertNotNull(globalConfig); + Assertions.assertNotNull(globalConfig); // Updating Value for reschedule-repayments-on-holidays Global // Configuration Integer configId = (Integer) globalConfig.get(3).get("id"); - Assert.assertNotNull(configId); + Assertions.assertNotNull(configId); HashMap configData = this.globalConfigurationHelper.getGlobalConfigurationById(this.requestSpec, this.responseSpec, configId.toString()); - Assert.assertNotNull(configData); + Assertions.assertNotNull(configData); Boolean enabled = (Boolean) globalConfig.get(3).get("enabled"); @@ -338,7 +338,7 @@ public class SchedulerJobsTestResults { holidayId = this.holidayHelper.activateHolidays(this.requestSpec, this.responseSpec, holidayId.toString()); - Assert.assertNotNull(holidayId); + Assertions.assertNotNull(holidayId); String JobName = "Apply Holidays To Loans"; @@ -354,28 +354,27 @@ public class SchedulerJobsTestResults { ArrayList rescheduleDateAfter = (ArrayList) repaymentScheduleDataAfterJob.get(2) .get("fromDate"); - Assert.assertEquals( - "Verifying Repayment Rescheduled Date after Running Apply Holidays to Loans Scheduler Job", - repaymentsRescheduledDate, repaymentsRescheduledDate); + Assertions.assertEquals(repaymentsRescheduledDate, repaymentsRescheduledDate, + "Verifying Repayment Rescheduled Date after Running Apply Holidays to Loans Scheduler Job"); } @Test - @Ignore // TODO FINERACT-857 + @Disabled // TODO FINERACT-857 public void testApplyDueFeeChargesForSavingsJobOutcome() throws InterruptedException { this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec); this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec); final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientID); + Assertions.assertNotNull(clientID); final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, ClientSavingsIntegrationTest.MINIMUM_OPENING_BALANCE); - Assert.assertNotNull(savingsProductID); + Assertions.assertNotNull(savingsProductID); final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(clientID, savingsProductID, ClientSavingsIntegrationTest.ACCOUNT_TYPE_INDIVIDUAL); - Assert.assertNotNull(savingsProductID); + Assertions.assertNotNull(savingsProductID); HashMap savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsId); @@ -383,11 +382,11 @@ public class SchedulerJobsTestResults { final Integer specifiedDueDateChargeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec, ChargesHelper.getSavingsSpecifiedDueDateJSON()); - Assert.assertNotNull(specifiedDueDateChargeId); + Assertions.assertNotNull(specifiedDueDateChargeId); this.savingsAccountHelper.addChargesForSavings(savingsId, specifiedDueDateChargeId, true); ArrayList chargesPendingState = this.savingsAccountHelper.getSavingsCharges(savingsId); - Assert.assertEquals(1, chargesPendingState.size()); + Assertions.assertEquals(1, chargesPendingState.size()); savingsStatusHashMap = this.savingsAccountHelper.approveSavings(savingsId); SavingsStatusChecker.verifySavingsIsApproved(savingsStatusHashMap); @@ -409,12 +408,12 @@ public class SchedulerJobsTestResults { final Float balance = (Float) summaryBefore.get("accountBalance") - chargeAmount; - Assert.assertEquals("Verifying the Balance after running Pay due Savings Charges", balance, - (Float) summaryAfter.get("accountBalance")); + Assertions.assertEquals(balance, (Float) summaryAfter.get("accountBalance"), + "Verifying the Balance after running Pay due Savings Charges"); } @Test - @Ignore // TODO FINERACT-857 + @Disabled // TODO FINERACT-857 public void testUpdateAccountingRunningBalancesJobOutcome() throws InterruptedException { this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec); this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec); @@ -462,26 +461,25 @@ public class SchedulerJobsTestResults { final Integer INT_BALANCE = Integer.valueOf(MINIMUM_OPENING_BALANCE); - Assert.assertEquals( - "Verifying Account Running Balance after running Update Accounting Running Balances Scheduler Job", - INT_BALANCE, runningBalanceAfter.get("organizationRunningBalance")); + Assertions.assertEquals(INT_BALANCE, runningBalanceAfter.get("organizationRunningBalance"), + "Verifying Account Running Balance after running Update Accounting Running Balances Scheduler Job"); } @Test - @Ignore // TODO FINERACT-857 + @Disabled // TODO FINERACT-857 public void testUpdateLoanArrearsAgingJobOutcome() throws InterruptedException { this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec); this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec); final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientID); + Assertions.assertNotNull(clientID); final Integer loanProductID = createLoanProduct(null); - Assert.assertNotNull(loanProductID); + Assertions.assertNotNull(loanProductID); final Integer loanID = applyForLoanApplication(clientID.toString(), loanProductID.toString(), null); - Assert.assertNotNull(loanID); + Assertions.assertNotNull(loanID); HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID); @@ -504,13 +502,13 @@ public class SchedulerJobsTestResults { Float totalLoanArrearsAging = (Float) loanSummaryData.get("principalOverdue") + (Float) loanSummaryData.get("interestOverdue"); - Assert.assertEquals("Verifying Arrears Aging after Running Update Loan Arrears Aging Scheduler Job", - totalLoanArrearsAging, loanSummaryData.get("totalOverdue")); + Assertions.assertEquals(totalLoanArrearsAging, loanSummaryData.get("totalOverdue"), + "Verifying Arrears Aging after Running Update Loan Arrears Aging Scheduler Job"); } @Test - @Ignore // TODO FINERACT-857 + @Disabled // TODO FINERACT-857 public void testUpdateLoanPaidInAdvanceJobOutcome() throws InterruptedException { this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec); this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec); @@ -528,13 +526,13 @@ public class SchedulerJobsTestResults { final String LOAN_FIRST_REPAYMENT_DATE = dateFormat.format(todayDate.getTime()); final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientID); + Assertions.assertNotNull(clientID); final Integer loanProductID = createLoanProduct(null); - Assert.assertNotNull(loanProductID); + Assertions.assertNotNull(loanProductID); final Integer loanID = applyForLoanApplication(clientID.toString(), loanProductID.toString(), null); - Assert.assertNotNull(loanID); + Assertions.assertNotNull(loanID); HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID); @@ -569,15 +567,14 @@ public class SchedulerJobsTestResults { Float totalPaidInAdvance = (Float) loanScheduleAfter.get(1).get("totalPaidInAdvanceForPeriod"); - Assert.assertEquals( - "Verifying Loan Repayment in Advance after Running Update Loan Paid in Advance Scheduler Job", - totalDueForCurrentPeriod, totalPaidInAdvance); + Assertions.assertEquals(totalDueForCurrentPeriod, totalPaidInAdvance, + "Verifying Loan Repayment in Advance after Running Update Loan Paid in Advance Scheduler Job"); } // Invalid test case as it won't affect summary (Loan summary is properly // updated before running this job) - @Ignore + @Disabled @Test public void testUpdateLoanSummaryJobOutcome() throws InterruptedException { this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec); @@ -596,22 +593,22 @@ public class SchedulerJobsTestResults { final String LOAN_FIRST_REPAYMENT_DATE = dateFormat.format(todaysDate.getTime()); final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientID); + Assertions.assertNotNull(clientID); final Integer loanProductID = createLoanProduct(null); - Assert.assertNotNull(loanProductID); + Assertions.assertNotNull(loanProductID); final Integer loanID = applyForLoanApplication(clientID.toString(), loanProductID.toString(), null); - Assert.assertNotNull(loanID); + Assertions.assertNotNull(loanID); Integer disburseChargeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec, ChargesHelper.getLoanDisbursementJSON()); - Assert.assertNotNull(disburseChargeId); + Assertions.assertNotNull(disburseChargeId); this.loanTransactionHelper.addChargesForLoan(loanID, LoanTransactionHelper.getDisbursementChargesForLoanAsJSON(disburseChargeId.toString())); ArrayList chargesPendingState = this.loanTransactionHelper.getLoanCharges(loanID); - Assert.assertEquals(1, chargesPendingState.size()); + Assertions.assertEquals(1, chargesPendingState.size()); HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID); @@ -633,13 +630,13 @@ public class SchedulerJobsTestResults { /* - (Float) loanSummaryBefore.get("feeChargesPaid") */; HashMap loanSummaryAfter = this.loanTransactionHelper.getLoanSummary(this.requestSpec, this.responseSpec, loanID); - Assert.assertEquals("Verifying Loan Summary after Running Update Loan Summary Scheduler Job", - expectedSummaryAfterJob, (Float) loanSummaryAfter.get("totalExpectedRepayment")); + Assertions.assertEquals(expectedSummaryAfterJob, (Float) loanSummaryAfter.get("totalExpectedRepayment"), + "Verifying Loan Summary after Running Update Loan Summary Scheduler Job"); } @Test - @Ignore // TODO FINERACT-857 + @Disabled // TODO FINERACT-857 public void testExecuteStandingInstructionsJobOutcome() throws InterruptedException { this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec); this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec); @@ -658,15 +655,15 @@ public class SchedulerJobsTestResults { final String VALID_TO = dateFormat.format(todaysDate.getTime()); final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientID); + Assertions.assertNotNull(clientID); final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, ClientSavingsIntegrationTest.MINIMUM_OPENING_BALANCE); - Assert.assertNotNull(savingsProductID); + Assertions.assertNotNull(savingsProductID); final Integer fromSavingsId = this.savingsAccountHelper.applyForSavingsApplication(clientID, savingsProductID, ClientSavingsIntegrationTest.ACCOUNT_TYPE_INDIVIDUAL); - Assert.assertNotNull(savingsProductID); + Assertions.assertNotNull(savingsProductID); HashMap fromSavingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, fromSavingsId); @@ -680,7 +677,7 @@ public class SchedulerJobsTestResults { final Integer toSavingsId = this.savingsAccountHelper.applyForSavingsApplication(clientID, savingsProductID, ClientSavingsIntegrationTest.ACCOUNT_TYPE_INDIVIDUAL); - Assert.assertNotNull(savingsProductID); + Assertions.assertNotNull(savingsProductID); HashMap toSavingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, toSavingsId); @@ -701,7 +698,7 @@ public class SchedulerJobsTestResults { Integer standingInstructionId = this.standingInstructionsHelper.createStandingInstruction( clientID.toString(), fromSavingsId.toString(), toSavingsId.toString(), FROM_ACCOUNT_TYPE_SAVINGS, TO_ACCOUNT_TYPE_SAVINGS, VALID_FROM, VALID_TO, MONTH_DAY); - Assert.assertNotNull(standingInstructionId); + Assertions.assertNotNull(standingInstructionId); String JobName = "Execute Standing Instruction"; this.schedulerJobHelper.executeJob(JobName); @@ -717,42 +714,42 @@ public class SchedulerJobsTestResults { - (Float) standingInstructionData.get("amount"); Float expectedToSavingsBalance = toSavingsBalanceBefore + (Float) standingInstructionData.get("amount"); - Assert.assertEquals("Verifying From Savings Balance after Successful completion of Scheduler Job", - expectedFromSavingsBalance, fromSavingsBalanceAfter); - Assert.assertEquals("Verifying To Savings Balance after Successful completion of Scheduler Job", - expectedToSavingsBalance, toSavingsBalanceAfter); + Assertions.assertEquals(expectedFromSavingsBalance, fromSavingsBalanceAfter, + "Verifying From Savings Balance after Successful completion of Scheduler Job"); + Assertions.assertEquals(expectedToSavingsBalance, toSavingsBalanceAfter, + "Verifying To Savings Balance after Successful completion of Scheduler Job"); Integer fromAccountType = PortfolioAccountType.SAVINGS.getValue(); Integer transferType = AccountTransferType.ACCOUNT_TRANSFER.getValue(); List standinInstructionHistoryData = this.standingInstructionsHelper .getStandingInstructionHistory(fromSavingsId, fromAccountType, clientID, transferType); - Assert.assertEquals("Verifying the no of stainding instruction transactions logged for the client", 1, - standinInstructionHistoryData.size()); + Assertions.assertEquals(1, standinInstructionHistoryData.size(), + "Verifying the no of stainding instruction transactions logged for the client"); HashMap loggedTransaction = standinInstructionHistoryData.get(0); - Assert.assertEquals("Verifying transferred amount and logged transaction amounts", - (Float) standingInstructionData.get("amount"), (Float) loggedTransaction.get("amount")); + Assertions.assertEquals((Float) standingInstructionData.get("amount"), (Float) loggedTransaction.get("amount"), + "Verifying transferred amount and logged transaction amounts"); } @Test - @Ignore + @Disabled public void testApplyPenaltyForOverdueLoansJobOutcome() throws InterruptedException { this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec); this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec); this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec); final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientID); + Assertions.assertNotNull(clientID); Integer overdueFeeChargeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec, ChargesHelper.getLoanOverdueFeeJSON()); - Assert.assertNotNull(overdueFeeChargeId); + Assertions.assertNotNull(overdueFeeChargeId); final Integer loanProductID = createLoanProduct(overdueFeeChargeId.toString()); - Assert.assertNotNull(loanProductID); + Assertions.assertNotNull(loanProductID); final Integer loanID = applyForLoanApplication(clientID.toString(), loanProductID.toString(), null); - Assert.assertNotNull(loanID); + Assertions.assertNotNull(loanID); HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID); @@ -780,9 +777,8 @@ public class SchedulerJobsTestResults { ArrayList repaymentScheduleDataAfter = this.loanTransactionHelper .getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID); - Assert.assertEquals( - "Verifying From Penalty Charges due fot first Repayment after Successful completion of Scheduler Job", - chargeAmount, (Float) repaymentScheduleDataAfter.get(1).get("penaltyChargesDue")); + Assertions.assertEquals(chargeAmount, (Float) repaymentScheduleDataAfter.get(1).get("penaltyChargesDue"), + "Verifying From Penalty Charges due fot first Repayment after Successful completion of Scheduler Job"); loanStatusHashMap = this.loanTransactionHelper.undoDisbursal(loanID); LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap); @@ -791,24 +787,24 @@ public class SchedulerJobsTestResults { } @Test - @Ignore // TODO FINERACT-857 + @Disabled // TODO FINERACT-857 public void testAvoidUnncessaryPenaltyWhenAmountZeroForOverdueLoansJobOutcome() throws InterruptedException { this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec); this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec); this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec); final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientID); + Assertions.assertNotNull(clientID); Integer overdueFeeChargeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec, ChargesHelper.getLoanOverdueFeeJSONWithCalculattionTypePercentage("0.000001")); - Assert.assertNotNull(overdueFeeChargeId); + Assertions.assertNotNull(overdueFeeChargeId); final Integer loanProductID = createLoanProduct(overdueFeeChargeId.toString()); - Assert.assertNotNull(loanProductID); + Assertions.assertNotNull(loanProductID); final Integer loanID = applyForLoanApplication(clientID.toString(), loanProductID.toString(), null); - Assert.assertNotNull(loanID); + Assertions.assertNotNull(loanID); HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID); @@ -832,11 +828,11 @@ public class SchedulerJobsTestResults { Map schedulerJob = this.schedulerJobHelper.getSchedulerJobById(jobId); - Assert.assertNotNull(schedulerJob); + Assertions.assertNotNull(schedulerJob); while ((Boolean) schedulerJob.get("currentlyRunning") == true) { Thread.sleep(15000); schedulerJob = this.schedulerJobHelper.getSchedulerJobById(jobId); - Assert.assertNotNull(schedulerJob); + Assertions.assertNotNull(schedulerJob); } final HashMap chargeData = ChargesHelper.getChargeById(this.requestSpec, this.responseSpec, @@ -845,14 +841,13 @@ public class SchedulerJobsTestResults { ArrayList repaymentScheduleDataAfter = this.loanTransactionHelper .getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID); - Assert.assertEquals( - "Verifying From Penalty Charges due fot first Repayment after Successful completion of Scheduler Job", - 0, repaymentScheduleDataAfter.get(1).get("penaltyChargesDue")); + Assertions.assertEquals(0, repaymentScheduleDataAfter.get(1).get("penaltyChargesDue"), + "Verifying From Penalty Charges due fot first Repayment after Successful completion of Scheduler Job"); final ArrayList loanCharges = this.loanTransactionHelper.getLoanCharges(this.requestSpec, this.responseSpec, loanID); - Assert.assertNull("Verifying that charge isn't created when the amount is 0", loanCharges); + Assertions.assertNull(loanCharges, "Verifying that charge isn't created when the amount is 0"); loanStatusHashMap = this.loanTransactionHelper.undoDisbursal(loanID); LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap); @@ -861,19 +856,19 @@ public class SchedulerJobsTestResults { } @Test - @Ignore // TODO FINERACT-857 + @Disabled // TODO FINERACT-857 public void testUpdateOverdueDaysForNPA() throws InterruptedException { this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec); this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec); final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientID); + Assertions.assertNotNull(clientID); final Integer loanProductID = createLoanProduct(null); - Assert.assertNotNull(loanProductID); + Assertions.assertNotNull(loanProductID); final Integer loanID = applyForLoanApplication(clientID.toString(), loanProductID.toString(), null); - Assert.assertNotNull(loanID); + Assertions.assertNotNull(loanID); HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID); @@ -889,17 +884,17 @@ public class SchedulerJobsTestResults { final Boolean isNPABefore = (Boolean) this.loanTransactionHelper.getLoanDetail(requestSpec, responseSpec, loanID, "isNPA"); - Assert.assertFalse(isNPABefore); + Assertions.assertFalse(isNPABefore); // Integer jobId = (Integer) allSchedulerJobsData.get(1).get("jobId"); String JobName = "Update Non Performing Assets"; this.schedulerJobHelper.executeJob(JobName); final Boolean isNPAAfter = (Boolean) this.loanTransactionHelper.getLoanDetail(requestSpec, responseSpec, loanID, "isNPA"); - Assert.assertTrue(isNPAAfter); + Assertions.assertTrue(isNPAAfter); } @Test - @Ignore // TODO FINERACT-857 + @Disabled // TODO FINERACT-857 public void testInterestTransferForSavings() throws InterruptedException { this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec); this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec); @@ -928,16 +923,16 @@ public class SchedulerJobsTestResults { final String WHOLE_TERM = "1"; Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientId); + Assertions.assertNotNull(clientId); Float balance = Float.valueOf(MINIMUM_OPENING_BALANCE) + Float.valueOf(FixedDepositAccountHelper.DEPOSIT_AMOUNT); final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, String.valueOf(balance)); - Assert.assertNotNull(savingsProductID); + Assertions.assertNotNull(savingsProductID); final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(clientId, savingsProductID, ClientSavingsIntegrationTest.ACCOUNT_TYPE_INDIVIDUAL); - Assert.assertNotNull(savingsId); + Assertions.assertNotNull(savingsId); HashMap savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsId); @@ -949,15 +944,15 @@ public class SchedulerJobsTestResults { savingsStatusHashMap = this.savingsAccountHelper.activateSavings(savingsId); SavingsStatusChecker.verifySavingsIsActive(savingsStatusHashMap); HashMap summary = savingsAccountHelper.getSavingsSummary(savingsId); - assertEquals("Verifying opening Balance", balance, summary.get("accountBalance")); + assertEquals(balance, summary.get("accountBalance"), "Verifying opening Balance"); Integer fixedDepositProductId = createFixedDepositProduct(VALID_FROM, VALID_TO); - Assert.assertNotNull(fixedDepositProductId); + Assertions.assertNotNull(fixedDepositProductId); Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), VALID_FROM, VALID_TO, SUBMITTED_ON_DATE, WHOLE_TERM, savingsId.toString(), true, fixedDepositAccountHelper); - Assert.assertNotNull(fixedDepositAccountId); + Assertions.assertNotNull(fixedDepositAccountId); HashMap fixedDepositAccountStatusHashMap = FixedDepositAccountStatusChecker .getStatusOfFixedDepositAccount(this.requestSpec, this.responseSpec, @@ -973,7 +968,7 @@ public class SchedulerJobsTestResults { FixedDepositAccountStatusChecker.verifyFixedDepositIsActive(fixedDepositAccountStatusHashMap); summary = savingsAccountHelper.getSavingsSummary(savingsId); balance = Float.valueOf(MINIMUM_OPENING_BALANCE); - assertEquals("Verifying Balance", balance, summary.get("accountBalance")); + assertEquals(balance, summary.get("accountBalance"), "Verifying Balance"); fixedDepositAccountHelper.postInterestForFixedDeposit(fixedDepositAccountId); @@ -984,8 +979,9 @@ public class SchedulerJobsTestResults { String JobName = "Transfer Interest To Savings"; this.schedulerJobHelper.executeJob(JobName); fixedDepositSummary = savingsAccountHelper.getSavingsSummary(fixedDepositAccountId); - assertEquals("Verifying opening Balance", Float.valueOf(FixedDepositAccountHelper.DEPOSIT_AMOUNT), - fixedDepositSummary.get("accountBalance")); + assertEquals(Float.valueOf(FixedDepositAccountHelper.DEPOSIT_AMOUNT), + fixedDepositSummary.get("accountBalance"), + "Verifying opening Balance"); summary = savingsAccountHelper.getSavingsSummary(savingsId); balance = Float.valueOf(MINIMUM_OPENING_BALANCE) + interestPosted; @@ -1086,7 +1082,7 @@ public class SchedulerJobsTestResults { private void validateNumberForEqualExcludePrecission(String val, String val2) { DecimalFormat twoDForm = new DecimalFormat("#", new DecimalFormatSymbols(Locale.US)); - Assert.assertTrue(Float.valueOf(twoDForm.format(Float.valueOf(val))) + Assertions.assertTrue(Float.valueOf(twoDForm.format(Float.valueOf(val))) .compareTo(Float.valueOf(twoDForm.format(Float.valueOf(val2)))) == 0); } } diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/SkipRepaymentOnMonthFirstTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/SkipRepaymentOnMonthFirstTest.java index a5098e310..76e1a304f 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/SkipRepaymentOnMonthFirstTest.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/SkipRepaymentOnMonthFirstTest.java @@ -18,7 +18,7 @@ */ package org.apache.fineract.integrationtests; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import io.restassured.builder.RequestSpecBuilder; import io.restassured.builder.ResponseSpecBuilder; @@ -28,7 +28,6 @@ import io.restassured.specification.ResponseSpecification; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; -import junit.framework.Assert; import org.apache.fineract.integrationtests.common.CalendarHelper; import org.apache.fineract.integrationtests.common.ClientHelper; import org.apache.fineract.integrationtests.common.GlobalConfigurationHelper; @@ -37,9 +36,10 @@ import org.apache.fineract.integrationtests.common.Utils; import org.apache.fineract.integrationtests.common.loans.LoanApplicationTestBuilder; import org.apache.fineract.integrationtests.common.loans.LoanProductTestBuilder; import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -52,7 +52,7 @@ public class SkipRepaymentOnMonthFirstTest { private LoanTransactionHelper loanTransactionHelper; private CalendarHelper calendarHelper; - @Before + @BeforeEach public void setup() { Utils.initializeRESTAssured(); this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build(); @@ -61,7 +61,7 @@ public class SkipRepaymentOnMonthFirstTest { this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build(); } - @After + @AfterEach public void tearDown() { GlobalConfigurationHelper.resetAllDefaultGlobalConfigurations(this.requestSpec, this.responseSpec); GlobalConfigurationHelper.verifyAllDefaultGlobalConfigurations(this.requestSpec, this.responseSpec); @@ -74,7 +74,7 @@ public class SkipRepaymentOnMonthFirstTest { // Retrieving All Global Configuration details final ArrayList globalConfig = this.globalConfigurationHelper .getAllGlobalConfigurations(this.requestSpec, this.responseSpec); - Assert.assertNotNull(globalConfig); + Assertions.assertNotNull(globalConfig); String configName = "skip-repayment-on-first-day-of-month"; boolean newBooleanValue = true; @@ -84,7 +84,7 @@ public class SkipRepaymentOnMonthFirstTest { String configId = globalConfig.get(configIndex).get("id").toString(); Integer updateConfigId = this.globalConfigurationHelper.updateEnabledFlagForGlobalConfiguration( this.requestSpec, this.responseSpec, configId.toString(), newBooleanValue); - Assert.assertNotNull(updateConfigId); + Assertions.assertNotNull(updateConfigId); break; } } @@ -155,20 +155,20 @@ public class SkipRepaymentOnMonthFirstTest { private void verifyLoanRepaymentSchedule(final ArrayList loanSchedule) { LOG.info("--------------------VERIFYING THE REPAYMENT DATE--------------------------"); - assertEquals("Checking for Repayment Date for 1st Month", new ArrayList<>(Arrays.asList(2011, 10, 15)), - loanSchedule.get(1).get("dueDate")); + assertEquals(new ArrayList<>(Arrays.asList(2011, 10, 15)), loanSchedule.get(1).get("dueDate"), + "Checking for Repayment Date for 1st Month"); LOG.info("Repayment Date for 1st Month-- {}" , loanSchedule.get(1).get("dueDate")); - assertEquals("Checking for Repayment Date for 2nd Month", new ArrayList<>(Arrays.asList(2011, 11, 15)), - loanSchedule.get(2).get("dueDate")); + assertEquals(new ArrayList<>(Arrays.asList(2011, 11, 15)), loanSchedule.get(2).get("dueDate"), + "Checking for Repayment Date for 2nd Month"); LOG.info("Repayment Date for 2nd Month-- {}" , loanSchedule.get(2).get("dueDate")); - assertEquals("Checking for Repayment Date for 3rd Month", new ArrayList<>(Arrays.asList(2011, 12, 15)), - loanSchedule.get(3).get("dueDate")); + assertEquals(new ArrayList<>(Arrays.asList(2011, 12, 15)), loanSchedule.get(3).get("dueDate"), + "Checking for Repayment Date for 3rd Month"); LOG.info("Repayment Date for 3rd Month-- {}" , loanSchedule.get(3).get("dueDate")); - assertEquals("Checking for Repayment Date for 4th Month", new ArrayList<>(Arrays.asList(2012, 1, 15)), - loanSchedule.get(4).get("dueDate")); + assertEquals(new ArrayList<>(Arrays.asList(2012, 1, 15)), loanSchedule.get(4).get("dueDate"), + "Checking for Repayment Date for 4th Month"); LOG.info("Repayment Date for 4th Month-- {}" , loanSchedule.get(4).get("dueDate")); } diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/StaffImageApiTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/StaffImageApiTest.java index d20103109..b2eeedd92 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/StaffImageApiTest.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/StaffImageApiTest.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; @@ -29,15 +29,15 @@ import io.restassured.specification.ResponseSpecification; import org.apache.fineract.integrationtests.common.ImageHelper; import org.apache.fineract.integrationtests.common.Utils; import org.apache.fineract.integrationtests.common.organisation.StaffHelper; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class StaffImageApiTest { private RequestSpecification requestSpec; private ResponseSpecification responseSpec; - @Before + @BeforeEach public void setup() { Utils.initializeRESTAssured(); this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build(); @@ -49,14 +49,14 @@ public class StaffImageApiTest { public void createStaffImage() { Integer staffId = StaffHelper.createStaff(this.requestSpec, this.responseSpec); Integer imageId = ImageHelper.createImageForStaff(this.requestSpec, this.responseSpec, staffId); - assertNotNull("Image id should not be null", imageId); + assertNotNull(imageId, "Image id should not be null"); } @Test public void getStaffImage(){ Integer staffId = StaffHelper.createStaff(this.requestSpec, this.responseSpec); Integer imageId = ImageHelper.createImageForStaff(this.requestSpec, this.responseSpec, staffId); - assertNotNull("Image id should not be null", imageId); + assertNotNull(imageId, "Image id should not be null"); String imageAsText = ImageHelper.getStaffImageAsText(this.requestSpec, this.responseSpec, staffId); assertNotNull("Image id should not be null", imageAsText); assertEquals(ImageHelper.generateImageAsText(), imageAsText); @@ -66,9 +66,9 @@ public class StaffImageApiTest { public void getStaffImageAsBinary(){ Integer staffId = StaffHelper.createStaff(this.requestSpec, this.responseSpec); Integer imageId = ImageHelper.createImageForStaff(this.requestSpec, this.responseSpec, staffId); - assertNotNull("Image id should not be null", imageId); + assertNotNull(imageId, "Image id should not be null"); byte[] imageAsBytes = ImageHelper.getStaffImageAsBinary(this.requestSpec, this.responseSpec, staffId); - assertNotNull("Image content should not be null", imageAsBytes); + assertNotNull(imageAsBytes, "Image content should not be null"); assertEquals(251, imageAsBytes.length); } @@ -76,17 +76,17 @@ public class StaffImageApiTest { public void updateImage() { Integer staffId = StaffHelper.createStaff(this.requestSpec, this.responseSpec); Integer imageId = ImageHelper.createImageForStaff(this.requestSpec, this.responseSpec, staffId); - assertNotNull("Image id should not be null", imageId); + assertNotNull(imageId, "Image id should not be null"); imageId = ImageHelper.updateImageForStaff(this.requestSpec, this.responseSpec, staffId); - assertNotNull("Image id should not be null", imageId); + assertNotNull(imageId, "Image id should not be null"); } @Test public void deleteStaffImage() { Integer staffId = StaffHelper.createStaff(this.requestSpec, this.responseSpec); Integer imageId = ImageHelper.createImageForStaff(this.requestSpec, this.responseSpec, staffId); - assertNotNull("Image id should not be null", imageId); + assertNotNull(imageId, "Image id should not be null"); imageId = ImageHelper.deleteStaffImage(this.requestSpec, this.responseSpec, staffId); - assertNotNull("Image id should not be null", imageId); + assertNotNull(imageId, "Image id should not be null"); } } diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/StaffTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/StaffTest.java index 8b895cba9..2a9d5aff7 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/StaffTest.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/StaffTest.java @@ -29,9 +29,9 @@ import java.util.List; import java.util.Map; import org.apache.fineract.integrationtests.common.Utils; import org.apache.fineract.integrationtests.common.organisation.StaffHelper; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class StaffTest { @@ -40,7 +40,7 @@ public class StaffTest { private ResponseSpecification responseSpecForValidationError; private ResponseSpecification responseSpecForNotFoundError; - @Before + @BeforeEach public void setup() { Utils.initializeRESTAssured(); this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build(); @@ -54,9 +54,9 @@ public class StaffTest { public void testStaffCreate() { Map response = StaffHelper.createStaffMap(requestSpec, responseSpec); - Assert.assertNotNull(response); - Assert.assertEquals(1, response.get("officeId")); - Assert.assertNotNull(response.get("resourceId")); + Assertions.assertNotNull(response); + Assertions.assertEquals(1, response.get("officeId")); + Assertions.assertNotNull(response.get("resourceId")); } @Test @@ -118,9 +118,9 @@ public class StaffTest { @Test public void testStaffFetch() { Map response = StaffHelper.getStaff(requestSpec, responseSpec, 1); - Assert.assertNotNull(response); - Assert.assertNotNull(response.get("id")); - Assert.assertEquals(1, response.get("id")); + Assertions.assertNotNull(response); + Assertions.assertNotNull(response.get("id")); + Assertions.assertEquals(1, response.get("id")); } @Test @@ -137,8 +137,8 @@ public class StaffTest { public void testStaffListStatusActive() { List> responseActive = StaffHelper.getStaffListWithState(requestSpec, responseSpec, "active"); for(final Map staff : responseActive) { - Assert.assertNotNull(staff.get("id")); - Assert.assertEquals(true, staff.get("isActive")); + Assertions.assertNotNull(staff.get("id")); + Assertions.assertEquals(true, staff.get("isActive")); } } @@ -146,14 +146,16 @@ public class StaffTest { public void testStaffListStatusInactive() { List> responseInactive = StaffHelper.getStaffListWithState(requestSpec, responseSpec, "inactive"); for(final Map staff : responseInactive) { - Assert.assertNotNull(staff.get("id")); - Assert.assertEquals(false, staff.get("isActive")); + Assertions.assertNotNull(staff.get("id")); + Assertions.assertEquals(false, staff.get("isActive")); } } - @Test(expected = ClassCastException.class) // because "xyz" will return an error, not a List - public void testStaffListFetchWrongState() { - StaffHelper.getStaffListWithState(requestSpec, responseSpecForValidationError, "xyz"); + @Test // because "xyz" will return an error, not a List + public void testStaffListFetchWrongState() throws ClassCastException { + Assertions.assertThrows(ClassCastException.class, () -> { + StaffHelper.getStaffListWithState(requestSpec, responseSpecForValidationError, "xyz"); + }); } @Test @@ -178,11 +180,11 @@ public class StaffTest { @SuppressWarnings("unchecked") Map changes = (Map) response.get("changes"); - Assert.assertEquals(1, response.get("resourceId")); - Assert.assertEquals(firstname, changes.get("firstname")); - Assert.assertEquals(lastname, changes.get("lastname")); - Assert.assertEquals(externalId, changes.get("externalId")); - Assert.assertEquals(mobileNo, changes.get("mobileNo")); + Assertions.assertEquals(1, response.get("resourceId")); + Assertions.assertEquals(firstname, changes.get("firstname")); + Assertions.assertEquals(lastname, changes.get("lastname")); + Assertions.assertEquals(externalId, changes.get("externalId")); + Assertions.assertEquals(mobileNo, changes.get("mobileNo")); } @Test diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/SurveyIntegrationTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/SurveyIntegrationTest.java index 0e398477e..ac65e561f 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/SurveyIntegrationTest.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/SurveyIntegrationTest.java @@ -25,7 +25,7 @@ import io.restassured.specification.RequestSpecification; import io.restassured.specification.ResponseSpecification; import org.apache.fineract.integrationtests.common.Utils; import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper; -import org.junit.Before; +import org.junit.jupiter.api.BeforeEach; /** * Client Loan Integration Test for checking Loan Application Repayment @@ -38,7 +38,7 @@ public class SurveyIntegrationTest { private RequestSpecification requestSpec; private LoanTransactionHelper loanTransactionHelper; - @Before + @BeforeEach public void setup() { Utils.initializeRESTAssured(); this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build(); diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/SystemCodeTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/SystemCodeTest.java index 078fddd52..d89c7dcab 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/SystemCodeTest.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/SystemCodeTest.java @@ -18,8 +18,8 @@ */ package org.apache.fineract.integrationtests; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; import io.restassured.builder.RequestSpecBuilder; import io.restassured.builder.ResponseSpecBuilder; @@ -32,10 +32,10 @@ import java.util.List; import org.apache.fineract.integrationtests.common.CommonConstants; import org.apache.fineract.integrationtests.common.Utils; import org.apache.fineract.integrationtests.common.system.CodeHelper; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; /** * Test for creating, updating, deleting codes and code values @@ -48,7 +48,7 @@ public class SystemCodeTest { private ResponseSpecification generalResponseSpec; private RequestSpecification requestSpec; - @Before + @BeforeEach public void setup() { Utils.initializeRESTAssured(); this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build(); @@ -72,32 +72,32 @@ public class SystemCodeTest { final HashMap newCodeAttributes = (HashMap) CodeHelper.getCodeById(this.requestSpec, this.responseSpec, createResponseId, ""); - Assert.assertNotNull(newCodeAttributes); - assertEquals("Verify value of codeId", createResponseId, newCodeAttributes.get(CodeHelper.CODE_ID_ATTRIBUTE_NAME)); + Assertions.assertNotNull(newCodeAttributes); + assertEquals(createResponseId, newCodeAttributes.get(CodeHelper.CODE_ID_ATTRIBUTE_NAME), "Verify value of codeId"); - assertEquals("Verify code name", codeName, newCodeAttributes.get(CodeHelper.CODE_NAME_ATTRIBUTE_NAME)); - assertEquals("Verify system defined is false", false, newCodeAttributes.get(CodeHelper.CODE_SYSTEM_DEFINED_ATTRIBUTE_NAME)); + assertEquals(codeName, newCodeAttributes.get(CodeHelper.CODE_NAME_ATTRIBUTE_NAME), "Verify code name"); + assertEquals(false, newCodeAttributes.get(CodeHelper.CODE_SYSTEM_DEFINED_ATTRIBUTE_NAME), "Verify system defined is false"); // update code final HashMap updateChangeResponse = (HashMap) CodeHelper.updateCode(this.requestSpec, this.responseSpec, createResponseId, codeName + "(CHANGE)", "changes"); - assertEquals("Verify code name updated", codeName + "(CHANGE)", updateChangeResponse.get(CodeHelper.CODE_NAME_ATTRIBUTE_NAME)); + assertEquals(codeName + "(CHANGE)", updateChangeResponse.get(CodeHelper.CODE_NAME_ATTRIBUTE_NAME), "Verify code name updated"); // delete code final Integer deleteResponseId = (Integer) CodeHelper.deleteCodeById(this.requestSpec, this.responseSpec, createResponseId, CodeHelper.RESPONSE_ID_ATTRIBUTE_NAME); - assertEquals("Verify code deleted", createResponseId, deleteResponseId); + assertEquals(createResponseId, deleteResponseId, "Verify code deleted"); // verify code deleted final HashMap deletedCodeValues = (HashMap) CodeHelper .getCodeById(this.requestSpec, this.generalResponseSpec, deleteResponseId, ""); - Assert.assertNotNull(deletedCodeValues); - assertNull("Verify value of codeId", deletedCodeValues.get(CodeHelper.CODE_ID_ATTRIBUTE_NAME)); + Assertions.assertNotNull(deletedCodeValues); + assertNull(deletedCodeValues.get(CodeHelper.CODE_ID_ATTRIBUTE_NAME), "Verify value of codeId"); - assertNull("Verify code name", deletedCodeValues.get(CodeHelper.CODE_NAME_ATTRIBUTE_NAME)); - assertNull("Verify system defined is false", deletedCodeValues.get(CodeHelper.CODE_SYSTEM_DEFINED_ATTRIBUTE_NAME)); + assertNull(deletedCodeValues.get(CodeHelper.CODE_NAME_ATTRIBUTE_NAME), "Verify code name"); + assertNull(deletedCodeValues.get(CodeHelper.CODE_SYSTEM_DEFINED_ATTRIBUTE_NAME), "Verify system defined is false"); } // @Ignore() @@ -113,33 +113,33 @@ public class SystemCodeTest { // verify code created final HashMap newCodeAttributes = (HashMap) CodeHelper.getCodeById(this.requestSpec, this.responseSpec, createResponseId, ""); - Assert.assertNotNull(newCodeAttributes); - assertEquals("Verify value of codeId", createResponseId, newCodeAttributes.get(CodeHelper.CODE_ID_ATTRIBUTE_NAME)); + Assertions.assertNotNull(newCodeAttributes); + assertEquals(createResponseId, newCodeAttributes.get(CodeHelper.CODE_ID_ATTRIBUTE_NAME), "Verify value of codeId"); - assertEquals("Verify code name", codeName, newCodeAttributes.get(CodeHelper.CODE_NAME_ATTRIBUTE_NAME)); - assertEquals("Verify system defined is false", false, newCodeAttributes.get(CodeHelper.CODE_SYSTEM_DEFINED_ATTRIBUTE_NAME)); + assertEquals(codeName, newCodeAttributes.get(CodeHelper.CODE_NAME_ATTRIBUTE_NAME), "Verify code name"); + assertEquals(false, newCodeAttributes.get(CodeHelper.CODE_SYSTEM_DEFINED_ATTRIBUTE_NAME), "Verify system defined is false"); // try to create duplicate-- should fail final List error = (List) CodeHelper.createCode(this.requestSpec, this.generalResponseSpec, codeName, CommonConstants.RESPONSE_ERROR); - assertEquals("Verify duplication error", "error.msg.code.duplicate.name", error.get(0).get("userMessageGlobalisationCode")); + assertEquals("error.msg.code.duplicate.name", error.get(0).get("userMessageGlobalisationCode"), "Verify duplication error"); // delete code that was just created final Integer deleteResponseId = (Integer) CodeHelper.deleteCodeById(this.requestSpec, this.responseSpec, createResponseId, CodeHelper.RESPONSE_ID_ATTRIBUTE_NAME); - assertEquals("Verify code deleted", createResponseId, deleteResponseId); + assertEquals(createResponseId, deleteResponseId, "Verify code deleted"); // verify code deleted final HashMap deletedCodeAttributes = (HashMap) CodeHelper.getCodeById(this.requestSpec, this.generalResponseSpec, deleteResponseId, ""); - Assert.assertNotNull(deletedCodeAttributes); - assertNull("Verify value of codeId", deletedCodeAttributes.get(CodeHelper.CODE_ID_ATTRIBUTE_NAME)); + Assertions.assertNotNull(deletedCodeAttributes); + assertNull(deletedCodeAttributes.get(CodeHelper.CODE_ID_ATTRIBUTE_NAME), "Verify value of codeId"); - assertNull("Verify code name", deletedCodeAttributes.get(CodeHelper.CODE_NAME_ATTRIBUTE_NAME)); - assertNull("Verify system defined is false", deletedCodeAttributes.get(CodeHelper.CODE_SYSTEM_DEFINED_ATTRIBUTE_NAME)); + assertNull(deletedCodeAttributes.get(CodeHelper.CODE_NAME_ATTRIBUTE_NAME), "Verify code name"); + assertNull(deletedCodeAttributes.get(CodeHelper.CODE_SYSTEM_DEFINED_ATTRIBUTE_NAME), "Verify system defined is false"); } @@ -154,7 +154,7 @@ public class SystemCodeTest { final List error = (List) CodeHelper.deleteCodeById(this.requestSpec, this.generalResponseSpec, (Integer) systemDefinedCode.get(CodeHelper.CODE_ID_ATTRIBUTE_NAME), CommonConstants.RESPONSE_ERROR); - assertEquals("Cannot delete system-defined code", "error.msg.code.systemdefined", error.get(0).get("userMessageGlobalisationCode")); + assertEquals("error.msg.code.systemdefined", error.get(0).get("userMessageGlobalisationCode"), "Cannot delete system-defined code"); // update system-defined code should fail @@ -162,8 +162,8 @@ public class SystemCodeTest { (Integer) systemDefinedCode.get(CodeHelper.CODE_ID_ATTRIBUTE_NAME), systemDefinedCode.get(CodeHelper.CODE_NAME_ATTRIBUTE_NAME) + "CHANGE", CommonConstants.RESPONSE_ERROR); - assertEquals("Cannot update system-defined code", "error.msg.code.systemdefined", - updateError.get(0).get("userMessageGlobalisationCode")); + assertEquals("error.msg.code.systemdefined", updateError.get(0).get("userMessageGlobalisationCode"), + "Cannot update system-defined code"); } @@ -199,47 +199,48 @@ public class SystemCodeTest { final List codeValuesList = (List) CodeHelper.getCodeValuesForCode(this.requestSpec, this.responseSpec, createCodeResponseId, ""); - assertEquals("Number of code values returned matches number created", 2, codeValuesList.size()); + assertEquals(2, codeValuesList.size(), "Number of code values returned matches number created"); // verify values of first code value final HashMap codeValuesAttributes1 = (HashMap) CodeHelper.getCodeValueById(this.requestSpec, this.responseSpec, createCodeResponseId, createCodeValueResponseId1, ""); - Assert.assertNotNull(codeValuesAttributes1); - assertEquals("Verify value of codeValueId", createCodeValueResponseId1, - codeValuesAttributes1.get(CodeHelper.CODE_VALUE_ID_ATTRIBUTE_NAME)); + Assertions.assertNotNull(codeValuesAttributes1); + assertEquals(createCodeValueResponseId1, + codeValuesAttributes1.get(CodeHelper.CODE_VALUE_ID_ATTRIBUTE_NAME), "Verify value of codeValueId"); - assertEquals("Verify value of code name", codeValue1, codeValuesAttributes1.get(CodeHelper.CODE_VALUE_NAME_ATTRIBUTE_NAME)); + assertEquals(codeValue1, codeValuesAttributes1.get(CodeHelper.CODE_VALUE_NAME_ATTRIBUTE_NAME), + "Verify value of code name"); - assertEquals("Verify value of code description", codeDescription1, - codeValuesAttributes1.get(CodeHelper.CODE_VALUE_DESCRIPTION_ATTRIBUTE_NAME)); + assertEquals(codeDescription1, codeValuesAttributes1.get(CodeHelper.CODE_VALUE_DESCRIPTION_ATTRIBUTE_NAME), + "Verify value of code description"); - assertEquals("Verify position of code value", codeValue1Position, - codeValuesAttributes1.get(CodeHelper.CODE_VALUE_POSITION_ATTRIBUTE_NAME)); + assertEquals(codeValue1Position, codeValuesAttributes1.get(CodeHelper.CODE_VALUE_POSITION_ATTRIBUTE_NAME), + "Verify position of code value"); // verify values of second code value final HashMap codeValuesAttributes2 = (HashMap) CodeHelper.getCodeValueById(this.requestSpec, this.responseSpec, createCodeResponseId, createCodeValueResponseId2, ""); - Assert.assertNotNull(codeValuesAttributes2); - assertEquals("Verify value of codeValueId", createCodeValueResponseId2, - codeValuesAttributes2.get(CodeHelper.CODE_VALUE_ID_ATTRIBUTE_NAME)); + Assertions.assertNotNull(codeValuesAttributes2); + assertEquals(createCodeValueResponseId2, codeValuesAttributes2.get(CodeHelper.CODE_VALUE_ID_ATTRIBUTE_NAME), + "Verify value of codeValueId"); - assertEquals("Verify value of code name", codeValue2, codeValuesAttributes2.get(CodeHelper.CODE_VALUE_NAME_ATTRIBUTE_NAME)); + assertEquals(codeValue2, codeValuesAttributes2.get(CodeHelper.CODE_VALUE_NAME_ATTRIBUTE_NAME), "Verify value of code name"); - assertEquals("Verify value of code description", codeDescription2, - codeValuesAttributes2.get(CodeHelper.CODE_VALUE_DESCRIPTION_ATTRIBUTE_NAME)); + assertEquals(codeDescription2, codeValuesAttributes2.get(CodeHelper.CODE_VALUE_DESCRIPTION_ATTRIBUTE_NAME), + "Verify value of code description"); - assertEquals("Verify position of code value", codeValue2Position, - codeValuesAttributes2.get(CodeHelper.CODE_VALUE_POSITION_ATTRIBUTE_NAME)); + assertEquals(codeValue2Position, codeValuesAttributes2.get(CodeHelper.CODE_VALUE_POSITION_ATTRIBUTE_NAME), + "Verify position of code value"); // update code value 1 final HashMap codeValueChanges = (HashMap) CodeHelper.updateCodeValue(this.requestSpec, this.responseSpec, createCodeResponseId, createCodeValueResponseId1, codeValue1 + "CHANGE", codeDescription1 + "CHANGE", 4, "changes"); - assertEquals("Verify changed code value name", codeValue1 + "CHANGE", codeValueChanges.get("name")); + assertEquals(codeValue1 + "CHANGE", codeValueChanges.get("name"), "Verify changed code value name"); - assertEquals("Verify changed code value description", codeDescription1 + "CHANGE", codeValueChanges.get("description")); + assertEquals(codeDescription1 + "CHANGE", codeValueChanges.get("description"), "Verify changed code value description"); // delete code value Integer deletedCodeValueResponseId1 = (Integer) CodeHelper.deleteCodeValueById(this.requestSpec, this.generalResponseSpec, @@ -255,7 +256,7 @@ public class SystemCodeTest { final List deletedCodeValuesList = (List) CodeHelper.getCodeValuesForCode(this.requestSpec, this.responseSpec, createCodeResponseId, ""); - assertEquals("Number of code values is 1", 1, deletedCodeValuesList.size()); + assertEquals(1, deletedCodeValuesList.size(), "Number of code values is 1"); final Integer deletedCodeValueResponseId2 = (Integer) CodeHelper.deleteCodeValueById(this.requestSpec, this.generalResponseSpec, createCodeResponseId, createCodeValueResponseId2, CodeHelper.SUBRESPONSE_ID_ATTRIBUTE_NAME); @@ -263,16 +264,16 @@ public class SystemCodeTest { final ArrayList deletedCodeValueAttributes2 = (ArrayList) CodeHelper.getCodeValueById(this.requestSpec, this.generalResponseSpec, createCodeResponseId, deletedCodeValueResponseId2, CommonConstants.RESPONSE_ERROR); - assertEquals("error.msg.codevalue.id.invalid", deletedCodeValueAttributes2.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE)); + assertEquals(deletedCodeValueAttributes2.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE), "error.msg.codevalue.id.invalid"); final List deletedCodeValuesList1 = (List) CodeHelper.getCodeValuesForCode(this.requestSpec, this.responseSpec, createCodeResponseId, ""); - assertEquals("Number of code values is 0", 0, deletedCodeValuesList1.size()); + assertEquals(0, deletedCodeValuesList1.size(), "Number of code values is 0"); } - @Ignore + @Disabled @Test public void testCodeValuesAssignedToTable() { diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/TemplateIntegrationTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/TemplateIntegrationTest.java index 85f4b237d..28dfe0ac1 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/TemplateIntegrationTest.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/TemplateIntegrationTest.java @@ -27,10 +27,10 @@ import io.restassured.specification.ResponseSpecification; import java.util.ArrayList; import java.util.HashMap; import org.apache.fineract.integrationtests.common.Utils; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; public class TemplateIntegrationTest { @@ -41,7 +41,7 @@ public class TemplateIntegrationTest { private ResponseSpecification responseSpec; private RequestSpecification requestSpec; - @Before + @BeforeEach public void setup() { Utils.initializeRESTAssured(); @@ -50,7 +50,7 @@ public class TemplateIntegrationTest { this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build(); } - @Ignore + @Disabled @Test public void test() { @@ -70,13 +70,13 @@ public class TemplateIntegrationTest { final String getrequest2 = Utils.performServerGet(this.requestSpec, this.responseSpec, templateUrlForId, this.RESPONSE_ATTRIBUTE_NAME); - Assert.assertTrue(getrequest2.equals("foo")); + Assertions.assertTrue(getrequest2.equals("foo")); Utils.performServerDelete(this.requestSpec, this.responseSpec, templateUrlForId, ""); get = Utils.performServerGet(this.requestSpec, this.responseSpec, this.GET_TEMPLATES_URL, ""); final int entriesAfterTest = get.size(); - Assert.assertEquals(entriesBeforeTest, entriesAfterTest); + Assertions.assertEquals(entriesBeforeTest, entriesAfterTest); } } diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/UserAdministrationTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/UserAdministrationTest.java index cf11db90a..988818f6b 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/UserAdministrationTest.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/UserAdministrationTest.java @@ -32,10 +32,10 @@ import org.apache.fineract.integrationtests.common.Utils; import org.apache.fineract.integrationtests.common.organisation.StaffHelper; import org.apache.fineract.integrationtests.useradministration.roles.RolesHelper; import org.apache.fineract.integrationtests.useradministration.users.UserHelper; -import org.junit.After; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -49,7 +49,7 @@ public class UserAdministrationTest { return new ResponseSpecBuilder().expectStatusCode(code).build(); } - @Before + @BeforeEach public void setup() { Utils.initializeRESTAssured(); this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build(); @@ -57,7 +57,7 @@ public class UserAdministrationTest { this.responseSpec = expectStatusCode(200); } - @After + @AfterEach public void tearDown() { for(Integer userId : this.transientUsers) { UserHelper.deleteUser(this.requestSpec, this.responseSpec, userId); @@ -69,81 +69,81 @@ public class UserAdministrationTest { public void testCreateNewUserBlocksDuplicateUsername() { final Integer roleId = RolesHelper.createRole(this.requestSpec, this.responseSpec); - Assert.assertNotNull(roleId); + Assertions.assertNotNull(roleId); final Integer staffId = StaffHelper.createStaff(this.requestSpec, this.responseSpec); - Assert.assertNotNull(staffId); + Assertions.assertNotNull(staffId); final Integer userId = (Integer) UserHelper.createUser(this.requestSpec, this.responseSpec, roleId, staffId, "alphabet", "resourceId"); - Assert.assertNotNull(userId); + Assertions.assertNotNull(userId); this.transientUsers.add(userId); final List errors = (List) UserHelper.createUser(this.requestSpec, expectStatusCode(403), roleId, staffId, "alphabet", "errors"); Map reason = (Map) errors.get(0); LOG.info("Reason: {}" , reason.get("defaultUserMessage")); LOG.info("Code: {}" , reason.get("userMessageGlobalisationCode")); - Assert.assertEquals("User with username alphabet already exists.", reason.get("defaultUserMessage")); - Assert.assertEquals("error.msg.user.duplicate.username", reason.get("userMessageGlobalisationCode")); + Assertions.assertEquals("User with username alphabet already exists.", reason.get("defaultUserMessage")); + Assertions.assertEquals("error.msg.user.duplicate.username", reason.get("userMessageGlobalisationCode")); } @Test public void testUpdateUserAcceptsNewOrSameUsername() { final Integer roleId = RolesHelper.createRole(this.requestSpec, this.responseSpec); - Assert.assertNotNull(roleId); + Assertions.assertNotNull(roleId); final Integer staffId = StaffHelper.createStaff(this.requestSpec, this.responseSpec); - Assert.assertNotNull(staffId); + Assertions.assertNotNull(staffId); final Integer userId = (Integer) UserHelper.createUser(this.requestSpec, this.responseSpec, roleId, staffId, "alphabet", "resourceId"); - Assert.assertNotNull(userId); + Assertions.assertNotNull(userId); this.transientUsers.add(userId); final Integer userId2 = (Integer) UserHelper.updateUser(this.requestSpec, this.responseSpec, userId, "renegade", "resourceId"); - Assert.assertNotNull(userId2); + Assertions.assertNotNull(userId2); final Integer userId3 = (Integer) UserHelper.updateUser(this.requestSpec, this.responseSpec, userId, "renegade", "resourceId"); - Assert.assertNotNull(userId3); + Assertions.assertNotNull(userId3); } @Test public void testUpdateUserBlockDuplicateUsername() { final Integer roleId = RolesHelper.createRole(this.requestSpec, this.responseSpec); - Assert.assertNotNull(roleId); + Assertions.assertNotNull(roleId); final Integer staffId = StaffHelper.createStaff(this.requestSpec, this.responseSpec); - Assert.assertNotNull(staffId); + Assertions.assertNotNull(staffId); final Integer userId = (Integer) UserHelper.createUser(this.requestSpec, this.responseSpec, roleId, staffId, "alphabet", "resourceId"); - Assert.assertNotNull(userId); + Assertions.assertNotNull(userId); this.transientUsers.add(userId); final Integer userId2 = (Integer) UserHelper.createUser(this.requestSpec, this.responseSpec, roleId, staffId, "bilingual", "resourceId"); - Assert.assertNotNull(userId2); + Assertions.assertNotNull(userId2); this.transientUsers.add(userId2); final List errors = (List) UserHelper.updateUser(this.requestSpec, expectStatusCode(403), userId2, "alphabet", "errors"); Map reason = (Map) errors.get(0); - Assert.assertEquals("User with username alphabet already exists.", reason.get("defaultUserMessage")); - Assert.assertEquals("error.msg.user.duplicate.username", reason.get("userMessageGlobalisationCode")); + Assertions.assertEquals("User with username alphabet already exists.", reason.get("defaultUserMessage")); + Assertions.assertEquals("error.msg.user.duplicate.username", reason.get("userMessageGlobalisationCode")); } @Test public void testCreateNewUserBlocksDuplicateClientId() { final Integer roleId = RolesHelper.createRole(this.requestSpec, this.responseSpec); - Assert.assertNotNull(roleId); + Assertions.assertNotNull(roleId); final Integer staffId = StaffHelper.createStaff(this.requestSpec, this.responseSpec); - Assert.assertNotNull(staffId); + Assertions.assertNotNull(staffId); final Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientId); + Assertions.assertNotNull(clientId); final Integer userId = (Integer) UserHelper.createUserForSelfService(this.requestSpec, this.responseSpec, roleId, staffId, clientId, "resourceId"); - Assert.assertNotNull(userId); + Assertions.assertNotNull(userId); this.transientUsers.add(userId); final List errors = (List) UserHelper.createUserForSelfService(this.requestSpec, expectStatusCode(403), roleId, staffId, clientId, "errors"); Map reason = (Map) errors.get(0); - Assert.assertEquals("Self Service User Id is already created. Go to Admin->Users to edit or delete the self-service user.", reason.get("defaultUserMessage")); + Assertions.assertEquals("Self Service User Id is already created. Go to Admin->Users to edit or delete the self-service user.", reason.get("defaultUserMessage")); } } diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/WorkingDaysTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/WorkingDaysTest.java index 8cb7690d7..b7098a4b9 100755 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/WorkingDaysTest.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/WorkingDaysTest.java @@ -18,7 +18,7 @@ */ package org.apache.fineract.integrationtests; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import io.restassured.builder.RequestSpecBuilder; import io.restassured.builder.ResponseSpecBuilder; @@ -30,9 +30,9 @@ import java.util.List; import org.apache.fineract.integrationtests.common.CommonConstants; import org.apache.fineract.integrationtests.common.Utils; import org.apache.fineract.integrationtests.common.WorkingDaysHelper; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; @SuppressWarnings({ "rawtypes", "unchecked" }) public class WorkingDaysTest { @@ -41,7 +41,7 @@ public class WorkingDaysTest { private RequestSpecification requestSpec; private ResponseSpecification generalResponseSpec; - @Before + @BeforeEach public void setUp() { Utils.initializeRESTAssured(); this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build(); @@ -54,15 +54,15 @@ public class WorkingDaysTest { @Test public void updateWorkingDays() { HashMap response = (HashMap) WorkingDaysHelper.updateWorkingDays(requestSpec, responseSpec); - Assert.assertNotNull(response.get("resourceId")); + Assertions.assertNotNull(response.get("resourceId")); } @Test public void updateWorkingDaysWithWrongRecurrencePattern() { final List error = (List) WorkingDaysHelper.updateWorkingDaysWithWrongRecurrence(requestSpec, generalResponseSpec, CommonConstants.RESPONSE_ERROR); - assertEquals("Verify wrong recurrence pattern error", "error.msg.recurring.rule.parsing.error", - error.get(0).get("userMessageGlobalisationCode")); + assertEquals("error.msg.recurring.rule.parsing.error", error.get(0).get("userMessageGlobalisationCode"), + "Verify wrong recurrence pattern error"); } } diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/XBRLIntegrationTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/XBRLIntegrationTest.java index d515df0d1..7263481c5 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/XBRLIntegrationTest.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/XBRLIntegrationTest.java @@ -18,7 +18,7 @@ */ package org.apache.fineract.integrationtests; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import io.restassured.builder.RequestSpecBuilder; import io.restassured.builder.ResponseSpecBuilder; @@ -29,8 +29,8 @@ import java.util.ArrayList; import java.util.HashMap; import org.apache.fineract.integrationtests.common.Utils; import org.apache.fineract.integrationtests.common.xbrl.XBRLIntegrationTestHelper; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -42,7 +42,7 @@ public class XBRLIntegrationTest { private XBRLIntegrationTestHelper xbrlHelper; - @Before + @BeforeEach public void setUp() throws Exception { Utils.initializeRESTAssured(); this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build(); @@ -60,7 +60,7 @@ public class XBRLIntegrationTest { private void verifyTaxonomyList(final ArrayList taxonomyList) { LOG.info("--------------------VERIFYING TAXONOMY LIST--------------------------"); - assertEquals("Checking for the 1st taxonomy", "AdministrativeExpense", taxonomyList.get(0).get("name")); + assertEquals("AdministrativeExpense", taxonomyList.get(0).get("name"), "Checking for the 1st taxonomy"); } } diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/bulkimport/importhandler/client/ClientEntityImportHandlerTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/bulkimport/importhandler/client/ClientEntityImportHandlerTest.java index f1d055e3e..0a76d3656 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/bulkimport/importhandler/client/ClientEntityImportHandlerTest.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/bulkimport/importhandler/client/ClientEntityImportHandlerTest.java @@ -45,9 +45,9 @@ import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Workbook; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -57,7 +57,7 @@ public class ClientEntityImportHandlerTest { private ResponseSpecification responseSpec; private RequestSpecification requestSpec; - @Before + @BeforeEach public void setup() { Utils.initializeRESTAssured(); this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build(); @@ -71,12 +71,12 @@ public class ClientEntityImportHandlerTest { //in order to populate helper sheets requestSpec.header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON); Integer outcome_staff_creation = StaffHelper.createStaff(requestSpec,responseSpec); - Assert.assertNotNull("Could not create staff",outcome_staff_creation); + Assertions.assertNotNull(outcome_staff_creation, "Could not create staff"); //in order to populate helper sheets OfficeHelper officeHelper = new OfficeHelper(requestSpec,responseSpec); Integer outcome_office_creation=officeHelper.createOffice("02 May 2000"); - Assert.assertNotNull("Could not create office" ,outcome_office_creation); + Assertions.assertNotNull(outcome_office_creation, "Could not create office"); //in order to populate helper columns in client entity sheet //create constitution @@ -131,7 +131,7 @@ public class ClientEntityImportHandlerTest { String importDocumentId=clientHelper.importClientEntityTemplate(file); file.delete(); - Assert.assertNotNull(importDocumentId); + Assertions.assertNotNull(importDocumentId); //Wait for the creation of output excel Thread.sleep(10000); @@ -146,7 +146,7 @@ public class ClientEntityImportHandlerTest { LOG.info("Output location: {}", location); LOG.info("Failure reason column: {}", row.getCell(ClientEntityConstants.STATUS_COL).getStringCellValue()); - Assert.assertEquals("Imported",row.getCell(ClientEntityConstants.STATUS_COL).getStringCellValue()); + Assertions.assertEquals("Imported",row.getCell(ClientEntityConstants.STATUS_COL).getStringCellValue()); outputWorkbook.close(); } } diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/bulkimport/importhandler/loan/LoanImportHandlerTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/bulkimport/importhandler/loan/LoanImportHandlerTest.java index b136646d1..aa344d5c9 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/bulkimport/importhandler/loan/LoanImportHandlerTest.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/bulkimport/importhandler/loan/LoanImportHandlerTest.java @@ -53,9 +53,9 @@ import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Workbook; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -68,7 +68,7 @@ public class LoanImportHandlerTest { private ResponseSpecification responseSpec; private RequestSpecification requestSpec; - @Before + @BeforeEach public void setup() { Utils.initializeRESTAssured(); this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build(); @@ -83,10 +83,10 @@ public class LoanImportHandlerTest { //in order to populate helper sheets OfficeHelper officeHelper=new OfficeHelper(requestSpec,responseSpec); Integer outcome_office_creation=officeHelper.createOffice("02 May 2000"); - Assert.assertNotNull("Could not create office" ,outcome_office_creation); + Assertions.assertNotNull(outcome_office_creation, "Could not create office"); OfficeDomain office = officeHelper.retrieveOfficeByID(outcome_office_creation); - Assert.assertNotNull("Could not retrieve created office", office); + Assertions.assertNotNull(office, "Could not retrieve created office"); String firstName = Utils.randomNameGenerator("Client_FirstName_", 5); String lastName = Utils.randomNameGenerator("Client_LastName_", 4); @@ -104,38 +104,38 @@ public class LoanImportHandlerTest { Integer outcome_client_creation= Utils.performServerPost(requestSpec, responseSpec, CREATE_CLIENT_URL, new Gson().toJson(clientMap), "clientId"); - Assert.assertNotNull("Could not create client" ,outcome_client_creation); + Assertions.assertNotNull(outcome_client_creation, "Could not create client"); //in order to populate helper sheets Integer outcome_group_creation = GroupHelper.createGroup(requestSpec,responseSpec,true); - Assert.assertNotNull("Could not create group" ,outcome_group_creation); + Assertions.assertNotNull(outcome_group_creation, "Could not create group"); //in order to populate helper sheets Integer outcome_staff_creation = StaffHelper.createStaff(requestSpec,responseSpec); - Assert.assertNotNull("Could not create staff",outcome_staff_creation); + Assertions.assertNotNull(outcome_staff_creation, "Could not create staff"); Map staffMap = StaffHelper.getStaff(requestSpec, responseSpec, outcome_staff_creation); - Assert.assertNotNull("Could not retrieve created staff", staffMap); + Assertions.assertNotNull(staffMap, "Could not retrieve created staff"); LoanTransactionHelper ltHelper=new LoanTransactionHelper(requestSpec,responseSpec); LoanProductTestBuilder loanProductTestBuilder=new LoanProductTestBuilder(); String jsonLoanProduct=loanProductTestBuilder.build(null); Integer outcome_lp_creation=ltHelper.getLoanProductId(jsonLoanProduct); - Assert.assertNotNull("Could not create Loan Product" ,outcome_lp_creation); + Assertions.assertNotNull(outcome_lp_creation, "Could not create Loan Product"); String loanProductStr = ltHelper.getLoanProductDetails(requestSpec, responseSpec, outcome_lp_creation); - Assert.assertNotNull("Could not get created Loan Product" , loanProductStr); + Assertions.assertNotNull("Could not get created Loan Product" , loanProductStr); JsonPath loanProductJson = JsonPath.from(loanProductStr); String fundName = Utils.randomNameGenerator("",9); FundsHelper fh = FundsHelper.create(fundName).externalId("fund-" + fundName).build(); Integer outcome_fund_creation= FundsResourceHandler.createFund(new Gson().toJson(fh),requestSpec,responseSpec); - Assert.assertNotNull("Could not create Fund" ,outcome_fund_creation); + Assertions.assertNotNull(outcome_fund_creation, "Could not create Fund"); String paymentTypeName = PaymentTypeHelper.randomNameGenerator("P_T", 5); String paymentTypeDescription = PaymentTypeHelper.randomNameGenerator("PT_Desc", 15); Integer outcome_payment_creation= PaymentTypeHelper.createPaymentType(requestSpec, responseSpec, paymentTypeName, paymentTypeDescription, true,1); - Assert.assertNotNull("Could not create payment type" ,outcome_payment_creation); + Assertions.assertNotNull(outcome_payment_creation, "Could not create payment type"); LoanTransactionHelper loanTransactionHelper=new LoanTransactionHelper(requestSpec,responseSpec); Workbook workbook=loanTransactionHelper.getLoanWorkbook("dd MMMM yyyy"); @@ -190,7 +190,7 @@ public class LoanImportHandlerTest { String importDocumentId=loanTransactionHelper.importLoanTemplate(file); file.delete(); - Assert.assertNotNull(importDocumentId); + Assertions.assertNotNull(importDocumentId); //Wait for the creation of output excel Thread.sleep(10000); @@ -205,7 +205,7 @@ public class LoanImportHandlerTest { LOG.info("Output location: {}", location); LOG.info("Failure reason column: {}", row.getCell(LoanConstants.FAILURE_REPORT_COL).getStringCellValue()); - Assert.assertEquals("Imported",row.getCell(LoanConstants.STATUS_COL).getStringCellValue()); + Assertions.assertEquals("Imported",row.getCell(LoanConstants.STATUS_COL).getStringCellValue()); outputworkbook.close(); } } diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/bulkimport/importhandler/office/OfficeImportHandlerTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/bulkimport/importhandler/office/OfficeImportHandlerTest.java index 421af9c97..310f4f852 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/bulkimport/importhandler/office/OfficeImportHandlerTest.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/bulkimport/importhandler/office/OfficeImportHandlerTest.java @@ -38,9 +38,9 @@ import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Workbook; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -51,7 +51,7 @@ public class OfficeImportHandlerTest { private ResponseSpecification responseSpec; private RequestSpecification requestSpec; - @Before + @BeforeEach public void setup(){ Utils.initializeRESTAssured(); this.requestSpec=new RequestSpecBuilder().build(); @@ -91,7 +91,7 @@ public class OfficeImportHandlerTest { String importDocumentId=officeHelper.importOfficeTemplate(file); file.delete(); - Assert.assertNotNull(importDocumentId); + Assertions.assertNotNull(importDocumentId); // Wait for the creation of output excel Thread.sleep(10000); @@ -106,7 +106,7 @@ public class OfficeImportHandlerTest { LOG.info("Output location: {}", location); LOG.info("Failure reason column: {}", row.getCell(OfficeConstants.STATUS_COL).getStringCellValue()); - Assert.assertEquals("Imported",row.getCell(OfficeConstants.STATUS_COL).getStringCellValue()); + Assertions.assertEquals("Imported", row.getCell(OfficeConstants.STATUS_COL).getStringCellValue()); outputWorkbook.close(); } } diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/bulkimport/importhandler/savings/SavingsImportHandlerTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/bulkimport/importhandler/savings/SavingsImportHandlerTest.java index 7ee441779..753426f9f 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/bulkimport/importhandler/savings/SavingsImportHandlerTest.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/bulkimport/importhandler/savings/SavingsImportHandlerTest.java @@ -49,9 +49,9 @@ import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Workbook; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -65,7 +65,7 @@ public class SavingsImportHandlerTest { private static final String CREATE_CLIENT_URL = "/fineract-provider/api/v1/clients?" + Utils.TENANT_IDENTIFIER; public static final String DATE_FORMAT = "dd MMMM yyyy"; - @Before + @BeforeEach public void setup() { Utils.initializeRESTAssured(); this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build(); @@ -80,10 +80,10 @@ public class SavingsImportHandlerTest { //in order to populate helper sheets OfficeHelper officeHelper=new OfficeHelper(requestSpec,responseSpec); Integer outcome_office_creation=officeHelper.createOffice("02 May 2000"); - Assert.assertNotNull("Could not create office" ,outcome_office_creation); + Assertions.assertNotNull(outcome_office_creation, "Could not create office"); OfficeDomain office = officeHelper.retrieveOfficeByID(outcome_office_creation); - Assert.assertNotNull("Could not retrieve created office", office); + Assertions.assertNotNull(office, "Could not retrieve created office"); String firstName = Utils.randomNameGenerator("Client_FirstName_", 5); String lastName = Utils.randomNameGenerator("Client_LastName_", 4); @@ -101,23 +101,23 @@ public class SavingsImportHandlerTest { Integer outcome_client_creation= Utils.performServerPost(requestSpec, responseSpec, CREATE_CLIENT_URL, new Gson().toJson(clientMap), "clientId"); - Assert.assertNotNull("Could not create client" ,outcome_client_creation); + Assertions.assertNotNull(outcome_client_creation, "Could not create client"); //in order to populate helper sheets Integer outcome_group_creation=GroupHelper.createGroup(requestSpec,responseSpec,true); - Assert.assertNotNull("Could not create group" ,outcome_group_creation); + Assertions.assertNotNull(outcome_group_creation, "Could not create group"); //in order to populate helper sheets Integer outcome_staff_creation =StaffHelper.createStaff(requestSpec,responseSpec); - Assert.assertNotNull("Could not create staff",outcome_staff_creation); + Assertions.assertNotNull(outcome_staff_creation, "Could not create staff"); Map staffMap = StaffHelper.getStaff(requestSpec, responseSpec, outcome_staff_creation); - Assert.assertNotNull("Could not retrieve created staff", staffMap); + Assertions.assertNotNull(staffMap, "Could not retrieve created staff"); SavingsProductHelper savingsProductHelper = new SavingsProductHelper(); String jsonSavingsProduct=savingsProductHelper.build(); Integer outcome_sp_creaction=SavingsProductHelper.createSavingsProduct(jsonSavingsProduct,requestSpec,responseSpec); - Assert.assertNotNull("Could not create Savings product",outcome_sp_creaction); + Assertions.assertNotNull(outcome_sp_creaction, "Could not create Savings product"); SavingsAccountHelper savingsAccountHelper=new SavingsAccountHelper(requestSpec,responseSpec); Workbook workbook=savingsAccountHelper.getSavingsWorkbook("dd MMMM yyyy"); @@ -164,7 +164,7 @@ public class SavingsImportHandlerTest { String importDocumentId=savingsAccountHelper.importSavingsTemplate(file); file.delete(); - Assert.assertNotNull(importDocumentId); + Assertions.assertNotNull(importDocumentId); //Wait for the creation of output excel Thread.sleep(10000); @@ -179,7 +179,7 @@ public class SavingsImportHandlerTest { LOG.info("Output location: {}", location); LOG.info("Failure reason column: {}", row.getCell(SavingsConstants.STATUS_COL).getStringCellValue()); - Assert.assertEquals("Imported",row.getCell(SavingsConstants.STATUS_COL).getStringCellValue()); + Assertions.assertEquals("Imported",row.getCell(SavingsConstants.STATUS_COL).getStringCellValue()); Outputworkbook.close(); } } diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/bulkimport/populator/client/ClientEntityWorkbookPopulatorTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/bulkimport/populator/client/ClientEntityWorkbookPopulatorTest.java index 47e13b80d..24369541e 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/bulkimport/populator/client/ClientEntityWorkbookPopulatorTest.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/bulkimport/populator/client/ClientEntityWorkbookPopulatorTest.java @@ -34,16 +34,16 @@ import org.apache.fineract.integrationtests.common.organisation.StaffHelper; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Workbook; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class ClientEntityWorkbookPopulatorTest { private ResponseSpecification responseSpec; private RequestSpecification requestSpec; - @Before + @BeforeEach public void setup(){ Utils.initializeRESTAssured(); this.requestSpec=new RequestSpecBuilder().build(); @@ -63,20 +63,20 @@ public class ClientEntityWorkbookPopulatorTest { StaffHelper staffHelper=new StaffHelper(); requestSpec.header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON); Integer outcome_staff_creation =staffHelper.createStaff(requestSpec,responseSpec); - Assert.assertNotNull("Could not create staff",outcome_staff_creation); + Assertions.assertNotNull(outcome_staff_creation, "Could not create staff"); //in order to populate helper sheets OfficeHelper officeHelper=new OfficeHelper(requestSpec,responseSpec); Integer outcome_office_creation=officeHelper.createOffice("02 May 2000"); - Assert.assertNotNull("Could not create office" ,outcome_office_creation); + Assertions.assertNotNull(outcome_office_creation, "Could not create office"); ClientHelper clientHelper=new ClientHelper(requestSpec,responseSpec); Workbook workbook=clientHelper.getClientEntityWorkbook(GlobalEntityType.CLIENTS_ENTTTY,"dd MMMM yyyy"); Sheet officeSheet=workbook.getSheet(TemplatePopulateImportConstants.OFFICE_SHEET_NAME); Row firstOfficeRow=officeSheet.getRow(1); - Assert.assertNotNull("No offices found for given OfficeId ",firstOfficeRow.getCell(1)); + Assertions.assertNotNull(firstOfficeRow.getCell(1), "No offices found for given OfficeId "); Sheet staffSheet=workbook.getSheet(TemplatePopulateImportConstants.STAFF_SHEET_NAME); Row firstStaffRow=staffSheet.getRow(1); - Assert.assertNotNull("No staff found for given staffId",firstStaffRow.getCell(1)); + Assertions.assertNotNull(firstStaffRow.getCell(1), "No staff found for given staffId"); } } diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/bulkimport/populator/loan/LoanWorkbookPopulatorTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/bulkimport/populator/loan/LoanWorkbookPopulatorTest.java index ff25bf421..9c67c4f2b 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/bulkimport/populator/loan/LoanWorkbookPopulatorTest.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/bulkimport/populator/loan/LoanWorkbookPopulatorTest.java @@ -39,16 +39,16 @@ import org.apache.fineract.integrationtests.common.organisation.StaffHelper; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Workbook; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class LoanWorkbookPopulatorTest { private ResponseSpecification responseSpec; private RequestSpecification requestSpec; - @Before + @BeforeEach public void setup(){ Utils.initializeRESTAssured(); this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build(); @@ -61,35 +61,35 @@ public class LoanWorkbookPopulatorTest { //in order to populate helper sheets OfficeHelper officeHelper=new OfficeHelper(requestSpec,responseSpec); Integer outcome_office_creation=officeHelper.createOffice("02 May 2000"); - Assert.assertNotNull("Could not create office" ,outcome_office_creation); + Assertions.assertNotNull(outcome_office_creation, "Could not create office"); //in order to populate helper sheets ClientHelper clientHelper=new ClientHelper(requestSpec,responseSpec); Integer outcome_client_creation=clientHelper.createClient(requestSpec,responseSpec); - Assert.assertNotNull("Could not create client" ,outcome_client_creation); + Assertions.assertNotNull(outcome_client_creation, "Could not create client"); //in order to populate helper sheets GroupHelper groupHelper=new GroupHelper(requestSpec,responseSpec); Integer outcome_group_creation=groupHelper.createGroup(requestSpec,responseSpec,true); - Assert.assertNotNull("Could not create group" ,outcome_group_creation); + Assertions.assertNotNull(outcome_group_creation, "Could not create group"); //in order to populate helper sheets StaffHelper staffHelper=new StaffHelper(); Integer outcome_staff_creation =staffHelper.createStaff(requestSpec,responseSpec); - Assert.assertNotNull("Could not create staff",outcome_staff_creation); + Assertions.assertNotNull(outcome_staff_creation, "Could not create staff"); LoanTransactionHelper loanTransactionHelper=new LoanTransactionHelper(requestSpec,responseSpec); LoanProductTestBuilder loanProductTestBuilder=new LoanProductTestBuilder(); String jsonLoanProduct=loanProductTestBuilder.build(null); Integer outcome_lp_creaion=loanTransactionHelper.getLoanProductId(jsonLoanProduct); - Assert.assertNotNull("Could not create Loan Product" ,outcome_lp_creaion); + Assertions.assertNotNull(outcome_lp_creaion, "Could not create Loan Product"); FundsResourceHandler fundsResourceHandler=new FundsResourceHandler(); String jsonFund="{\n" + "\t\"name\": \""+Utils.randomNameGenerator("Fund_Name",9)+"\"\n" + "}"; Integer outcome_fund_creation=fundsResourceHandler.createFund(jsonFund,requestSpec,responseSpec); - Assert.assertNotNull("Could not create Fund" ,outcome_fund_creation); + Assertions.assertNotNull(outcome_fund_creation, "Could not create Fund"); PaymentTypeHelper paymentTypeHelper=new PaymentTypeHelper(); String name = PaymentTypeHelper.randomNameGenerator("P_T", 5); @@ -97,32 +97,32 @@ public class LoanWorkbookPopulatorTest { Boolean isCashPayment = true; Integer position = 1; Integer outcome_payment_creation= paymentTypeHelper.createPaymentType(requestSpec, responseSpec,name,description,isCashPayment,position); - Assert.assertNotNull("Could not create payment type" ,outcome_payment_creation); + Assertions.assertNotNull(outcome_payment_creation, "Could not create payment type"); Workbook workbook=loanTransactionHelper.getLoanWorkbook("dd MMMM yyyy"); Sheet officeSheet=workbook.getSheet(TemplatePopulateImportConstants.OFFICE_SHEET_NAME); Row firstOfficeRow=officeSheet.getRow(1); - Assert.assertNotNull("No offices found ",firstOfficeRow.getCell(1)); + Assertions.assertNotNull(firstOfficeRow.getCell(1), "No offices found "); Sheet clientSheet=workbook.getSheet(TemplatePopulateImportConstants.CLIENT_SHEET_NAME); Row firstClientRow=clientSheet.getRow(1); - Assert.assertNotNull("No clients found ",firstClientRow.getCell(1)); + Assertions.assertNotNull(firstClientRow.getCell(1), "No clients found "); Sheet groupSheet=workbook.getSheet(TemplatePopulateImportConstants.GROUP_SHEET_NAME); Row firstGroupRow=groupSheet.getRow(1); - Assert.assertNotNull("No groups found ",firstGroupRow.getCell(1)); + Assertions.assertNotNull(firstGroupRow.getCell(1), "No groups found "); Sheet staffSheet=workbook.getSheet(TemplatePopulateImportConstants.STAFF_SHEET_NAME); Row firstStaffRow=staffSheet.getRow(1); - Assert.assertNotNull("No staff found ",firstStaffRow.getCell(1)); + Assertions.assertNotNull(firstStaffRow.getCell(1), "No staff found "); Sheet productSheet=workbook.getSheet(TemplatePopulateImportConstants.PRODUCT_SHEET_NAME); Row firstProductRow=productSheet.getRow(1); - Assert.assertNotNull("No products found ",firstProductRow.getCell(1)); + Assertions.assertNotNull(firstProductRow.getCell(1), "No products found "); Sheet extrasSheet=workbook.getSheet(TemplatePopulateImportConstants.EXTRAS_SHEET_NAME); Row firstExtrasRow=extrasSheet.getRow(1); - Assert.assertNotNull("No Extras found ",firstExtrasRow.getCell(1)); + Assertions.assertNotNull(firstExtrasRow.getCell(1), "No Extras found "); } } diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/bulkimport/populator/office/OfficeWorkBookPopulatorTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/bulkimport/populator/office/OfficeWorkBookPopulatorTest.java index 149529cbc..457991c5c 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/bulkimport/populator/office/OfficeWorkBookPopulatorTest.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/bulkimport/populator/office/OfficeWorkBookPopulatorTest.java @@ -30,15 +30,15 @@ import org.apache.fineract.integrationtests.common.Utils; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Workbook; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class OfficeWorkBookPopulatorTest { private ResponseSpecification responseSpec; private RequestSpecification requestSpec; - @Before + @BeforeEach public void setup(){ Utils.initializeRESTAssured(); this.requestSpec=new RequestSpecBuilder().build(); @@ -56,8 +56,8 @@ public class OfficeWorkBookPopulatorTest { Workbook workbook=officeHelper.getOfficeWorkBook("dd MMMM yyyy"); Sheet sheet=workbook.getSheet(TemplatePopulateImportConstants.OFFICE_SHEET_NAME); Row firstRow= sheet.getRow(1); - Assert.assertNotNull("No parent offices found",firstRow.getCell(OfficeConstants.LOOKUP_OFFICE_COL).getStringCellValue()); - Assert.assertEquals(1,firstRow.getCell(OfficeConstants.LOOKUP_OFFICE_ID_COL).getNumericCellValue(),0.0); + Assertions.assertNotNull("No parent offices found", firstRow.getCell(OfficeConstants.LOOKUP_OFFICE_COL).getStringCellValue()); + Assertions.assertEquals(1, firstRow.getCell(OfficeConstants.LOOKUP_OFFICE_ID_COL).getNumericCellValue(), 0.0); } } diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/bulkimport/populator/savings/SavingsWorkbookPopulateTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/bulkimport/populator/savings/SavingsWorkbookPopulateTest.java index 585ce29c6..4a212476e 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/bulkimport/populator/savings/SavingsWorkbookPopulateTest.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/bulkimport/populator/savings/SavingsWorkbookPopulateTest.java @@ -37,15 +37,15 @@ import org.apache.fineract.integrationtests.common.savings.SavingsProductHelper; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Workbook; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class SavingsWorkbookPopulateTest { private ResponseSpecification responseSpec; private RequestSpecification requestSpec; - @Before + @BeforeEach public void setup(){ Utils.initializeRESTAssured(); this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build(); @@ -59,50 +59,50 @@ public class SavingsWorkbookPopulateTest { //in order to populate helper sheets OfficeHelper officeHelper=new OfficeHelper(requestSpec,responseSpec); Integer outcome_office_creation=officeHelper.createOffice("02 May 2000"); - Assert.assertNotNull("Could not create office" ,outcome_office_creation); + Assertions.assertNotNull(outcome_office_creation, "Could not create office"); //in order to populate helper sheets ClientHelper clientHelper=new ClientHelper(requestSpec,responseSpec); Integer outcome_client_creation=clientHelper.createClient(requestSpec,responseSpec); - Assert.assertNotNull("Could not create client" ,outcome_client_creation); + Assertions.assertNotNull(outcome_client_creation, "Could not create client"); //in order to populate helper sheets GroupHelper groupHelper=new GroupHelper(requestSpec,responseSpec); Integer outcome_group_creation=groupHelper.createGroup(requestSpec,responseSpec,true); - Assert.assertNotNull("Could not create group" ,outcome_group_creation); + Assertions.assertNotNull(outcome_group_creation, "Could not create group"); //in order to populate helper sheets StaffHelper staffHelper=new StaffHelper(); Integer outcome_staff_creation =staffHelper.createStaff(requestSpec,responseSpec); - Assert.assertNotNull("Could not create staff",outcome_staff_creation); + Assertions.assertNotNull(outcome_staff_creation, "Could not create staff"); SavingsProductHelper savingsProductHelper=new SavingsProductHelper(); String jsonSavingsProduct=savingsProductHelper.build(); Integer outcome_sp_creaction=savingsProductHelper.createSavingsProduct(jsonSavingsProduct,requestSpec,responseSpec); - Assert.assertNotNull("Could not create Savings product",outcome_sp_creaction); + Assertions.assertNotNull(outcome_sp_creaction, "Could not create Savings product"); SavingsAccountHelper savingsAccountHelper=new SavingsAccountHelper(requestSpec,responseSpec); Workbook workbook=savingsAccountHelper.getSavingsWorkbook("dd MMMM yyyy"); Sheet officeSheet=workbook.getSheet(TemplatePopulateImportConstants.OFFICE_SHEET_NAME); Row firstOfficeRow=officeSheet.getRow(1); - Assert.assertNotNull("No offices found ",firstOfficeRow.getCell(1)); + Assertions.assertNotNull(firstOfficeRow.getCell(1), "No offices found "); Sheet clientSheet=workbook.getSheet(TemplatePopulateImportConstants.CLIENT_SHEET_NAME); Row firstClientRow=clientSheet.getRow(1); - Assert.assertNotNull("No clients found ",firstClientRow.getCell(1)); + Assertions.assertNotNull(firstClientRow.getCell(1), "No clients found "); Sheet groupSheet=workbook.getSheet(TemplatePopulateImportConstants.GROUP_SHEET_NAME); Row firstGroupRow=groupSheet.getRow(1); - Assert.assertNotNull("No groups found ",firstGroupRow.getCell(1)); + Assertions.assertNotNull(firstGroupRow.getCell(1), "No groups found "); Sheet staffSheet=workbook.getSheet(TemplatePopulateImportConstants.STAFF_SHEET_NAME); Row firstStaffRow=staffSheet.getRow(1); - Assert.assertNotNull("No staff found ",firstStaffRow.getCell(1)); + Assertions.assertNotNull(firstStaffRow.getCell(1), "No staff found "); Sheet productSheet=workbook.getSheet(TemplatePopulateImportConstants.PRODUCT_SHEET_NAME); Row firstProductRow=productSheet.getRow(1); - Assert.assertNotNull("No products found ",firstProductRow.getCell(1)); + Assertions.assertNotNull(firstProductRow.getCell(1), "No products found "); } } diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/BatchHelper.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/BatchHelper.java index 72e35d59c..161465085 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/BatchHelper.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/BatchHelper.java @@ -27,7 +27,7 @@ import java.util.List; import java.util.Map; import org.apache.fineract.batch.domain.BatchRequest; import org.apache.fineract.batch.domain.BatchResponse; -import org.junit.Assert; +import org.junit.jupiter.api.Assertions; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -129,8 +129,8 @@ public class BatchHelper { jsonifiedRequest); // Verifies that the response result is there - Assert.assertNotNull(response); - Assert.assertTrue(response.size() > 0); + Assertions.assertNotNull(response); + Assertions.assertTrue(response.size() > 0); return response; } @@ -427,6 +427,6 @@ public class BatchHelper { LOG.info("------------------------------CHECK CLIENT DETAILS------------------------------------\n"); final String CLIENT_URL = "/fineract-provider/api/v1/clients?externalId=" + externalId + "&" + Utils.TENANT_IDENTIFIER; final Integer responseRecords = Utils.performServerGet(requestSpec, responseSpec, CLIENT_URL, "totalFilteredRecords"); - Assert.assertEquals("No records found with given externalId", (long) 0, (long) responseRecords); + Assertions.assertEquals((long) 0, (long) responseRecords, "No records found with given externalId"); } } diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/CalendarHelper.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/CalendarHelper.java index d04c97af5..e55b1bdf4 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/CalendarHelper.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/CalendarHelper.java @@ -19,7 +19,7 @@ package org.apache.fineract.integrationtests.common; import static io.restassured.path.json.JsonPath.from; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import com.google.gson.Gson; import io.restassured.specification.RequestSpecification; @@ -87,7 +87,7 @@ public class CalendarHelper { final String responseCalendarDetailsinJSON = Utils.performServerGet(requestSpec, responseSpec, CLIENT_URL, "collectionMeetingCalendar"); final Integer responseCalendarId = from(responseCalendarDetailsinJSON).get("id"); - assertEquals("ERROR IN CREATING THE CALENDAR", generatedCalendarId, responseCalendarId); + assertEquals( generatedCalendarId, responseCalendarId, "ERROR IN CREATING THE CALENDAR"); } public static Integer createMeetingForGroup(final RequestSpecification requestSpec, final ResponseSpecification responseSpec, diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/CenterHelper.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/CenterHelper.java index e1490c3e2..382d5f47d 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/CenterHelper.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/CenterHelper.java @@ -18,7 +18,7 @@ */ package org.apache.fineract.integrationtests.common; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import com.google.common.base.Strings; import com.google.common.reflect.TypeToken; @@ -169,7 +169,7 @@ public class CenterHelper { LOG.info("------------------------------CHECK CENTER DETAILS------------------------------------\n"); final String CENTER_URL = "/fineract-provider/api/v1/centers/" + generatedCenterID + "?" + Utils.TENANT_IDENTIFIER; final Integer responseCenterID = Utils.performServerGet(requestSpec, responseSpec, CENTER_URL, "id"); - assertEquals("ERROR IN CREATING THE CENTER", generatedCenterID, responseCenterID); + assertEquals(generatedCenterID, responseCenterID, "ERROR IN CREATING THE CENTER"); } public static void verifyCenterActivatedOnServer(final RequestSpecification requestSpec, final ResponseSpecification responseSpec, @@ -177,7 +177,7 @@ public class CenterHelper { LOG.info("------------------------------CHECK CENTER STATUS------------------------------------\n"); final String CENTER_URL = "/fineract-provider/api/v1/centers/" + generatedCenterID + "?" + Utils.TENANT_IDENTIFIER; final Boolean responseCenterStatus = Utils.performServerGet(requestSpec, responseSpec, CENTER_URL, "active"); - assertEquals("ERROR IN ACTIVATING THE CENTER", generatedCenterStatus, responseCenterStatus); + assertEquals(generatedCenterStatus, responseCenterStatus, "ERROR IN ACTIVATING THE CENTER"); } public static Integer activateCenter(final RequestSpecification requestSpec, final ResponseSpecification responseSpec, diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/ClientChargesTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/ClientChargesTest.java index e75d77d9b..407a2a2b0 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/ClientChargesTest.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/ClientChargesTest.java @@ -27,9 +27,9 @@ import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Calendar; import org.apache.fineract.integrationtests.common.charges.ChargesHelper; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; /** * @@ -45,7 +45,7 @@ public class ClientChargesTest { private ResponseSpecification responseSpec; private RequestSpecification requestSpec; - @Before + @BeforeEach public void setup() { Utils.initializeRESTAssured(); this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build(); @@ -59,11 +59,11 @@ public class ClientChargesTest { // Creates clientCharge final Integer chargeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec, ChargesHelper.getChargeSpecifiedDueDateJSON()); - Assert.assertNotNull(chargeId); + Assertions.assertNotNull(chargeId); // creates client with activation date final Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec, "01 October 2011"); - Assert.assertNotNull(clientId); + Assertions.assertNotNull(clientId); /** * create a charge for loan and try to associate to client created in @@ -73,11 +73,11 @@ public class ClientChargesTest { */ final Integer loanChargeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec, ChargesHelper.getLoanSpecifiedDueDateJSON()); - Assert.assertNotNull(loanChargeId); + Assertions.assertNotNull(loanChargeId); ResponseSpecification responseLoanChargeFailure = new ResponseSpecBuilder().expectStatusCode(403).build(); final Integer clientLoanChargeId = ClientHelper.addChargesForClient(this.requestSpec, responseLoanChargeFailure, clientId, ClientHelper.getSpecifiedDueDateChargesClientAsJSON(loanChargeId.toString(), "29 October 2011")); - Assert.assertNull(clientLoanChargeId); + Assertions.assertNull(clientLoanChargeId); /** * associates a clientCharge to a client and pay client charge for 10 @@ -85,10 +85,10 @@ public class ClientChargesTest { **/ final Integer clientChargeId = ClientHelper.addChargesForClient(this.requestSpec, this.responseSpec, clientId, ClientHelper.getSpecifiedDueDateChargesClientAsJSON(chargeId.toString(), "29 October 2011")); - Assert.assertNotNull(clientChargeId); + Assertions.assertNotNull(clientChargeId); final String clientChargePaidTransactionId = ClientHelper.payChargesForClients(this.requestSpec, this.responseSpec, clientId, clientChargeId, ClientHelper.getPayChargeJSON("25 AUGUST 2015", "10")); - Assert.assertNotNull(clientChargePaidTransactionId); + Assertions.assertNotNull(clientChargePaidTransactionId); isValidOutstandingAmount(ClientHelper.getClientCharge(requestSpec, responseSpec, clientId.toString(), clientChargeId.toString()), (float) 190.0); @@ -98,7 +98,7 @@ public class ClientChargesTest { */ final Integer undoTrxnId = ClientHelper.revertClientChargeTransaction(this.requestSpec, this.responseSpec, clientId.toString(), clientChargePaidTransactionId); - Assert.assertNotNull(undoTrxnId); + Assertions.assertNotNull(undoTrxnId); isReversedTransaction(clientId.toString(), undoTrxnId.toString()); /** * Now pay client charge for 20 USD and ensure the outstanding amount is @@ -111,12 +111,12 @@ public class ClientChargesTest { today.add(Calendar.DAY_OF_MONTH, 2); final String responseId_futureDate_failure = ClientHelper.payChargesForClients(this.requestSpec, responseSpecFailure, clientId, clientChargeId, ClientHelper.getPayChargeJSON(dateFormat.format(today.getTime()), "20")); - Assert.assertNull(responseId_futureDate_failure); + Assertions.assertNull(responseId_futureDate_failure); // waived off the outstanding client charge final String waiveOffClientChargeTransactionId = ClientHelper.waiveChargesForClients(this.requestSpec, this.responseSpec, clientId, clientChargeId, ClientHelper.getWaiveChargeJSON("100", clientChargeId.toString())); - Assert.assertNotNull(waiveOffClientChargeTransactionId); + Assertions.assertNotNull(waiveOffClientChargeTransactionId); /** * Revert the waived off client charge transaction by passing the @@ -125,7 +125,7 @@ public class ClientChargesTest { */ final Integer undoWaiveTrxnId = ClientHelper.revertClientChargeTransaction(this.requestSpec, this.responseSpec, clientId.toString(), waiveOffClientChargeTransactionId); - Assert.assertNotNull(undoWaiveTrxnId); + Assertions.assertNotNull(undoWaiveTrxnId); isReversedTransaction(clientId.toString(), undoWaiveTrxnId.toString()); /** * pay client charge before client activation date and ensured its a @@ -134,21 +134,21 @@ public class ClientChargesTest { final String responseId_activationDate_failure = ClientHelper.payChargesForClients(this.requestSpec, responseSpecFailure, clientId, clientChargeId, ClientHelper.getPayChargeJSON("30 September 2011", "20")); - Assert.assertNull(responseId_activationDate_failure); + Assertions.assertNull(responseId_activationDate_failure); /** * pay client charge more than outstanding amount amount and ensured its * a failure test case */ final String responseId_moreAmount_failure = ClientHelper.payChargesForClients(this.requestSpec, responseSpecFailure, clientId, clientChargeId, ClientHelper.getPayChargeJSON("25 AUGUST 2015", "300")); - Assert.assertNull(responseId_moreAmount_failure); + Assertions.assertNull(responseId_moreAmount_failure); /** * pay client charge for 10 USD and ensure outstanding amount is updated * properly */ final String chargePaid_responseId = ClientHelper.payChargesForClients(this.requestSpec, this.responseSpec, clientId, clientChargeId, ClientHelper.getPayChargeJSON("25 AUGUST 2015", "100")); - Assert.assertNotNull(chargePaid_responseId); + Assertions.assertNotNull(chargePaid_responseId); isValidOutstandingAmount(ClientHelper.getClientCharge(requestSpec, responseSpec, clientId.toString(), clientChargeId.toString()), (float) 100.0); @@ -164,7 +164,7 @@ public class ClientChargesTest { private void isReversedTransaction(String clientId, String transactionId) { final Boolean isReversed = ClientHelper.getClientTransactions(this.requestSpec, this.responseSpec, clientId.toString(), transactionId); - Assert.assertTrue(isReversed); + Assertions.assertTrue(isReversed); } /** @@ -175,7 +175,7 @@ public class ClientChargesTest { * @param expectedAmount */ private void isValidOutstandingAmount(Object outStandingAmount, Object expectedAmount) { - Assert.assertEquals(expectedAmount, (float) outStandingAmount); + Assertions.assertEquals(expectedAmount, (float) outStandingAmount); } } diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/ClientHelper.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/ClientHelper.java index b66b47e87..5e61ae3ba 100755 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/ClientHelper.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/ClientHelper.java @@ -18,7 +18,7 @@ */ package org.apache.fineract.integrationtests.common; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import com.google.gson.Gson; import io.restassured.specification.RequestSpecification; @@ -312,7 +312,7 @@ public class ClientHelper { final String CLIENT_URL = "/fineract-provider/api/v1/clients/" + generatedClientID + "?" + Utils.TENANT_IDENTIFIER; final Integer responseClientID = Utils.performServerGet(requestSpec, responseSpec, CLIENT_URL, "id"); - assertEquals("ERROR IN CREATING THE CLIENT", generatedClientID, responseClientID); + assertEquals(generatedClientID, responseClientID, "ERROR IN CREATING THE CLIENT"); } public static Object getClient(final RequestSpecification requestSpec, final ResponseSpecification responseSpec, diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/GlobalConfigurationHelper.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/GlobalConfigurationHelper.java index 1e0e754c3..a1b3b2f85 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/GlobalConfigurationHelper.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/GlobalConfigurationHelper.java @@ -23,7 +23,7 @@ import io.restassured.specification.RequestSpecification; import io.restassured.specification.ResponseSpecification; import java.util.ArrayList; import java.util.HashMap; -import org.junit.Assert; +import org.junit.jupiter.api.Assertions; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -81,20 +81,20 @@ public class GlobalConfigurationHelper { ArrayList actualGlobalConfigurations = getAllGlobalConfigurations(requestSpec, responseSpec); // There are currently 27 global configurations. - Assert.assertEquals(28, expectedGlobalConfigurations.size()); - Assert.assertEquals(28, actualGlobalConfigurations.size()); + Assertions.assertEquals(28, expectedGlobalConfigurations.size()); + Assertions.assertEquals(28, actualGlobalConfigurations.size()); for (int i = 0; i < expectedGlobalConfigurations.size(); i++) { HashMap expectedGlobalConfiguration = expectedGlobalConfigurations.get(i); HashMap actualGlobalConfiguration = actualGlobalConfigurations.get(i); - Assert.assertEquals(expectedGlobalConfiguration.get("id"), actualGlobalConfiguration.get("id")); + Assertions.assertEquals(expectedGlobalConfiguration.get("id"), actualGlobalConfiguration.get("id")); final String assertionFailedMessage = "Assertion failed for configID:<" + expectedGlobalConfiguration.get("id") + ">"; - Assert.assertEquals(assertionFailedMessage, expectedGlobalConfiguration.get("name"), actualGlobalConfiguration.get("name")); - Assert.assertEquals(assertionFailedMessage, expectedGlobalConfiguration.get("value"), actualGlobalConfiguration.get("value")); - Assert.assertEquals(assertionFailedMessage, expectedGlobalConfiguration.get("enabled"), actualGlobalConfiguration.get("enabled")); - Assert.assertEquals(assertionFailedMessage, expectedGlobalConfiguration.get("trapDoor"), actualGlobalConfiguration.get("trapDoor")); + Assertions.assertEquals(expectedGlobalConfiguration.get("name"), actualGlobalConfiguration.get("name"), assertionFailedMessage); + Assertions.assertEquals(expectedGlobalConfiguration.get("value"), actualGlobalConfiguration.get("value"), assertionFailedMessage); + Assertions.assertEquals(expectedGlobalConfiguration.get("enabled"), actualGlobalConfiguration.get("enabled"), assertionFailedMessage); + Assertions.assertEquals(expectedGlobalConfiguration.get("trapDoor"), actualGlobalConfiguration.get("trapDoor"), assertionFailedMessage); } } diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/GroupHelper.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/GroupHelper.java index 7a286b63f..cd97f166d 100755 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/GroupHelper.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/GroupHelper.java @@ -18,9 +18,9 @@ */ package org.apache.fineract.integrationtests.common; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import com.google.common.base.Strings; import com.google.gson.Gson; @@ -193,7 +193,7 @@ public class GroupHelper { LOG.info("------------------------------CHECK GROUP DETAILS------------------------------------\n"); final String GROUP_URL = "/fineract-provider/api/v1/groups/" + generatedGroupID + "?" + Utils.TENANT_IDENTIFIER; final Integer responseGroupID = Utils.performServerGet(requestSpec, responseSpec, GROUP_URL, "id"); - assertEquals("ERROR IN CREATING THE GROUP", generatedGroupID, responseGroupID); + assertEquals(generatedGroupID, responseGroupID, "ERROR IN CREATING THE GROUP"); } public static void verifyGroupDetails(final RequestSpecification requestSpec, final ResponseSpecification responseSpec, @@ -201,7 +201,7 @@ public class GroupHelper { LOG.info("------------------------------CHECK GROUP DETAILS------------------------------------\n"); final String GROUP_URL = "/fineract-provider/api/v1/groups/" + generatedGroupID + "?" + Utils.TENANT_IDENTIFIER; final String responseValue = Utils.performServerGet(requestSpec, responseSpec, GROUP_URL, field); - assertEquals("ERROR IN CREATING THE GROUP", expectedValue, responseValue); + assertEquals(expectedValue, responseValue, "ERROR IN CREATING THE GROUP"); } public static void verifyGroupActivatedOnServer(final RequestSpecification requestSpec, final ResponseSpecification responseSpec, @@ -209,7 +209,7 @@ public class GroupHelper { LOG.info("------------------------------CHECK GROUP STATUS------------------------------------\n"); final String GROUP_URL = "/fineract-provider/api/v1/groups/" + generatedGroupID + "?" + Utils.TENANT_IDENTIFIER; final Boolean responseGroupStatus = Utils.performServerGet(requestSpec, responseSpec, GROUP_URL, "active"); - assertEquals("ERROR IN ACTIVATING THE GROUP", generatedGroupStatus, responseGroupStatus); + assertEquals(generatedGroupStatus, responseGroupStatus, "ERROR IN ACTIVATING THE GROUP"); } public static void verifyGroupMembers(final RequestSpecification requestSpec, final ResponseSpecification responseSpec, @@ -220,7 +220,7 @@ public class GroupHelper { + "?associations=clientMembers&" + Utils.TENANT_IDENTIFIER; list = Utils.performServerGet(requestSpec, responseSpec, GROUP_URL, "clientMembers"); LOG.debug("the list of verifyEmptyGroupMembers : {} ", list); - assertTrue("ERROR IN GROUP MEMBER", list.toString().contains("id=" + groupMember.toString())); + assertTrue(list.toString().contains("id=" + groupMember.toString()), "ERROR IN GROUP MEMBER"); } public static void verifyEmptyGroupMembers(final RequestSpecification requestSpec, final ResponseSpecification responseSpec, @@ -231,7 +231,7 @@ public class GroupHelper { + "?associations=clientMembers&" + Utils.TENANT_IDENTIFIER; list = Utils.performServerGet(requestSpec, responseSpec, GROUP_URL, "clientMembers"); LOG.debug("the list of verifyEmptyGroupMembers : {} ", list); - assertEquals("GROUP MEMBER LIST NOT EMPTY", list, null); + assertEquals(list, null, "GROUP MEMBER LIST NOT EMPTY"); } public static void verifyGroupDeleted(final RequestSpecification requestSpec, final ResponseSpecification responseSpec, @@ -240,7 +240,7 @@ public class GroupHelper { LOG.info("------------------------------CHECK GROUP DELETED------------------------------------\n"); final String GROUP_URL = "/fineract-provider/api/v1/groups/?" + Utils.TENANT_IDENTIFIER; list = Utils.performServerGet(requestSpec, responseSpec, GROUP_URL, "pageItems"); - assertFalse("GROUP NOT DELETED", list.toString().contains("id=" + generatedGroupID.toString())); + assertFalse(list.toString().contains("id=" + generatedGroupID.toString()), "GROUP NOT DELETED"); } //Glim_Gsim_testing diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/HookHelper.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/HookHelper.java index 84fb3ee83..e5fac8970 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/HookHelper.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/HookHelper.java @@ -18,7 +18,7 @@ */ package org.apache.fineract.integrationtests.common; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import com.google.gson.Gson; import io.restassured.builder.ResponseSpecBuilder; diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/LoanRescheduleRequestHelper.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/LoanRescheduleRequestHelper.java index 84424375d..5b9c315c2 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/LoanRescheduleRequestHelper.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/LoanRescheduleRequestHelper.java @@ -18,7 +18,7 @@ */ package org.apache.fineract.integrationtests.common; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import io.restassured.specification.RequestSpecification; import io.restassured.specification.ResponseSpecification; @@ -61,6 +61,6 @@ public class LoanRescheduleRequestHelper { final String URL = LOAN_RESCHEDULE_REQUEST_URL + "/" + requestId + "?" + Utils.TENANT_IDENTIFIER; final Integer id = Utils.performServerGet(requestSpec, responseSpec, URL, "id"); - assertEquals("ERROR IN CREATING LOAN RESCHEDULE REQUEST", requestId, id); + assertEquals(requestId, id, "ERROR IN CREATING LOAN RESCHEDULE REQUES"); } } diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/PaymentTypeHelper.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/PaymentTypeHelper.java index f933b1fca..3d7e28e79 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/PaymentTypeHelper.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/PaymentTypeHelper.java @@ -18,7 +18,7 @@ */ package org.apache.fineract.integrationtests.common; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import com.google.common.reflect.TypeToken; import com.google.gson.Gson; @@ -67,7 +67,7 @@ public class PaymentTypeHelper { + Utils.TENANT_IDENTIFIER; final Integer responsePaymentTypeID = Utils.performServerGet(requestSpec, responseSpec, GET_PAYMENTTYPE_URL, "id"); - assertEquals("ERROR IN CREATING THE PAYMENT TYPE", generatedPaymentTypeID, responsePaymentTypeID); + assertEquals(generatedPaymentTypeID, responsePaymentTypeID, "ERROR IN CREATING THE PAYMENT TYPE"); } public static PaymentTypeDomain retrieveById(RequestSpecification requestSpec, ResponseSpecification responseSpec, diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/ProvisioningIntegrationTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/ProvisioningIntegrationTest.java index e93614a9c..f2cbdaa98 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/ProvisioningIntegrationTest.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/ProvisioningIntegrationTest.java @@ -40,10 +40,10 @@ import org.apache.fineract.integrationtests.common.loans.LoanStatusChecker; import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper; import org.apache.fineract.integrationtests.common.provisioning.ProvisioningHelper; import org.apache.fineract.integrationtests.common.provisioning.ProvisioningTransactionHelper; -import org.junit.Assert; -import org.junit.Assume; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Assumptions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -58,7 +58,7 @@ public class ProvisioningIntegrationTest { private AccountHelper accountHelper; private LoanTransactionHelper loanTransactionHelper; - @Before + @BeforeEach public void setup() throws ParseException{ Utils.initializeRESTAssured(); this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build(); @@ -66,7 +66,7 @@ public class ProvisioningIntegrationTest { this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build(); this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec); this.accountHelper = new AccountHelper(this.requestSpec, this.responseSpec); - Assume.assumeTrue(!isAlreadyProvisioningEntriesCreated()); + Assumptions.assumeTrue(!isAlreadyProvisioningEntriesCreated()); } @Test @@ -79,7 +79,7 @@ public class ProvisioningIntegrationTest { for (int i = 0; i < LOANPRODUCTS_SIZE; i++) { final Integer loanProductID = createLoanProduct(false, NONE); loanProducts.add(loanProductID); - Assert.assertNotNull(loanProductID); + Assertions.assertNotNull(loanProductID); final Integer loanID = applyForLoanApplication(clientID, loanProductID, null, null, "1,00,000.00"); HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID); LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap); @@ -90,17 +90,17 @@ public class ProvisioningIntegrationTest { loanStatusHashMap = this.loanTransactionHelper.disburseLoan("20 September 2011", loanID); LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap); loans.add(loanID); - Assert.assertNotNull(loanID); + Assertions.assertNotNull(loanID); } ArrayList categories = transactionHelper.retrieveAllProvisioningCategories(); - Assert.assertTrue(categories.size() > 0) ; + Assertions.assertTrue(categories.size() > 0) ; Account liability = accountHelper.createLiabilityAccount() ; Account expense = accountHelper.createExpenseAccount() ; Map requestCriteria = ProvisioningHelper.createProvisioingCriteriaJson(loanProducts, categories, liability, expense); String provisioningCriteriaCreateJson = new Gson().toJson(requestCriteria); Integer criteriaId = transactionHelper.createProvisioningCriteria(provisioningCriteriaCreateJson); - Assert.assertNotNull(criteriaId); + Assertions.assertNotNull(criteriaId); Map newCriteria = transactionHelper.retrieveProvisioningCriteria(criteriaId) ; validateProvisioningCriteria(requestCriteria, newCriteria) ; @@ -124,18 +124,18 @@ public class ProvisioningIntegrationTest { requestCriteria = ProvisioningHelper.createProvisioingCriteriaJson(loanProducts, categories, liability, expense); provisioningCriteriaCreateJson = new Gson().toJson(requestCriteria); criteriaId = transactionHelper.createProvisioningCriteria(provisioningCriteriaCreateJson); - Assert.assertNotNull(criteriaId); + Assertions.assertNotNull(criteriaId); String provisioningEntryJson = ProvisioningHelper.createProvisioningEntryJson(); Integer provisioningEntryId = transactionHelper.createProvisioningEntries(provisioningEntryJson); - Assert.assertNotNull(provisioningEntryId); + Assertions.assertNotNull(provisioningEntryId); transactionHelper.updateProvisioningEntry("recreateprovisioningentry", provisioningEntryId, "") ; transactionHelper.updateProvisioningEntry("createjournalentry", provisioningEntryId, "") ; Map entry = transactionHelper.retrieveProvisioningEntry(provisioningEntryId) ; - Assert.assertTrue((Boolean)entry.get("journalEntry")) ; + Assertions.assertTrue((Boolean)entry.get("journalEntry")) ; Map provisioningEntry = transactionHelper.retrieveProvisioningEntries(provisioningEntryId) ; - Assert.assertTrue(((ArrayList)provisioningEntry.get("pageItems")).size() > 0) ; + Assertions.assertTrue(((ArrayList)provisioningEntry.get("pageItems")).size() > 0) ; } private void validateProvisioningCriteria(Map requestCriteria, Map newCriteria) { @@ -143,16 +143,16 @@ public class ProvisioningIntegrationTest { //criteria name validation String requestCriteriaName = (String)requestCriteria.get("criteriaName") ; String criteriaName = (String)newCriteria.get("criteriaName") ; - Assert.assertEquals(criteriaName, requestCriteriaName) ; + Assertions.assertEquals(criteriaName, requestCriteriaName) ; //loan products validation ArrayList requestProducts = (ArrayList)requestCriteria.get("loanProducts") ; ArrayList products = (ArrayList)newCriteria.get("loanProducts") ; - Assert.assertEquals(products.size(), requestProducts.size()) ; + Assertions.assertEquals(products.size(), requestProducts.size()) ; ArrayList requestedDefinitions = (ArrayList)requestCriteria.get("definitions") ; ArrayList newdefintions = (ArrayList) newCriteria.get("definitions") ; - Assert.assertEquals(newdefintions.size(), requestedDefinitions.size()) ; + Assertions.assertEquals(newdefintions.size(), requestedDefinitions.size()) ; for(int i = 0 ; i < newdefintions.size() ; i++) { Map requestedMap = (Map)requestedDefinitions.get(i) ; Object requestedCategoryId = requestedMap.get("categoryId") ; @@ -173,7 +173,7 @@ public class ProvisioningIntegrationTest { } } if(!found) { - Assert.fail("No Category found with Id:" + requestedCategoryId); + Assertions.fail("No Category found with Id:" + requestedCategoryId); } } } @@ -181,7 +181,7 @@ public class ProvisioningIntegrationTest { private void checkProperty(String propertyName, Map requestMap, Map newMap) { Object requested = requestMap.get(propertyName) ; Object modified = newMap.get(propertyName) ; - Assert.assertEquals(requested, modified) ; + Assertions.assertEquals(requested, modified) ; } private Integer createLoanProduct(final boolean multiDisburseLoan, final String accountingRule, final Account... accounts) { diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/SchedulerJobHelper.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/SchedulerJobHelper.java index 27a9aea72..37219377c 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/SchedulerJobHelper.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/SchedulerJobHelper.java @@ -22,10 +22,10 @@ import static java.time.Instant.now; import static org.awaitility.Awaitility.await; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.fail; import com.google.gson.Gson; import io.restassured.builder.ResponseSpecBuilder; @@ -175,11 +175,11 @@ public class SchedulerJobHelper { LOG.error("Lsat Job failure error log (only relevent if the job fails: {}", jobHistoryData.get(jobHistoryData.size() - 1).get("jobRunErrorLog")); - assertFalse("Job History is empty :( Was it too slow? Failures in background job?", jobHistoryData.isEmpty()); + assertFalse(jobHistoryData.isEmpty(), "Job History is empty :( Was it too slow? Failures in background job?"); // Verifying the Status of the Recently executed Scheduler Job - assertEquals("Verifying Last Scheduler Job Status", "success", - jobHistoryData.get(jobHistoryData.size() - 1).get("status")); + assertEquals("success", jobHistoryData.get(jobHistoryData.size() - 1).get("status"), + "Verifying Last Scheduler Job Status"); } /** diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/SurveyHelper.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/SurveyHelper.java index 2904f757f..3b2c34ce9 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/SurveyHelper.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/SurveyHelper.java @@ -18,7 +18,7 @@ */ package org.apache.fineract.integrationtests.common; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import com.google.gson.Gson; import io.restassured.specification.RequestSpecification; @@ -68,7 +68,7 @@ public class SurveyHelper { LOG.info("------------------------------CHECK CLIENT DETAILS------------------------------------\n"); final String SURVEY_URL = "/fineract-provider/api/v1/Survey/ppi_kenya_2009/clientid/entryId" + generatedClientID + "?" + Utils.TENANT_IDENTIFIER; final Integer responseClientID = Utils.performServerGet(requestSpec, responseSpec, SURVEY_URL, "id"); - assertEquals("ERROR IN CREATING THE CLIENT", generatedClientID, responseClientID); + assertEquals(generatedClientID, responseClientID, "ERROR IN CREATING THE CLIENT"); } diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/Utils.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/Utils.java index 0ba4a0fe9..e5f400efa 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/Utils.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/Utils.java @@ -22,7 +22,7 @@ import static io.restassured.RestAssured.given; import static io.restassured.path.json.JsonPath.from; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.is; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.fail; import io.restassured.RestAssured; import io.restassured.http.ContentType; diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/accounting/JournalEntryHelper.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/accounting/JournalEntryHelper.java index abede7a93..a6c53271a 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/accounting/JournalEntryHelper.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/accounting/JournalEntryHelper.java @@ -18,14 +18,14 @@ */ package org.apache.fineract.integrationtests.common.accounting; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; import io.restassured.specification.RequestSpecification; import io.restassured.specification.ResponseSpecification; import java.util.ArrayList; import java.util.HashMap; import org.apache.fineract.integrationtests.common.Utils; -import org.junit.Assert; +import org.junit.jupiter.api.Assertions; @SuppressWarnings("rawtypes") public class JournalEntryHelper { @@ -62,7 +62,7 @@ public class JournalEntryHelper { public void ensureNoAccountingTransactionsWithTransactionId(final String transactionId) { ArrayList transactions = getJournalEntriesByTransactionId(transactionId); - assertTrue("Tranasactions are is not empty", transactions.isEmpty()); + assertTrue(transactions.isEmpty(), "Tranasactions are is not empty"); } @@ -88,7 +88,7 @@ public class JournalEntryHelper { break; } } - Assert.assertTrue("Journal Entry not found", matchFound); + Assertions.assertTrue(matchFound, "Journal Entry not found"); } } diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/fixeddeposit/FixedDepositAccountStatusChecker.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/fixeddeposit/FixedDepositAccountStatusChecker.java index 724a07bfa..ef9637e72 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/fixeddeposit/FixedDepositAccountStatusChecker.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/fixeddeposit/FixedDepositAccountStatusChecker.java @@ -18,13 +18,13 @@ */ package org.apache.fineract.integrationtests.common.fixeddeposit; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; import io.restassured.specification.RequestSpecification; import io.restassured.specification.ResponseSpecification; import java.util.HashMap; import org.apache.fineract.integrationtests.common.Utils; -import org.junit.Assert; +import org.junit.jupiter.api.Assertions; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -35,46 +35,46 @@ public class FixedDepositAccountStatusChecker { public static void verifyFixedDepositIsApproved(final HashMap fixedDepositStatusHashMap) { LOG.info("-------------------- VERIFYING FIXED DEPOSIT APPLICATION IS APPROVED --------------------"); - assertTrue("Error in Approving Fixed deposit application", getStatus(fixedDepositStatusHashMap, "approved")); + assertTrue(getStatus(fixedDepositStatusHashMap, "approved"), "Error in Approving Fixed deposit application"); LOG.info("{}", fixedDepositStatusHashMap.toString()); } public static void verifyFixedDepositIsPending(final HashMap fixedDepositStatusHashMap) { LOG.info("-------------------- VERIFYING FIXED DEPOSIT APPLICATION IS PENDING --------------------"); - assertTrue("FIXED DEPOSIT ACCOUNT IS NOT IN PENDING STATE", - getStatus(fixedDepositStatusHashMap, "submittedAndPendingApproval")); + assertTrue(getStatus(fixedDepositStatusHashMap, "submittedAndPendingApproval"), + "FIXED DEPOSIT ACCOUNT IS NOT IN PENDING STATE"); LOG.info("{}", fixedDepositStatusHashMap.toString()); } public static void verifyFixedDepositIsActive(final HashMap fixedDepositStatusHashMap) { LOG.info("----------------- VERIFYING FIXED DEPOSIT APPLICATION IS ACTIVE -----------------"); - assertTrue("ERROR IN ACTIVATING THE FIXED DEPOSIT APPLICATION", getStatus(fixedDepositStatusHashMap, "active")); + assertTrue(getStatus(fixedDepositStatusHashMap, "active"), "ERROR IN ACTIVATING THE FIXED DEPOSIT APPLICATION"); LOG.info("{}", fixedDepositStatusHashMap.toString()); } public static void verifyFixedDepositIsRejected(final HashMap fixedDepositStatusHashMap) { LOG.info("-------------- VERIFYING FIXED DEPOSIT APPLICATION IS REJECTED ----------------"); - assertTrue("ERROR IN REJECTING THE FIXED DEPOSIT APPLICATION", - getStatus(fixedDepositStatusHashMap, "rejected")); + assertTrue(getStatus(fixedDepositStatusHashMap, "rejected"), + "ERROR IN REJECTING THE FIXED DEPOSIT APPLICATION"); LOG.info("{}", fixedDepositStatusHashMap.toString()); } public static void verifyFixedDepositIsWithdrawn(final HashMap fixedDepositStatusHashMap) { LOG.info("---------------- VERIFYING FIXED DEPOSIT APPLICATION IS WITHDRAWN ----------------"); - assertTrue("ERROR IN WITHDRAW THE FIXED DEPOSIT APPLICATION", - getStatus(fixedDepositStatusHashMap, "withdrawnByApplicant")); + assertTrue(getStatus(fixedDepositStatusHashMap, "withdrawnByApplicant"), + "ERROR IN WITHDRAW THE FIXED DEPOSIT APPLICATION"); LOG.info("{}", fixedDepositStatusHashMap.toString()); } public static void verifyFixedDepositAccountIsClosed(final HashMap fixedDepositStatusHashMap) { LOG.info("--------------------- VERIFYING FIXED DEPOSIT APPLICATION IS CLOSED ---------------------"); - assertTrue("ERROR IN CLOSING THE FIXED DEPOSIT APPLICATION", getStatus(fixedDepositStatusHashMap, "closed")); + assertTrue(getStatus(fixedDepositStatusHashMap, "closed"), "ERROR IN CLOSING THE FIXED DEPOSIT APPLICATION"); LOG.info("{}", fixedDepositStatusHashMap.toString()); } public static void verifyFixedDepositAccountIsNotActive(final HashMap fixedDepositStatusHashMap) { LOG.info("------------------ VERIFYING FIXED DEPOSIT APPLICATION IS INACTIVE --------------------"); - Assert.assertFalse(getStatus(fixedDepositStatusHashMap, "active")); + Assertions.assertFalse(getStatus(fixedDepositStatusHashMap, "active")); LOG.info("{}", fixedDepositStatusHashMap.toString()); } @@ -87,15 +87,15 @@ public class FixedDepositAccountStatusChecker { public static void verifyFixedDepositAccountIsPrematureClosed(HashMap fixedDepositStatusHashMap) { LOG.info("--------------------- VERIFYING FIXED DEPOSIT APPLICATION IS CLOSED ---------------------"); - assertTrue("ERROR IN PREMATURELY CLOSING THE FIXED DEPOSIT ACCOUNT", - getStatus(fixedDepositStatusHashMap, "prematureClosed")); + assertTrue(getStatus(fixedDepositStatusHashMap, "prematureClosed"), + "ERROR IN PREMATURELY CLOSING THE FIXED DEPOSIT ACCOUNT"); LOG.info("{}", fixedDepositStatusHashMap.toString()); } public static void verifyFixedDepositAccountIsMatured(HashMap fixedDepositStatusHashMap) { LOG.info("--------------------- VERIFYING FIXED DEPOSIT APPLICATION IS MATURED ---------------------"); - assertTrue("ERROR IN MATURITY JOB OF THE FIXED DEPOSIT ACCOUNT", - getStatus(fixedDepositStatusHashMap, "matured")); + assertTrue(getStatus(fixedDepositStatusHashMap, "matured"), + "ERROR IN MATURITY JOB OF THE FIXED DEPOSIT ACCOUNT"); LOG.info("{}", fixedDepositStatusHashMap.toString()); } diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/loans/LoanStatusChecker.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/loans/LoanStatusChecker.java index b59f7dc39..6ee9b9e02 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/loans/LoanStatusChecker.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/loans/LoanStatusChecker.java @@ -18,9 +18,9 @@ */ package org.apache.fineract.integrationtests.common.loans; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import io.restassured.specification.RequestSpecification; import io.restassured.specification.ResponseSpecification; diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/loans/LoanTransactionHelper.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/loans/LoanTransactionHelper.java index c839d556d..b036c379e 100755 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/loans/LoanTransactionHelper.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/loans/LoanTransactionHelper.java @@ -18,8 +18,8 @@ */ package org.apache.fineract.integrationtests.common.loans; -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.assertTrue; import com.google.gson.Gson; import io.restassured.specification.RequestSpecification; @@ -669,8 +669,9 @@ public class LoanTransactionHelper { LOG.info("---------------------------GETTING LOAN REPAYMENT SCHEDULE--------------------------------"); final ArrayList repaymentPeriods = getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID); - assertEquals("Mismatch in Principal Loan Balance Outstanding ", expectedPrincipalOutstanding, - repaymentPeriods.get(repaymentNumber).get("principalLoanBalanceOutstanding")); + assertEquals(expectedPrincipalOutstanding, + repaymentPeriods.get(repaymentNumber).get("principalLoanBalanceOutstanding"), + "Mismatch in Principal Loan Balance Outstanding "); } public void checkAccrualTransactionForRepayment(final LocalDate transactionDate, final Float interestPortion, @@ -690,17 +691,20 @@ public class LoanTransactionHelper { if (transactionDate.equals(accrualEntryDate)) { isTransactionFound = true; - assertEquals("Mismatch in transaction amounts", interestPortion, - Float.valueOf(String.valueOf(transactions.get(i).get("interestPortion")))); - assertEquals("Mismatch in transaction amounts", feePortion, - Float.valueOf(String.valueOf(transactions.get(i).get("feeChargesPortion")))); - assertEquals("Mismatch in transaction amounts", penaltyPortion, - Float.valueOf(String.valueOf(transactions.get(i).get("penaltyChargesPortion")))); + assertEquals(interestPortion, + Float.valueOf(String.valueOf(transactions.get(i).get("interestPortion"))), + "Mismatch in transaction amounts"); + assertEquals(feePortion, + Float.valueOf(String.valueOf(transactions.get(i).get("feeChargesPortion"))), + "Mismatch in transaction amounts"); + assertEquals(penaltyPortion, + Float.valueOf(String.valueOf(transactions.get(i).get("penaltyChargesPortion"))), + "Mismatch in transaction amounts"); break; } } } - assertTrue("No Accrual entries are posted", isTransactionFound); + assertTrue(isTransactionFound, "No Accrual entries are posted"); } diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/organisation/CampaignsHelper.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/organisation/CampaignsHelper.java index 9e96f7180..ea233a8f4 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/organisation/CampaignsHelper.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/organisation/CampaignsHelper.java @@ -20,7 +20,7 @@ package org.apache.fineract.integrationtests.common.organisation; import static io.restassured.RestAssured.given; import static io.restassured.path.json.JsonPath.from; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; @@ -67,7 +67,7 @@ public class CampaignsHelper { + Utils.TENANT_IDENTIFIER; final Integer responseCampaignId = Utils.performServerGet(requestSpec, responseSpec, RETRIEVE_SMS_CAMPAIGNS_URL, "id"); - assertEquals("ERROR IN CREATING THE CAMPAIGN", generatedCampaignId, responseCampaignId); + assertEquals(generatedCampaignId, responseCampaignId, "ERROR IN CREATING THE CAMPAIGN"); } public Integer updateCampaign(final RequestSpecification requestSpec, final ResponseSpecification responseSpec, diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/organisation/CampaignsTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/organisation/CampaignsTest.java index be5e177f8..bf8304269 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/organisation/CampaignsTest.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/organisation/CampaignsTest.java @@ -18,7 +18,7 @@ */ package org.apache.fineract.integrationtests.common.organisation; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import io.restassured.builder.RequestSpecBuilder; import io.restassured.builder.ResponseSpecBuilder; @@ -29,11 +29,11 @@ import java.util.ArrayList; import java.util.HashMap; import org.apache.fineract.integrationtests.common.CommonConstants; import org.apache.fineract.integrationtests.common.Utils; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; -@Ignore +@Disabled public class CampaignsTest { private RequestSpecification requestSpec; @@ -53,7 +53,7 @@ public class CampaignsTest { public static final String DATE_FORMAT = "dd MMMM yyyy"; - @Before + @BeforeEach public void setup() { Utils.initializeRESTAssured(); this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build(); diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/organisation/EntityDatatableChecksIntegrationTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/organisation/EntityDatatableChecksIntegrationTest.java index 977f6dbaa..32a507ee2 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/organisation/EntityDatatableChecksIntegrationTest.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/organisation/EntityDatatableChecksIntegrationTest.java @@ -18,8 +18,8 @@ */ package org.apache.fineract.integrationtests.common.organisation; -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; @@ -39,9 +39,9 @@ import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper; import org.apache.fineract.integrationtests.common.savings.SavingsAccountHelper; import org.apache.fineract.integrationtests.common.savings.SavingsProductHelper; import org.apache.fineract.integrationtests.common.system.DatatableHelper; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -74,7 +74,7 @@ public class EntityDatatableChecksIntegrationTest { // TODO Auto-generated constructor stub } - @Before + @BeforeEach public void setup() { Utils.initializeRESTAssured(); this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build(); @@ -93,15 +93,15 @@ public class EntityDatatableChecksIntegrationTest { // creating new entity datatable check Integer entityDatatableCheckId = this.entityDatatableChecksHelper.createEntityDatatableCheck(CLIENT_APP_TABLE_NAME, datatableName, 100, null); - assertNotNull("ERROR IN CREATING THE ENTITY DATATABLE CHECK", entityDatatableCheckId); + assertNotNull(entityDatatableCheckId, "ERROR IN CREATING THE ENTITY DATATABLE CHECK"); // deleting entity datatable check entityDatatableCheckId = this.entityDatatableChecksHelper.deleteEntityDatatableCheck(entityDatatableCheckId); - assertNotNull("ERROR IN DELETING THE ENTITY DATATABLE CHECK", entityDatatableCheckId); + assertNotNull(entityDatatableCheckId, "ERROR IN DELETING THE ENTITY DATATABLE CHECK"); // deleting the datatable String deletedDataTableName = this.datatableHelper.deleteDatatable(datatableName); - assertEquals("ERROR IN DELETING THE DATATABLE", datatableName, deletedDataTableName); + assertEquals(datatableName, deletedDataTableName, "ERROR IN DELETING THE DATATABLE"); } @Test @@ -121,7 +121,7 @@ public class EntityDatatableChecksIntegrationTest { // creating new entity datatable check Integer entityDatatableCheckId = this.entityDatatableChecksHelper.createEntityDatatableCheck(CLIENT_APP_TABLE_NAME, registeredTableName, 100, null); - assertNotNull("ERROR IN CREATING THE ENTITY DATATABLE CHECK", entityDatatableCheckId); + assertNotNull(entityDatatableCheckId, "ERROR IN CREATING THE ENTITY DATATABLE CHECK"); // creating client with datatables final Integer clientID = ClientHelper.createClientPendingWithDatatable(requestSpec, responseSpec, registeredTableName); @@ -129,15 +129,15 @@ public class EntityDatatableChecksIntegrationTest { // deleting entity datatable check entityDatatableCheckId = this.entityDatatableChecksHelper.deleteEntityDatatableCheck(entityDatatableCheckId); - assertNotNull("ERROR IN DELETING THE ENTITY DATATABLE CHECK", entityDatatableCheckId); + assertNotNull(entityDatatableCheckId, "ERROR IN DELETING THE ENTITY DATATABLE CHECK"); // deleting datatable entries Integer appTableId = this.datatableHelper.deleteDatatableEntries(registeredTableName, clientID, "clientId"); - assertEquals("ERROR IN DELETING THE DATATABLE ENTRIES", clientID, appTableId); + assertEquals(clientID, appTableId, "ERROR IN DELETING THE DATATABLE ENTRIES"); // deleting the datatable String deletedDataTableName = this.datatableHelper.deleteDatatable(registeredTableName); - assertEquals("ERROR IN DELETING THE DATATABLE", registeredTableName, deletedDataTableName); + assertEquals(registeredTableName, deletedDataTableName, "ERROR IN DELETING THE DATATABLE"); } @SuppressWarnings("unchecked") @@ -154,7 +154,7 @@ public class EntityDatatableChecksIntegrationTest { // creating new entity datatable check Integer entityDatatableCheckId = this.entityDatatableChecksHelper.createEntityDatatableCheck(CLIENT_APP_TABLE_NAME, registeredTableName, 100, null); - assertNotNull("ERROR IN CREATING THE ENTITY DATATABLE CHECK", entityDatatableCheckId); + assertNotNull(entityDatatableCheckId, "ERROR IN CREATING THE ENTITY DATATABLE CHECK"); // creating client with datatables with error ArrayList> clientErrorData = (ArrayList>) validationErrorHelper @@ -164,11 +164,11 @@ public class EntityDatatableChecksIntegrationTest { // deleting entity datatable check entityDatatableCheckId = this.entityDatatableChecksHelper.deleteEntityDatatableCheck(entityDatatableCheckId); - assertNotNull("ERROR IN DELETING THE ENTITY DATATABLE CHECK", entityDatatableCheckId); + assertNotNull(entityDatatableCheckId, "ERROR IN DELETING THE ENTITY DATATABLE CHECK"); // deleting the datatable String deletedDataTableName = this.datatableHelper.deleteDatatable(registeredTableName); - assertEquals("ERROR IN DELETING THE DATATABLE", registeredTableName, deletedDataTableName); + assertEquals(registeredTableName, deletedDataTableName, "ERROR IN DELETING THE DATATABLE"); } @Test @@ -181,7 +181,7 @@ public class EntityDatatableChecksIntegrationTest { // creating new entity datatable check Integer entityDatatableCheckId = this.entityDatatableChecksHelper.createEntityDatatableCheck(GROUP_APP_TABLE_NAME, registeredTableName, 100, null); - assertNotNull("ERROR IN CREATING THE ENTITY DATATABLE CHECK", entityDatatableCheckId); + assertNotNull(entityDatatableCheckId, "ERROR IN CREATING THE ENTITY DATATABLE CHECK"); // creating group with datatables final Integer groupId = GroupHelper.createGroupPendingWithDatatable(this.requestSpec, this.responseSpec, registeredTableName); @@ -189,15 +189,15 @@ public class EntityDatatableChecksIntegrationTest { // deleting entity datatable check entityDatatableCheckId = this.entityDatatableChecksHelper.deleteEntityDatatableCheck(entityDatatableCheckId); - assertNotNull("ERROR IN DELETING THE ENTITY DATATABLE CHECK", entityDatatableCheckId); + assertNotNull(entityDatatableCheckId, "ERROR IN DELETING THE ENTITY DATATABLE CHECK"); // deleting datatable entries Integer appTableId = this.datatableHelper.deleteDatatableEntries(registeredTableName, groupId, "groupId"); - assertEquals("ERROR IN DELETING THE DATATABLE ENTRIES", groupId, appTableId); + assertEquals(groupId, appTableId, "ERROR IN DELETING THE DATATABLE ENTRIES"); // deleting the datatable String deletedDataTableName = this.datatableHelper.deleteDatatable(registeredTableName); - assertEquals("ERROR IN DELETING THE DATATABLE", registeredTableName, deletedDataTableName); + assertEquals(registeredTableName, deletedDataTableName, "ERROR IN DELETING THE DATATABLE"); } @SuppressWarnings("unchecked") @@ -214,7 +214,7 @@ public class EntityDatatableChecksIntegrationTest { // creating new entity datatable check Integer entityDatatableCheckId = this.entityDatatableChecksHelper.createEntityDatatableCheck(GROUP_APP_TABLE_NAME, registeredTableName, 100, null); - assertNotNull("ERROR IN CREATING THE ENTITY DATATABLE CHECK", entityDatatableCheckId); + assertNotNull(entityDatatableCheckId, "ERROR IN CREATING THE ENTITY DATATABLE CHECK"); // creating group with datatables with error ArrayList> groupErrorData = (ArrayList>) validationErrorHelper @@ -224,11 +224,11 @@ public class EntityDatatableChecksIntegrationTest { // deleting entity datatable check entityDatatableCheckId = this.entityDatatableChecksHelper.deleteEntityDatatableCheck(entityDatatableCheckId); - assertNotNull("ERROR IN DELETING THE ENTITY DATATABLE CHECK", entityDatatableCheckId); + assertNotNull(entityDatatableCheckId, "ERROR IN DELETING THE ENTITY DATATABLE CHECK"); // deleting the datatable String deletedDataTableName = this.datatableHelper.deleteDatatable(registeredTableName); - assertEquals("ERROR IN DELETING THE DATATABLE", registeredTableName, deletedDataTableName); + assertEquals(registeredTableName, deletedDataTableName, "ERROR IN DELETING THE DATATABLE"); } @Test @@ -248,31 +248,31 @@ public class EntityDatatableChecksIntegrationTest { // creating new entity datatable check Integer entityDatatableCheckId = this.entityDatatableChecksHelper.createEntityDatatableCheck(SAVINGS_APP_TABLE_NAME, registeredTableName, 100, null); - assertNotNull("ERROR IN CREATING THE ENTITY DATATABLE CHECK", entityDatatableCheckId); + assertNotNull(entityDatatableCheckId, "ERROR IN CREATING THE ENTITY DATATABLE CHECK"); final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec); ClientHelper.verifyClientCreatedOnServer(this.requestSpec, this.responseSpec, clientID); final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE, minBalanceForInterestCalculation, minRequiredBalance, enforceMinRequiredBalance, allowOverdraft); - Assert.assertNotNull(savingsProductID); + Assertions.assertNotNull(savingsProductID); // creating savings with datatables final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplicationWithDatatables(clientID, savingsProductID, ACCOUNT_TYPE_INDIVIDUAL, "01 December 2016", registeredTableName); - Assert.assertNotNull(savingsId); + Assertions.assertNotNull(savingsId); // deleting entity datatable check entityDatatableCheckId = this.entityDatatableChecksHelper.deleteEntityDatatableCheck(entityDatatableCheckId); - assertNotNull("ERROR IN DELETING THE ENTITY DATATABLE CHECK", entityDatatableCheckId); + assertNotNull(entityDatatableCheckId, "ERROR IN DELETING THE ENTITY DATATABLE CHECK"); // deleting datatable entries Integer appTableId = this.datatableHelper.deleteDatatableEntries(registeredTableName, savingsId, "savingsId"); - assertEquals("ERROR IN DELETING THE DATATABLE ENTRIES", savingsId, appTableId); + assertEquals(savingsId, appTableId, "ERROR IN DELETING THE DATATABLE ENTRIES"); // deleting the datatable String deletedDataTableName = this.datatableHelper.deleteDatatable(registeredTableName); - assertEquals("ERROR IN DELETING THE DATATABLE", registeredTableName, deletedDataTableName); + assertEquals(registeredTableName, deletedDataTableName, "ERROR IN DELETING THE DATATABLE"); } @SuppressWarnings("unchecked") @@ -294,14 +294,14 @@ public class EntityDatatableChecksIntegrationTest { // creating new entity datatable check Integer entityDatatableCheckId = this.entityDatatableChecksHelper.createEntityDatatableCheck(SAVINGS_APP_TABLE_NAME, registeredTableName, 100, null); - assertNotNull("ERROR IN CREATING THE ENTITY DATATABLE CHECK", entityDatatableCheckId); + assertNotNull(entityDatatableCheckId, "ERROR IN CREATING THE ENTITY DATATABLE CHECK"); final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec); ClientHelper.verifyClientCreatedOnServer(this.requestSpec, this.responseSpec, clientID); final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE, minBalanceForInterestCalculation, minRequiredBalance, enforceMinRequiredBalance, allowOverdraft); - Assert.assertNotNull(savingsProductID); + Assertions.assertNotNull(savingsProductID); // creating savings with datatables with error ArrayList> groupErrorData = (ArrayList>) validationErrorHelper @@ -312,11 +312,11 @@ public class EntityDatatableChecksIntegrationTest { // deleting entity datatable check entityDatatableCheckId = this.entityDatatableChecksHelper.deleteEntityDatatableCheck(entityDatatableCheckId); - assertNotNull("ERROR IN DELETING THE ENTITY DATATABLE CHECK", entityDatatableCheckId); + assertNotNull(entityDatatableCheckId, "ERROR IN DELETING THE ENTITY DATATABLE CHECK"); // deleting the datatable String deletedDataTableName = this.datatableHelper.deleteDatatable(registeredTableName); - assertEquals("ERROR IN DELETING THE DATATABLE", registeredTableName, deletedDataTableName); + assertEquals(registeredTableName, deletedDataTableName, "ERROR IN DELETING THE DATATABLE"); } @Test @@ -329,7 +329,7 @@ public class EntityDatatableChecksIntegrationTest { // creating loan product final Integer loanProductID = createLoanProduct("100", "0", LoanProductTestBuilder.DEFAULT_STRATEGY); - Assert.assertNotNull(loanProductID); + Assertions.assertNotNull(loanProductID); // creating datatable String registeredTableName = this.datatableHelper.createDatatable(LOAN_APP_TABLE_NAME, false); @@ -338,23 +338,23 @@ public class EntityDatatableChecksIntegrationTest { // creating new entity datatable check Integer entityDatatableCheckId = this.entityDatatableChecksHelper.createEntityDatatableCheck(LOAN_APP_TABLE_NAME, registeredTableName, 100, loanProductID); - assertNotNull("ERROR IN CREATING THE ENTITY DATATABLE CHECK", entityDatatableCheckId); + assertNotNull(entityDatatableCheckId, "ERROR IN CREATING THE ENTITY DATATABLE CHECK"); // creating new loan application final Integer loanID = applyForLoanApplication(clientID, loanProductID, "5", registeredTableName); - Assert.assertNotNull(loanID); + Assertions.assertNotNull(loanID); // deleting entity datatable check entityDatatableCheckId = this.entityDatatableChecksHelper.deleteEntityDatatableCheck(entityDatatableCheckId); - assertNotNull("ERROR IN DELETING THE ENTITY DATATABLE CHECK", entityDatatableCheckId); + assertNotNull(entityDatatableCheckId, "ERROR IN DELETING THE ENTITY DATATABLE CHECK"); // deleting datatable entries Integer appTableId = this.datatableHelper.deleteDatatableEntries(registeredTableName, loanID, "loanId"); - assertEquals("ERROR IN DELETING THE DATATABLE ENTRIES", loanID, appTableId); + assertEquals(loanID, appTableId, "ERROR IN DELETING THE DATATABLE ENTRIES"); // deleting the datatable String deletedDataTableName = this.datatableHelper.deleteDatatable(registeredTableName); - assertEquals("ERROR IN DELETING THE DATATABLE", registeredTableName, deletedDataTableName); + assertEquals(registeredTableName, deletedDataTableName, "ERROR IN DELETING THE DATATABLE"); } @SuppressWarnings("unchecked") @@ -372,7 +372,7 @@ public class EntityDatatableChecksIntegrationTest { // creating loan product final Integer loanProductID = createLoanProduct("100", "0", LoanProductTestBuilder.DEFAULT_STRATEGY); - Assert.assertNotNull(loanProductID); + Assertions.assertNotNull(loanProductID); // creating datatable String registeredTableName = this.datatableHelper.createDatatable(LOAN_APP_TABLE_NAME, false); @@ -381,7 +381,7 @@ public class EntityDatatableChecksIntegrationTest { // creating new entity datatable check Integer entityDatatableCheckId = this.entityDatatableChecksHelper.createEntityDatatableCheck(LOAN_APP_TABLE_NAME, registeredTableName, 100, loanProductID); - assertNotNull("ERROR IN CREATING THE ENTITY DATATABLE CHECK", entityDatatableCheckId); + assertNotNull(entityDatatableCheckId, "ERROR IN CREATING THE ENTITY DATATABLE CHECK"); // creating new loan application with error ArrayList> loanErrorData = (ArrayList>) applyForLoanApplicationWithError(clientID, @@ -391,11 +391,11 @@ public class EntityDatatableChecksIntegrationTest { // deleting entity datatable check entityDatatableCheckId = this.entityDatatableChecksHelper.deleteEntityDatatableCheck(entityDatatableCheckId); - assertNotNull("ERROR IN DELETING THE ENTITY DATATABLE CHECK", entityDatatableCheckId); + assertNotNull(entityDatatableCheckId, "ERROR IN DELETING THE ENTITY DATATABLE CHECK"); // deleting the datatable String deletedDataTableName = this.datatableHelper.deleteDatatable(registeredTableName); - assertEquals("ERROR IN DELETING THE DATATABLE", registeredTableName, deletedDataTableName); + assertEquals(registeredTableName, deletedDataTableName, "ERROR IN DELETING THE DATATABLE"); } private Integer createSavingsProduct(final RequestSpecification requestSpec, final ResponseSpecification responseSpec, diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/recurringdeposit/RecurringDepositAccountStatusChecker.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/recurringdeposit/RecurringDepositAccountStatusChecker.java index ab6493ee0..0f86360a3 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/recurringdeposit/RecurringDepositAccountStatusChecker.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/recurringdeposit/RecurringDepositAccountStatusChecker.java @@ -18,13 +18,13 @@ */ package org.apache.fineract.integrationtests.common.recurringdeposit; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; import io.restassured.specification.RequestSpecification; import io.restassured.specification.ResponseSpecification; import java.util.HashMap; import org.apache.fineract.integrationtests.common.Utils; -import org.junit.Assert; +import org.junit.jupiter.api.Assertions; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -35,44 +35,44 @@ public class RecurringDepositAccountStatusChecker { public static void verifyRecurringDepositIsApproved(final HashMap recurringDepositStatusHashMap) { LOG.info("-------------------- VERIFYING RECURRING DEPOSIT APPLICATION IS APPROVED --------------------"); - assertTrue("Error in Approving Recurring deposit application", getStatus(recurringDepositStatusHashMap, "approved")); + assertTrue(getStatus(recurringDepositStatusHashMap, "approved"), "Error in Approving Recurring deposit application"); LOG.info("{}",recurringDepositStatusHashMap.toString()); } public static void verifyRecurringDepositIsPending(final HashMap recurringDepositStatusHashMap) { LOG.info("-------------------- VERIFYING RECURRING DEPOSIT APPLICATION IS PENDING --------------------"); - assertTrue("RECURRING DEPOSIT ACCOUNT IS NOT IN PENDING STATE", - getStatus(recurringDepositStatusHashMap, "submittedAndPendingApproval")); + assertTrue(getStatus(recurringDepositStatusHashMap, "submittedAndPendingApproval"), + "RECURRING DEPOSIT ACCOUNT IS NOT IN PENDING STATE"); LOG.info("{}",recurringDepositStatusHashMap.toString()); } public static void verifyRecurringDepositIsActive(final HashMap recurringDepositStatusHashMap) { LOG.info("----------------- VERIFYING RECURRING DEPOSIT APPLICATION IS ACTIVE -----------------"); - assertTrue("ERROR IN ACTIVATING THE RECURRING DEPOSIT APPLICATION", getStatus(recurringDepositStatusHashMap, "active")); + assertTrue(getStatus(recurringDepositStatusHashMap, "active"), "ERROR IN ACTIVATING THE RECURRING DEPOSIT APPLICATION"); LOG.info("{}",recurringDepositStatusHashMap.toString()); } public static void verifyRecurringDepositIsRejected(final HashMap recurringDepositStatusHashMap) { LOG.info("-------------- VERIFYING RECURRING DEPOSIT APPLICATION IS REJECTED ----------------"); - assertTrue("ERROR IN REJECTING THE RECURRING DEPOSIT APPLICATION", getStatus(recurringDepositStatusHashMap, "rejected")); + assertTrue(getStatus(recurringDepositStatusHashMap, "rejected"), "ERROR IN REJECTING THE RECURRING DEPOSIT APPLICATION"); LOG.info("{}",recurringDepositStatusHashMap.toString()); } public static void verifyRecurringDepositIsWithdrawn(final HashMap recurringDepositStatusHashMap) { LOG.info("---------------- VERIFYING RECURRING DEPOSIT APPLICATION IS WITHDRAWN ----------------"); - assertTrue("ERROR IN WITHDRAW THE RECURRING DEPOSIT APPLICATION", getStatus(recurringDepositStatusHashMap, "withdrawnByApplicant")); + assertTrue(getStatus(recurringDepositStatusHashMap, "withdrawnByApplicant"), "ERROR IN WITHDRAW THE RECURRING DEPOSIT APPLICATION"); LOG.info("{}",recurringDepositStatusHashMap.toString()); } public static void verifyRecurringDepositAccountIsClosed(final HashMap recurringDepositStatusHashMap) { LOG.info("--------------------- VERIFYING RECURRING DEPOSIT APPLICATION IS CLOSED ---------------------"); - assertTrue("ERROR IN CLOSING THE RECURRING DEPOSIT APPLICATION", getStatus(recurringDepositStatusHashMap, "closed")); + assertTrue(getStatus(recurringDepositStatusHashMap, "closed"), "ERROR IN CLOSING THE RECURRING DEPOSIT APPLICATION"); LOG.info("{}",recurringDepositStatusHashMap.toString()); } public static void verifyRecurringDepositAccountIsNotActive(final HashMap recurringDepositStatusHashMap) { LOG.info("------------------ VERIFYING RECURRING DEPOSIT APPLICATION IS INACTIVE --------------------"); - Assert.assertFalse(getStatus(recurringDepositStatusHashMap, "active")); + Assertions.assertFalse(getStatus(recurringDepositStatusHashMap, "active")); LOG.info("{}",recurringDepositStatusHashMap.toString()); } @@ -85,14 +85,14 @@ public class RecurringDepositAccountStatusChecker { public static void verifyRecurringDepositAccountIsPrematureClosed(HashMap recurringDepositStatusHashMap) { LOG.info("--------------------- VERIFYING RECURRING DEPOSIT APPLICATION IS CLOSED ---------------------"); - assertTrue("ERROR IN PREMATURELY CLOSING THE RECURRING DEPOSIT ACCOUNT", - getStatus(recurringDepositStatusHashMap, "prematureClosed")); + assertTrue(getStatus(recurringDepositStatusHashMap, "prematureClosed"), + "ERROR IN PREMATURELY CLOSING THE RECURRING DEPOSIT ACCOUNT"); LOG.info("{}",recurringDepositStatusHashMap.toString()); } public static void verifyRecurringDepositAccountIsMatured(HashMap recurringDepositStatusHashMap) { LOG.info("--------------------- VERIFYING RECURRING DEPOSIT APPLICATION IS MATURED ---------------------"); - assertTrue("ERROR IN MATURITY JOB OF THE RECURRING DEPOSIT ACCOUNT", getStatus(recurringDepositStatusHashMap, "matured")); + assertTrue(getStatus(recurringDepositStatusHashMap, "matured"), "ERROR IN MATURITY JOB OF THE RECURRING DEPOSIT ACCOUNT"); LOG.info("{}",recurringDepositStatusHashMap.toString()); } diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/savings/SavingsAccountHelper.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/savings/SavingsAccountHelper.java index e96be614d..f898d21fc 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/savings/SavingsAccountHelper.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/savings/SavingsAccountHelper.java @@ -39,7 +39,7 @@ import org.apache.fineract.integrationtests.common.CommonConstants; import org.apache.fineract.integrationtests.common.Utils; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.ss.usermodel.Workbook; -import org.junit.Assert; +import org.junit.jupiter.api.Assertions; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -674,12 +674,12 @@ public class SavingsAccountHelper { public static Integer openSavingsAccount(final RequestSpecification requestSpec, final ResponseSpecification responseSpec, final Integer clientId, final String minimumOpeningBalance) { final Integer savingsProductID = createSavingsProduct(requestSpec, responseSpec, minimumOpeningBalance); - Assert.assertNotNull(savingsProductID); + Assertions.assertNotNull(savingsProductID); SavingsAccountHelper savingsAccountHelper = new SavingsAccountHelper(requestSpec, responseSpec); final Integer savingsId = savingsAccountHelper.applyForSavingsApplication(clientId, savingsProductID, ACCOUNT_TYPE_INDIVIDUAL); - Assert.assertNotNull(savingsProductID); + Assertions.assertNotNull(savingsProductID); HashMap savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(requestSpec, responseSpec, savingsId); SavingsStatusChecker.verifySavingsIsPending(savingsStatusHashMap); diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/savings/SavingsProductHelper.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/savings/SavingsProductHelper.java index 223f4fd33..00675343f 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/savings/SavingsProductHelper.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/savings/SavingsProductHelper.java @@ -18,7 +18,7 @@ */ package org.apache.fineract.integrationtests.common.savings; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import com.google.gson.Gson; import io.restassured.specification.RequestSpecification; @@ -293,7 +293,7 @@ public class SavingsProductHelper { LOG.info("------------------------------CHECK CLIENT DETAILS------------------------------------\n"); final String GET_SAVINGS_PRODUCT_URL = SAVINGS_PRODUCT_URL + "/" + generatedProductID + "?" + Utils.TENANT_IDENTIFIER; final Integer responseSavingsProductID = Utils.performServerGet(requestSpec, responseSpec, GET_SAVINGS_PRODUCT_URL, "id"); - assertEquals("ERROR IN CREATING THE Savings Product", generatedProductID, responseSavingsProductID); + assertEquals(generatedProductID, responseSavingsProductID, "ERROR IN CREATING THE Savings Product"); } public SavingsProductHelper withDormancy() { diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/savings/SavingsStatusChecker.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/savings/SavingsStatusChecker.java index 56e5d181a..1098259a6 100755 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/savings/SavingsStatusChecker.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/savings/SavingsStatusChecker.java @@ -18,7 +18,7 @@ */ package org.apache.fineract.integrationtests.common.savings; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; import io.restassured.specification.RequestSpecification; import io.restassured.specification.ResponseSpecification; @@ -35,44 +35,44 @@ public class SavingsStatusChecker { public static void verifySavingsIsApproved(final HashMap savingsStatusHashMap) { LOG.info( "\n-------------------------------------- VERIFYING SAVINGS APPLICATION IS APPROVED ------------------------------------"); - assertTrue("ERROR IN APPROVING SAVINGS APPLICATION", getStatus(savingsStatusHashMap, "approved")); + assertTrue(getStatus(savingsStatusHashMap, "approved"), "ERROR IN APPROVING SAVINGS APPLICATION"); LOG.info("Savings Application Status: {} \n", savingsStatusHashMap); } public static void verifySavingsIsPending(final HashMap savingsStatusHashMap) { LOG.info( "\n-------------------------------------- VERIFYING SAVINGS APPLICATION IS PENDING ------------------------------------"); - assertTrue("SAVINGS ACCOUNT IS NOT IN PENDING STATE", - getStatus(savingsStatusHashMap, "submittedAndPendingApproval")); + assertTrue(getStatus(savingsStatusHashMap, "submittedAndPendingApproval"), + "SAVINGS ACCOUNT IS NOT IN PENDING STATE"); LOG.info("Savings Application Status: {} \n", savingsStatusHashMap); } public static void verifySavingsIsActive(final HashMap savingsStatusHashMap) { LOG.info( "\n-------------------------------------- VERIFYING SAVINGS APPLICATION IS ACTIVE ------------------------------------"); - assertTrue("ERROR IN ACTIVATING THE SAVINGS APPLICATION", getStatus(savingsStatusHashMap, "active")); + assertTrue(getStatus(savingsStatusHashMap, "active"), "ERROR IN ACTIVATING THE SAVINGS APPLICATION"); LOG.info("Savings Application Status: {} \n", savingsStatusHashMap); } public static void verifySavingsIsRejected(final HashMap savingsStatusHashMap) { LOG.info( "\n-------------------------------------- VERIFYING SAVINGS APPLICATION IS REJECTED ------------------------------------"); - assertTrue("ERROR IN REJECTING THE SAVINGS APPLICATION", getStatus(savingsStatusHashMap, "rejected")); + assertTrue(getStatus(savingsStatusHashMap, "rejected"), "ERROR IN REJECTING THE SAVINGS APPLICATION"); LOG.info("Savings Application Status: {} \n", savingsStatusHashMap); } public static void verifySavingsIsWithdrawn(final HashMap savingsStatusHashMap) { LOG.info( "\n-------------------------------------- VERIFYING SAVINGS APPLICATION IS WITHDRAWN ------------------------------------"); - assertTrue("ERROR IN WITHDRAW THE SAVINGS APPLICATION", - getStatus(savingsStatusHashMap, "withdrawnByApplicant")); + assertTrue(getStatus(savingsStatusHashMap, "withdrawnByApplicant"), + "ERROR IN WITHDRAW THE SAVINGS APPLICATION"); LOG.info("Savings Application Status: {}", savingsStatusHashMap); } public static void verifySavingsAccountIsClosed(final HashMap savingsStatusHashMap) { LOG.info( "\n-------------------------------------- VERIFYING SAVINGS APPLICATION IS CLOSED ------------------------------------"); - assertTrue("ERROR IN CLOSING THE SAVINGS APPLICATION", getStatus(savingsStatusHashMap, "closed")); + assertTrue(getStatus(savingsStatusHashMap, "closed"), "ERROR IN CLOSING THE SAVINGS APPLICATION"); LOG.info("Savings Application Status: {}", savingsStatusHashMap); } @@ -102,56 +102,56 @@ public class SavingsStatusChecker { public static void verifySavingsSubStatusInactive(HashMap savingsStatusHashMap) { LOG.info( "\n-------------------------------------- VERIFYING SAVINGS APPLICATION IS ACTIVE ------------------------------------"); - assertTrue("UNEXPECTED SAVINGS ACCOUNT SUB STATUS", getStatus(savingsStatusHashMap, "inactive")); + assertTrue(getStatus(savingsStatusHashMap, "inactive"), "UNEXPECTED SAVINGS ACCOUNT SUB STATUS"); LOG.info("Savings Application Sub Status: {} ", savingsStatusHashMap.toString()); } public static void verifySavingsSubStatusDormant(HashMap savingsStatusHashMap) { LOG.info( "\n-------------------------------------- VERIFYING SAVINGS APPLICATION IS ACTIVE ------------------------------------"); - assertTrue("UNEXPECTED SAVINGS ACCOUNT SUB STATUS", getStatus(savingsStatusHashMap, "dormant")); + assertTrue(getStatus(savingsStatusHashMap, "dormant"), "UNEXPECTED SAVINGS ACCOUNT SUB STATUS"); LOG.info("Savings Application Sub Status: {} ", savingsStatusHashMap.toString()); } public static void verifySavingsSubStatusEscheat(HashMap savingsStatusHashMap) { LOG.info( "\n-------------------------------------- VERIFYING SAVINGS APPLICATION IS ACTIVE ------------------------------------"); - assertTrue("UNEXPECTED SAVINGS ACCOUNT SUB STATUS", getStatus(savingsStatusHashMap, "escheat")); + assertTrue(getStatus(savingsStatusHashMap, "escheat"), "UNEXPECTED SAVINGS ACCOUNT SUB STATUS"); LOG.info("Savings Application Sub Status: {} ", savingsStatusHashMap.toString()); } public static void verifySavingsSubStatusNone(HashMap savingsStatusHashMap) { LOG.info( "\n-------------------------------------- VERIFYING SAVINGS APPLICATION IS ACTIVE ------------------------------------"); - assertTrue("UNEXPECTED SAVINGS ACCOUNT SUB STATUS", getStatus(savingsStatusHashMap, "none")); + assertTrue(getStatus(savingsStatusHashMap, "none"), "UNEXPECTED SAVINGS ACCOUNT SUB STATUS"); LOG.info("Savings Application Sub Status: {} ", savingsStatusHashMap.toString()); } public static void verifySavingsSubStatusblock(HashMap savingsStatusHashMap) { LOG.info( "\n-------------------------------------- VERIFYING SAVINGS ACCOUNT IS BLOCKED ------------------------------------"); - assertTrue("block", getStatus(savingsStatusHashMap, "block")); + assertTrue(getStatus(savingsStatusHashMap, "block"), "block"); LOG.info("Savings Application Sub Status: {} ", savingsStatusHashMap.toString()); } public static void verifySavingsSubStatusIsNone(HashMap savingsStatusHashMap) { LOG.info( "\n------------------------- VERIFYING SAVINGS ACCOUNT IS NOT BLOCKED FOR ANY TYPE OF TRANSACTIONS ---------------------------"); - assertTrue("none", getStatus(savingsStatusHashMap, "none")); + assertTrue(getStatus(savingsStatusHashMap, "none"), "none"); LOG.info("Savings Application Sub Status: {} ", savingsStatusHashMap.toString()); } public static void verifySavingsSubStatusIsDebitBlocked(HashMap savingsStatusHashMap) { LOG.info( "\n--------------------- VERIFYING SAVINGS APPLICATION IS BLOCKED FOR DEBIT TRANSACTIONS ---------------------"); - assertTrue("status is blockDebit", getStatus(savingsStatusHashMap, "blockDebit")); + assertTrue(getStatus(savingsStatusHashMap, "blockDebit"), "status is blockDebit"); LOG.info("Savings Application Sub Status: {} ", savingsStatusHashMap.toString()); } public static void verifySavingsSubStatusIsCreditBlocked(HashMap savingsStatusHashMap) { LOG.info( "\n---------------------- VERIFYING SAVINGS APPLICATION IS BLOCKED FOR CREDIT TRANSACTIONS ---------------"); - assertTrue("blockCredit ", getStatus(savingsStatusHashMap, "blockCredit")); + assertTrue(getStatus(savingsStatusHashMap, "blockCredit"), "blockCredit "); LOG.info("Savings Application Sub Status: {} ", savingsStatusHashMap.toString()); } diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/shares/DividendsIntegrationTests.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/shares/DividendsIntegrationTests.java index 98a1684b1..fcc39b89f 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/shares/DividendsIntegrationTests.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/shares/DividendsIntegrationTests.java @@ -35,9 +35,9 @@ import java.util.Map; import org.apache.fineract.integrationtests.common.ClientHelper; import org.apache.fineract.integrationtests.common.Utils; import org.apache.fineract.integrationtests.common.savings.SavingsAccountHelper; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class DividendsIntegrationTests { @@ -48,7 +48,7 @@ public class DividendsIntegrationTests { private RequestSpecification requestSpec; private ResponseSpecification responseSpec; - @Before + @BeforeEach public void setup() { Utils.initializeRESTAssured(); this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build(); @@ -67,16 +67,16 @@ public class DividendsIntegrationTests { for(int i = 0 ; i < 5; i++) { final Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec); clients.add(clientId) ; - Assert.assertNotNull(clientId); + Assertions.assertNotNull(clientId); Integer savingsAccountId = SavingsAccountHelper.openSavingsAccount(requestSpec, responseSpec, clientId, "1000"); savingAccounts.add(savingsAccountId) ; - Assert.assertNotNull(savingsAccountId); + Assertions.assertNotNull(savingsAccountId); final Integer shareAccountId = createShareAccount(clientId, productId, savingsAccountId, dates[i], shares[i]); shareAccounts.add(shareAccountId) ; - Assert.assertNotNull(shareAccountId); + Assertions.assertNotNull(shareAccountId); Map shareAccountData = ShareAccountTransactionHelper .retrieveShareAccount(shareAccountId, requestSpec, responseSpec); - Assert.assertNotNull(shareAccountData); + Assertions.assertNotNull(shareAccountData); // Approve share Account Map approveMap = new HashMap<>(); approveMap.put("note", "Share Account Approval Note"); @@ -104,84 +104,84 @@ public class DividendsIntegrationTests { final Integer dividendId = ShareDividendsTransactionHelper.createShareProductDividends(productId, createDividendsJson, requestSpec, responseSpec) ; Map productdividends = ShareDividendsTransactionHelper.retrieveAllDividends(productId, requestSpec, responseSpec); - Assert.assertEquals("1", String.valueOf(productdividends.get("totalFilteredRecords"))); + Assertions.assertEquals("1", String.valueOf(productdividends.get("totalFilteredRecords"))); Map dividend = ((List>)productdividends.get("pageItems")).get(0) ; - Assert.assertEquals("50000.0", String.valueOf(dividend.get("amount"))) ; + Assertions.assertEquals("50000.0", String.valueOf(dividend.get("amount"))) ; Map status = (Map)dividend.get("status") ; - Assert.assertEquals("shareAccountDividendStatusType.initiated", String.valueOf(status.get("code"))); + Assertions.assertEquals("shareAccountDividendStatusType.initiated", String.valueOf(status.get("code"))); List startdateList = (List) dividend.get("dividendPeriodStartDate"); Calendar cal = Calendar.getInstance(); cal.set(startdateList.get(0), startdateList.get(1) - 1, startdateList.get(2)); Date startDate = cal.getTime(); - Assert.assertEquals("01 Jan 2015", simple.format(startDate)); + Assertions.assertEquals("01 Jan 2015", simple.format(startDate)); List enddateList = (List) dividend.get("dividendPeriodEndDate"); cal = Calendar.getInstance(); cal.set(enddateList.get(0), enddateList.get(1) - 1, enddateList.get(2)); Date endDate = cal.getTime(); - Assert.assertEquals("01 Apr 2016", simple.format(endDate)); + Assertions.assertEquals("01 Apr 2016", simple.format(endDate)); Map dividenddetails = ShareDividendsTransactionHelper.retrieveDividendDetails(productId, dividendId, requestSpec, responseSpec) ; - Assert.assertEquals("5", String.valueOf(dividenddetails.get("totalFilteredRecords"))); + Assertions.assertEquals("5", String.valueOf(dividenddetails.get("totalFilteredRecords"))); List> pageItems = (List>)dividenddetails.get("pageItems") ; for(Map dividendData: pageItems) { Map accountData = (Map) dividendData.get("accountData") ; String accountId = String.valueOf(accountData.get("id")) ; if(String.valueOf(shareAccounts.get(0)).equals(accountId)) { - Assert.assertEquals("11320.755", String.valueOf(dividendData.get("amount"))); + Assertions.assertEquals("11320.755", String.valueOf(dividendData.get("amount"))); }else if(String.valueOf(shareAccounts.get(1)).equals(accountId)) { - Assert.assertEquals("18172.791", String.valueOf(dividendData.get("amount"))); + Assertions.assertEquals("18172.791", String.valueOf(dividendData.get("amount"))); }else if(String.valueOf(shareAccounts.get(2)).equals(accountId)) { - Assert.assertEquals("13629.593", String.valueOf(dividendData.get("amount"))); + Assertions.assertEquals("13629.593", String.valueOf(dividendData.get("amount"))); }else if(String.valueOf(shareAccounts.get(3)).equals(accountId)) { - Assert.assertEquals("3028.7983", String.valueOf(dividendData.get("amount"))); + Assertions.assertEquals("3028.7983", String.valueOf(dividendData.get("amount"))); }else if(String.valueOf(shareAccounts.get(4)).equals(accountId)) { - Assert.assertEquals("3848.0637", String.valueOf(dividendData.get("amount"))); + Assertions.assertEquals("3848.0637", String.valueOf(dividendData.get("amount"))); } Map statusMap = (Map) dividendData.get("status") ; - Assert.assertEquals("shareAccountDividendStatusType.initiated", String.valueOf(statusMap.get("code"))) ; + Assertions.assertEquals("shareAccountDividendStatusType.initiated", String.valueOf(statusMap.get("code"))) ; } String jsonString = "" ; ShareDividendsTransactionHelper.postCommand("approve", productId, dividendId, jsonString, requestSpec, responseSpec) ; productdividends = ShareDividendsTransactionHelper.retrieveAllDividends(productId, requestSpec, responseSpec); - Assert.assertEquals("1", String.valueOf(productdividends.get("totalFilteredRecords"))); + Assertions.assertEquals("1", String.valueOf(productdividends.get("totalFilteredRecords"))); dividend = ((List>)productdividends.get("pageItems")).get(0) ; - Assert.assertEquals("50000.0", String.valueOf(dividend.get("amount"))) ; + Assertions.assertEquals("50000.0", String.valueOf(dividend.get("amount"))) ; status = (Map)dividend.get("status") ; - Assert.assertEquals("shareAccountDividendStatusType.approved", String.valueOf(status.get("code"))); + Assertions.assertEquals("shareAccountDividendStatusType.approved", String.valueOf(status.get("code"))); startdateList = (List) dividend.get("dividendPeriodStartDate"); cal = Calendar.getInstance(); cal.set(startdateList.get(0), startdateList.get(1) - 1, startdateList.get(2)); startDate = cal.getTime(); - Assert.assertEquals("01 Jan 2015", simple.format(startDate)); + Assertions.assertEquals("01 Jan 2015", simple.format(startDate)); enddateList = (List) dividend.get("dividendPeriodEndDate"); cal = Calendar.getInstance(); cal.set(enddateList.get(0), enddateList.get(1) - 1, enddateList.get(2)); endDate = cal.getTime(); - Assert.assertEquals("01 Apr 2016", simple.format(endDate)); + Assertions.assertEquals("01 Apr 2016", simple.format(endDate)); dividenddetails = ShareDividendsTransactionHelper.retrieveDividendDetails(productId, dividendId, requestSpec, responseSpec) ; - Assert.assertEquals("5", String.valueOf(dividenddetails.get("totalFilteredRecords"))); + Assertions.assertEquals("5", String.valueOf(dividenddetails.get("totalFilteredRecords"))); pageItems = (List>)dividenddetails.get("pageItems") ; for(Map dividendData: pageItems) { Map accountData = (Map) dividendData.get("accountData") ; String accountId = String.valueOf(accountData.get("id")) ; if(String.valueOf(shareAccounts.get(0)).equals(accountId)) { - Assert.assertEquals("11320.755", String.valueOf(dividendData.get("amount"))); + Assertions.assertEquals("11320.755", String.valueOf(dividendData.get("amount"))); }else if(String.valueOf(shareAccounts.get(1)).equals(accountId)) { - Assert.assertEquals("18172.791", String.valueOf(dividendData.get("amount"))); + Assertions.assertEquals("18172.791", String.valueOf(dividendData.get("amount"))); }else if(String.valueOf(shareAccounts.get(2)).equals(accountId)) { - Assert.assertEquals("13629.593", String.valueOf(dividendData.get("amount"))); + Assertions.assertEquals("13629.593", String.valueOf(dividendData.get("amount"))); }else if(String.valueOf(shareAccounts.get(3)).equals(accountId)) { - Assert.assertEquals("3028.7983", String.valueOf(dividendData.get("amount"))); + Assertions.assertEquals("3028.7983", String.valueOf(dividendData.get("amount"))); }else if(String.valueOf(shareAccounts.get(4)).equals(accountId)) { - Assert.assertEquals("3848.0637", String.valueOf(dividendData.get("amount"))); + Assertions.assertEquals("3848.0637", String.valueOf(dividendData.get("amount"))); } Map statusMap = (Map) dividendData.get("status") ; - Assert.assertEquals("shareAccountDividendStatusType.initiated", String.valueOf(statusMap.get("code"))) ; + Assertions.assertEquals("shareAccountDividendStatusType.initiated", String.valueOf(statusMap.get("code"))) ; } } diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/shares/ShareAccountIntegrationTests.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/shares/ShareAccountIntegrationTests.java index 1ad7dbde0..ed5e06434 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/shares/ShareAccountIntegrationTests.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/shares/ShareAccountIntegrationTests.java @@ -37,9 +37,9 @@ import org.apache.fineract.integrationtests.common.ClientHelper; import org.apache.fineract.integrationtests.common.Utils; import org.apache.fineract.integrationtests.common.charges.ChargesHelper; import org.apache.fineract.integrationtests.common.savings.SavingsAccountHelper; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -49,7 +49,7 @@ public class ShareAccountIntegrationTests { private ResponseSpecification responseSpec; private ShareProductHelper shareProductHelper; - @Before + @BeforeEach public void setup() { Utils.initializeRESTAssured(); this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build(); @@ -64,13 +64,13 @@ public class ShareAccountIntegrationTests { LOG.info("------------------------------CREATING NEW SHARE PRODUCT ---------------------------------------"); shareProductHelper = new ShareProductHelper(); final Integer shareProductId = createShareProduct(); - Assert.assertNotNull(shareProductId); + Assertions.assertNotNull(shareProductId); LOG.info("------------------------------CREATING SHARE PRODUCT COMPLETE---------------------------------------"); LOG.info("------------------------------RETRIEVING SHARE PRODUCT---------------------------------------"); Map shareProductData = ShareProductTransactionHelper .retrieveShareProduct(shareProductId, requestSpec, responseSpec); - Assert.assertNotNull(shareProductData); + Assertions.assertNotNull(shareProductData); shareProductHelper.verifyShareProduct(shareProductData); LOG.info("------------------------------RETRIEVING SHARE PRODUCT COMPLETE---------------------------------------"); @@ -85,13 +85,13 @@ public class ShareAccountIntegrationTests { String updateShareProductJsonString = new Gson().toJson(shareProductDataForUpdate); Integer updatedProductId = ShareProductTransactionHelper.updateShareProduct(shareProductId, updateShareProductJsonString, requestSpec, responseSpec); - Assert.assertNotNull(updatedProductId); + Assertions.assertNotNull(updatedProductId); Map updatedShareProductData = ShareProductTransactionHelper.retrieveShareProduct(updatedProductId, requestSpec, responseSpec); String updatedTotalShares = String.valueOf(updatedShareProductData.get("totalShares")); String updatedSharesIssued = String.valueOf(updatedShareProductData.get("totalSharesIssued")); - Assert.assertEquals("2000", updatedTotalShares); - Assert.assertEquals("2000", updatedSharesIssued); + Assertions.assertEquals("2000", updatedTotalShares); + Assertions.assertEquals("2000", updatedSharesIssued); LOG.info("------------------------------UPDATING SHARE PRODUCT COMPLETE---------------------------------------"); } @@ -101,16 +101,16 @@ public class ShareAccountIntegrationTests { public void testCreateShareAccount() { shareProductHelper = new ShareProductHelper(); final Integer productId = createShareProduct(); - Assert.assertNotNull(productId); + Assertions.assertNotNull(productId); final Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientId); + Assertions.assertNotNull(clientId); Integer savingsAccountId = SavingsAccountHelper.openSavingsAccount(requestSpec, responseSpec, clientId, "1000"); - Assert.assertNotNull(savingsAccountId); + Assertions.assertNotNull(savingsAccountId); final Integer shareAccountId = createShareAccount(clientId, productId, savingsAccountId); - Assert.assertNotNull(shareAccountId); + Assertions.assertNotNull(shareAccountId); Map shareProductData = ShareAccountTransactionHelper .retrieveShareAccount(shareAccountId, requestSpec, responseSpec); - Assert.assertNotNull(shareProductData); + Assertions.assertNotNull(shareProductData); Map shareAccountDataForUpdate = new HashMap<>(); shareAccountDataForUpdate.put("requestedShares", 30); @@ -121,18 +121,18 @@ public class ShareAccountIntegrationTests { ShareAccountTransactionHelper.updateShareAccount(shareAccountId, updateShareAccountJsonString, requestSpec, responseSpec); shareProductData = ShareAccountTransactionHelper.retrieveShareAccount(shareAccountId, requestSpec, responseSpec); List> transactions = (List>) shareProductData.get("purchasedShares"); - Assert.assertNotNull(transactions); - Assert.assertEquals(1, transactions.size()); + Assertions.assertNotNull(transactions); + Assertions.assertEquals(1, transactions.size()); Map transaction = transactions.get(0); - Assert.assertEquals("30", String.valueOf(transaction.get("numberOfShares"))); - Assert.assertEquals("60.0", String.valueOf(transaction.get("amount"))); - Assert.assertEquals("60.0", String.valueOf(transaction.get("amountPaid"))); + Assertions.assertEquals("30", String.valueOf(transaction.get("numberOfShares"))); + Assertions.assertEquals("60.0", String.valueOf(transaction.get("amount"))); + Assertions.assertEquals("60.0", String.valueOf(transaction.get("amountPaid"))); List dateList = (List) transaction.get("purchasedDate"); Calendar cal = Calendar.getInstance(); cal.set(dateList.get(0), dateList.get(1) - 1, dateList.get(2)); Date date = cal.getTime(); DateFormat simple = new SimpleDateFormat("dd MMM yyyy"); - Assert.assertEquals("02 Mar 2016", simple.format(date)); + Assertions.assertEquals("02 Mar 2016", simple.format(date)); } @Test @@ -141,11 +141,11 @@ public class ShareAccountIntegrationTests { DateFormat simple = new SimpleDateFormat("dd MMM yyyy"); shareProductHelper = new ShareProductHelper(); final Integer productId = createShareProduct(); - Assert.assertNotNull(productId); + Assertions.assertNotNull(productId); final Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientId); + Assertions.assertNotNull(clientId); Integer savingsAccountId = SavingsAccountHelper.openSavingsAccount(requestSpec, responseSpec, clientId, "1000"); - Assert.assertNotNull(savingsAccountId); + Assertions.assertNotNull(savingsAccountId); String activationCharge = ChargesHelper.getShareAccountActivationChargeJson(); Integer activationChargeId = ChargesHelper.createCharges(requestSpec, responseSpec, activationCharge); String purchaseCharge = ChargesHelper.getShareAccountPurchaseChargeJson(); @@ -157,10 +157,10 @@ public class ShareAccountIntegrationTests { charges.add(createCharge(purchaseChargeId, "2")); charges.add(createCharge(redeemChargeId, "1")); final Integer shareAccountId = createShareAccount(clientId, productId, savingsAccountId, charges); - Assert.assertNotNull(shareAccountId); + Assertions.assertNotNull(shareAccountId); Map shareAccountData = ShareAccountTransactionHelper .retrieveShareAccount(shareAccountId, requestSpec, responseSpec); - Assert.assertNotNull(shareAccountData); + Assertions.assertNotNull(shareAccountData); // Approve share Account Map approveMap = new HashMap<>(); @@ -173,16 +173,16 @@ public class ShareAccountIntegrationTests { shareAccountData = ShareAccountTransactionHelper .retrieveShareAccount(shareAccountId, requestSpec, responseSpec); Map statusMap = (Map) shareAccountData.get("status"); - Assert.assertEquals("shareAccountStatusType.approved", String.valueOf(statusMap.get("code"))); + Assertions.assertEquals("shareAccountStatusType.approved", String.valueOf(statusMap.get("code"))); Map timelineMap = (Map) shareAccountData.get("timeline"); List dateList = (List) timelineMap.get("approvedDate"); Calendar cal = Calendar.getInstance(); cal.set(dateList.get(0), dateList.get(1) - 1, dateList.get(2)); Date approvedDate = cal.getTime(); - Assert.assertEquals("01 Jan 2016", simple.format(approvedDate)); + Assertions.assertEquals("01 Jan 2016", simple.format(approvedDate)); List> transactions = (List>) shareAccountData.get("purchasedShares"); - Assert.assertNotNull(transactions); - Assert.assertEquals(2, transactions.size()); + Assertions.assertNotNull(transactions); + Assertions.assertEquals(2, transactions.size()); for (int i = 0; i < transactions.size(); i++) { Map transaction = transactions.get(i); Map transactionTypeMap = (Map) transaction.get("type"); @@ -192,22 +192,22 @@ public class ShareAccountIntegrationTests { Date date = cal.getTime(); String transactionType = (String) transactionTypeMap.get("code"); if (transactionType.equals("purchasedSharesType.purchased")) { - Assert.assertEquals("25", String.valueOf(transaction.get("numberOfShares"))); - Assert.assertEquals("52.0", String.valueOf(transaction.get("amount"))); - Assert.assertEquals("52.0", String.valueOf(transaction.get("amountPaid"))); - Assert.assertEquals("2.0", String.valueOf(transaction.get("chargeAmount"))); - Assert.assertEquals("2.0", String.valueOf(transaction.get("purchasedPrice"))); - Assert.assertEquals("01 Jan 2016", simple.format(date)); + Assertions.assertEquals("25", String.valueOf(transaction.get("numberOfShares"))); + Assertions.assertEquals("52.0", String.valueOf(transaction.get("amount"))); + Assertions.assertEquals("52.0", String.valueOf(transaction.get("amountPaid"))); + Assertions.assertEquals("2.0", String.valueOf(transaction.get("chargeAmount"))); + Assertions.assertEquals("2.0", String.valueOf(transaction.get("purchasedPrice"))); + Assertions.assertEquals("01 Jan 2016", simple.format(date)); } else if (transactionType.equals("charge.payment")) { - Assert.assertEquals("2.0", String.valueOf(transaction.get("amount"))); - Assert.assertEquals("0", String.valueOf(transaction.get("amountPaid"))); - Assert.assertEquals(simple.format(Utils.getLocalDateOfTenant().toDate()), simple.format(date)); + Assertions.assertEquals("2.0", String.valueOf(transaction.get("amount"))); + Assertions.assertEquals("0", String.valueOf(transaction.get("amountPaid"))); + Assertions.assertEquals(simple.format(Utils.getLocalDateOfTenant().toDate()), simple.format(date)); } } Map summaryMap = (Map) shareAccountData.get("summary"); - Assert.assertEquals("25", String.valueOf(summaryMap.get("totalApprovedShares"))); - Assert.assertEquals("0", String.valueOf(summaryMap.get("totalPendingForApprovalShares"))); + Assertions.assertEquals("25", String.valueOf(summaryMap.get("totalApprovedShares"))); + Assertions.assertEquals("0", String.valueOf(summaryMap.get("totalPendingForApprovalShares"))); } @Test @@ -215,11 +215,11 @@ public class ShareAccountIntegrationTests { public void rejectShareAccount() { shareProductHelper = new ShareProductHelper(); final Integer productId = createShareProduct(); - Assert.assertNotNull(productId); + Assertions.assertNotNull(productId); final Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientId); + Assertions.assertNotNull(clientId); Integer savingsAccountId = SavingsAccountHelper.openSavingsAccount(requestSpec, responseSpec, clientId, "1000"); - Assert.assertNotNull(savingsAccountId); + Assertions.assertNotNull(savingsAccountId); String activationCharge = ChargesHelper.getShareAccountActivationChargeJson(); Integer activationChargeId = ChargesHelper.createCharges(requestSpec, responseSpec, activationCharge); String purchaseCharge = ChargesHelper.getShareAccountPurchaseChargeJson(); @@ -231,10 +231,10 @@ public class ShareAccountIntegrationTests { charges.add(createCharge(purchaseChargeId, "2")); charges.add(createCharge(redeemChargeId, "1")); final Integer shareAccountId = createShareAccount(clientId, productId, savingsAccountId, charges); - Assert.assertNotNull(shareAccountId); + Assertions.assertNotNull(shareAccountId); Map shareAccountData = ShareAccountTransactionHelper .retrieveShareAccount(shareAccountId, requestSpec, responseSpec); - Assert.assertNotNull(shareAccountData); + Assertions.assertNotNull(shareAccountData); // Reject share Account Map rejectMap = new HashMap<>(); @@ -245,17 +245,17 @@ public class ShareAccountIntegrationTests { .retrieveShareAccount(shareAccountId, requestSpec, responseSpec); DateFormat simple = new SimpleDateFormat("dd MMM yyyy"); Map statusMap = (Map) shareAccountData.get("status"); - Assert.assertEquals("shareAccountStatusType.rejected", String.valueOf(statusMap.get("code"))); + Assertions.assertEquals("shareAccountStatusType.rejected", String.valueOf(statusMap.get("code"))); Map timelineMap = (Map) shareAccountData.get("timeline"); List dateList = (List) timelineMap.get("rejectedDate"); Calendar cal = Calendar.getInstance(); cal.set(dateList.get(0), dateList.get(1) - 1, dateList.get(2)); Date rejectedDate = cal.getTime(); - Assert.assertEquals(simple.format(Utils.getLocalDateOfTenant().toDate()), simple.format(rejectedDate)); + Assertions.assertEquals(simple.format(Utils.getLocalDateOfTenant().toDate()), simple.format(rejectedDate)); List> transactions = (List>) shareAccountData.get("purchasedShares"); - Assert.assertNotNull(transactions); - Assert.assertEquals(2, transactions.size()); + Assertions.assertNotNull(transactions); + Assertions.assertEquals(2, transactions.size()); for (int i = 0; i < transactions.size(); i++) { Map transaction = transactions.get(i); Map transactionTypeMap = (Map) transaction.get("type"); @@ -265,23 +265,23 @@ public class ShareAccountIntegrationTests { Date date = cal.getTime(); String transactionType = (String) transactionTypeMap.get("code"); if (transactionType.equals("purchasedSharesType.purchased")) { - Assert.assertEquals("25", String.valueOf(transaction.get("numberOfShares"))); - Assert.assertEquals("50.0", String.valueOf(transaction.get("amount"))); - Assert.assertEquals("50.0", String.valueOf(transaction.get("amountPaid"))); - Assert.assertEquals("2.0", String.valueOf(transaction.get("chargeAmount"))); - Assert.assertEquals("2.0", String.valueOf(transaction.get("purchasedPrice"))); - Assert.assertEquals("01 Jan 2016", simple.format(date)); + Assertions.assertEquals("25", String.valueOf(transaction.get("numberOfShares"))); + Assertions.assertEquals("50.0", String.valueOf(transaction.get("amount"))); + Assertions.assertEquals("50.0", String.valueOf(transaction.get("amountPaid"))); + Assertions.assertEquals("2.0", String.valueOf(transaction.get("chargeAmount"))); + Assertions.assertEquals("2.0", String.valueOf(transaction.get("purchasedPrice"))); + Assertions.assertEquals("01 Jan 2016", simple.format(date)); } else if (transactionType.equals("charge.payment")) { - Assert.assertEquals("2.0", String.valueOf(transaction.get("amount"))); - Assert.assertEquals("0", String.valueOf(transaction.get("amountPaid"))); + Assertions.assertEquals("2.0", String.valueOf(transaction.get("amount"))); + Assertions.assertEquals("0", String.valueOf(transaction.get("amountPaid"))); Date transactionDate = DateUtils.getDateOfTenant() ; - Assert.assertEquals(simple.format(transactionDate), simple.format(date)); + Assertions.assertEquals(simple.format(transactionDate), simple.format(date)); } } Map summaryMap = (Map) shareAccountData.get("summary"); - Assert.assertEquals("0", String.valueOf(summaryMap.get("totalApprovedShares"))); - Assert.assertEquals("0", String.valueOf(summaryMap.get("totalPendingForApprovalShares"))); + Assertions.assertEquals("0", String.valueOf(summaryMap.get("totalApprovedShares"))); + Assertions.assertEquals("0", String.valueOf(summaryMap.get("totalPendingForApprovalShares"))); } @Test @@ -290,11 +290,11 @@ public class ShareAccountIntegrationTests { DateFormat simple = new SimpleDateFormat("dd MMM yyyy"); shareProductHelper = new ShareProductHelper(); final Integer productId = createShareProduct(); - Assert.assertNotNull(productId); + Assertions.assertNotNull(productId); final Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientId); + Assertions.assertNotNull(clientId); Integer savingsAccountId = SavingsAccountHelper.openSavingsAccount(requestSpec, responseSpec, clientId, "1000"); - Assert.assertNotNull(savingsAccountId); + Assertions.assertNotNull(savingsAccountId); String activationCharge = ChargesHelper.getShareAccountActivationChargeJson(); Integer activationChargeId = ChargesHelper.createCharges(requestSpec, responseSpec, activationCharge); String purchaseCharge = ChargesHelper.getShareAccountPurchaseChargeJson(); @@ -306,10 +306,10 @@ public class ShareAccountIntegrationTests { charges.add(createCharge(purchaseChargeId, "2")); charges.add(createCharge(redeemChargeId, "1")); final Integer shareAccountId = createShareAccount(clientId, productId, savingsAccountId, charges); - Assert.assertNotNull(shareAccountId); + Assertions.assertNotNull(shareAccountId); Map shareAccountData = ShareAccountTransactionHelper .retrieveShareAccount(shareAccountId, requestSpec, responseSpec); - Assert.assertNotNull(shareAccountData); + Assertions.assertNotNull(shareAccountData); // Approve share Account Map approveMap = new HashMap<>(); @@ -322,13 +322,13 @@ public class ShareAccountIntegrationTests { shareAccountData = ShareAccountTransactionHelper .retrieveShareAccount(shareAccountId, requestSpec, responseSpec); Map statusMap = (Map) shareAccountData.get("status"); - Assert.assertEquals("shareAccountStatusType.approved", String.valueOf(statusMap.get("code"))); + Assertions.assertEquals("shareAccountStatusType.approved", String.valueOf(statusMap.get("code"))); Map timelineMap = (Map) shareAccountData.get("timeline"); List dateList = (List) timelineMap.get("approvedDate"); Calendar cal = Calendar.getInstance(); cal.set(dateList.get(0), dateList.get(1) - 1, dateList.get(2)); Date approvedDate = cal.getTime(); - Assert.assertEquals("01 Jan 2016", simple.format(approvedDate)); + Assertions.assertEquals("01 Jan 2016", simple.format(approvedDate)); // Undo Approval share Account Map undoApprovalMap = new HashMap<>(); @@ -339,11 +339,11 @@ public class ShareAccountIntegrationTests { .retrieveShareAccount(shareAccountId, requestSpec, responseSpec); statusMap = (Map) shareAccountData.get("status"); - Assert.assertEquals("shareAccountStatusType.submitted.and.pending.approval", String.valueOf(statusMap.get("code"))); + Assertions.assertEquals("shareAccountStatusType.submitted.and.pending.approval", String.valueOf(statusMap.get("code"))); List> transactions = (List>) shareAccountData.get("purchasedShares"); - Assert.assertNotNull(transactions); - Assert.assertEquals(2, transactions.size()); + Assertions.assertNotNull(transactions); + Assertions.assertEquals(2, transactions.size()); for (int i = 0; i < transactions.size(); i++) { Map transaction = transactions.get(i); Map transactionTypeMap = (Map) transaction.get("type"); @@ -353,22 +353,22 @@ public class ShareAccountIntegrationTests { Date date = cal.getTime(); String transactionType = (String) transactionTypeMap.get("code"); if (transactionType.equals("purchasedSharesType.purchased")) { - Assert.assertEquals("25", String.valueOf(transaction.get("numberOfShares"))); - Assert.assertEquals("52.0", String.valueOf(transaction.get("amount"))); - Assert.assertEquals("0.0", String.valueOf(transaction.get("amountPaid"))); - Assert.assertEquals("2.0", String.valueOf(transaction.get("chargeAmount"))); - Assert.assertEquals("2.0", String.valueOf(transaction.get("purchasedPrice"))); - Assert.assertEquals("01 Jan 2016", simple.format(date)); + Assertions.assertEquals("25", String.valueOf(transaction.get("numberOfShares"))); + Assertions.assertEquals("52.0", String.valueOf(transaction.get("amount"))); + Assertions.assertEquals("0.0", String.valueOf(transaction.get("amountPaid"))); + Assertions.assertEquals("2.0", String.valueOf(transaction.get("chargeAmount"))); + Assertions.assertEquals("2.0", String.valueOf(transaction.get("purchasedPrice"))); + Assertions.assertEquals("01 Jan 2016", simple.format(date)); } else if (transactionType.equals("charge.payment")) { - Assert.assertEquals("2.0", String.valueOf(transaction.get("amount"))); - Assert.assertEquals("0", String.valueOf(transaction.get("amountPaid"))); - Assert.assertEquals(simple.format(Utils.getLocalDateOfTenant().toDate()), simple.format(date)); + Assertions.assertEquals("2.0", String.valueOf(transaction.get("amount"))); + Assertions.assertEquals("0", String.valueOf(transaction.get("amountPaid"))); + Assertions.assertEquals(simple.format(Utils.getLocalDateOfTenant().toDate()), simple.format(date)); } } Map summaryMap = (Map) shareAccountData.get("summary"); - Assert.assertEquals("0", String.valueOf(summaryMap.get("totalApprovedShares"))); - Assert.assertEquals("25", String.valueOf(summaryMap.get("totalPendingForApprovalShares"))); + Assertions.assertEquals("0", String.valueOf(summaryMap.get("totalApprovedShares"))); + Assertions.assertEquals("25", String.valueOf(summaryMap.get("totalPendingForApprovalShares"))); } @SuppressWarnings("unchecked") @@ -376,11 +376,11 @@ public class ShareAccountIntegrationTests { public void testCreateShareAccountWithCharges() { shareProductHelper = new ShareProductHelper(); final Integer productId = createShareProduct(); - Assert.assertNotNull(productId); + Assertions.assertNotNull(productId); final Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientId); + Assertions.assertNotNull(clientId); Integer savingsAccountId = SavingsAccountHelper.openSavingsAccount(requestSpec, responseSpec, clientId, "1000"); - Assert.assertNotNull(savingsAccountId); + Assertions.assertNotNull(savingsAccountId); String activationCharge = ChargesHelper.getShareAccountActivationChargeJson(); Integer activationChargeId = ChargesHelper.createCharges(requestSpec, responseSpec, activationCharge); String purchaseCharge = ChargesHelper.getShareAccountPurchaseChargeJson(); @@ -392,10 +392,10 @@ public class ShareAccountIntegrationTests { charges.add(createCharge(purchaseChargeId, "2")); charges.add(createCharge(redeemChargeId, "1")); final Integer shareAccountId = createShareAccount(clientId, productId, savingsAccountId, charges); - Assert.assertNotNull(shareAccountId); + Assertions.assertNotNull(shareAccountId); Map shareAccountData = ShareAccountTransactionHelper .retrieveShareAccount(shareAccountId, requestSpec, responseSpec); - Assert.assertNotNull(shareAccountData); + Assertions.assertNotNull(shareAccountData); Map shareAccountDataForUpdate = new HashMap<>(); shareAccountDataForUpdate.put("requestedShares", 30); @@ -408,8 +408,8 @@ public class ShareAccountIntegrationTests { ShareAccountTransactionHelper.updateShareAccount(shareAccountId, updateShareAccountJsonString, requestSpec, responseSpec); shareAccountData = ShareAccountTransactionHelper.retrieveShareAccount(shareAccountId, requestSpec, responseSpec); List> transactions = (List>) shareAccountData.get("purchasedShares"); - Assert.assertNotNull(transactions); - Assert.assertEquals(2, transactions.size()); + Assertions.assertNotNull(transactions); + Assertions.assertEquals(2, transactions.size()); DateFormat simple = new SimpleDateFormat("dd MMM yyyy"); for (int i = 0; i < transactions.size(); i++) { Map transaction = transactions.get(i); @@ -420,16 +420,16 @@ public class ShareAccountIntegrationTests { Date date = cal.getTime(); String transactionType = (String) transactionTypeMap.get("code"); if (transactionType.equals("purchasedSharesType.purchased")) { - Assert.assertEquals("30", String.valueOf(transaction.get("numberOfShares"))); - Assert.assertEquals("62.0", String.valueOf(transaction.get("amount"))); - Assert.assertEquals("60.0", String.valueOf(transaction.get("amountPaid"))); - Assert.assertEquals("2.0", String.valueOf(transaction.get("chargeAmount"))); - Assert.assertEquals("2.0", String.valueOf(transaction.get("purchasedPrice"))); - Assert.assertEquals("02 Mar 2016", simple.format(date)); + Assertions.assertEquals("30", String.valueOf(transaction.get("numberOfShares"))); + Assertions.assertEquals("62.0", String.valueOf(transaction.get("amount"))); + Assertions.assertEquals("60.0", String.valueOf(transaction.get("amountPaid"))); + Assertions.assertEquals("2.0", String.valueOf(transaction.get("chargeAmount"))); + Assertions.assertEquals("2.0", String.valueOf(transaction.get("purchasedPrice"))); + Assertions.assertEquals("02 Mar 2016", simple.format(date)); } else if (transactionType.equals("charge.payment")) { - Assert.assertEquals("2.0", String.valueOf(transaction.get("amount"))); - Assert.assertEquals("0", String.valueOf(transaction.get("amountPaid"))); - Assert.assertEquals("0", String.valueOf(transaction.get("chargeAmount"))); + Assertions.assertEquals("2.0", String.valueOf(transaction.get("amount"))); + Assertions.assertEquals("0", String.valueOf(transaction.get("amountPaid"))); + Assertions.assertEquals("0", String.valueOf(transaction.get("chargeAmount"))); } } @@ -439,20 +439,20 @@ public class ShareAccountIntegrationTests { Map chargeTimeTypeMap = (Map) chargeDef.get("chargeTimeType") ; String chargeTimeType = String.valueOf(chargeTimeTypeMap.get("code")) ; if(chargeTimeType.equals("chargeTimeType.activation")) { - Assert.assertEquals("2.0", String.valueOf(chargeDef.get("amount"))); - Assert.assertEquals("2.0", String.valueOf(chargeDef.get("amountOutstanding"))); - Assert.assertEquals("0", String.valueOf(chargeDef.get("amountPaid"))); + Assertions.assertEquals("2.0", String.valueOf(chargeDef.get("amount"))); + Assertions.assertEquals("2.0", String.valueOf(chargeDef.get("amountOutstanding"))); + Assertions.assertEquals("0", String.valueOf(chargeDef.get("amountPaid"))); }else if(chargeTimeType.equals("chargeTimeType.sharespurchase")) { - Assert.assertEquals("2.0", String.valueOf(chargeDef.get("amount"))); - Assert.assertEquals("2.0", String.valueOf(chargeDef.get("amountOutstanding"))); - Assert.assertEquals("0", String.valueOf(chargeDef.get("amountPaid"))); + Assertions.assertEquals("2.0", String.valueOf(chargeDef.get("amount"))); + Assertions.assertEquals("2.0", String.valueOf(chargeDef.get("amountOutstanding"))); + Assertions.assertEquals("0", String.valueOf(chargeDef.get("amountPaid"))); }else if(chargeTimeType.equals("chargeTimeType.sharesredeem")) { - Assert.assertEquals("1.0", String.valueOf(chargeDef.get("amountOrPercentage"))); - Assert.assertEquals("0.0", String.valueOf(chargeDef.get("amount"))); - Assert.assertEquals("0.0", String.valueOf(chargeDef.get("amountOutstanding"))); - Assert.assertEquals("0", String.valueOf(chargeDef.get("amountPaid"))); + Assertions.assertEquals("1.0", String.valueOf(chargeDef.get("amountOrPercentage"))); + Assertions.assertEquals("0.0", String.valueOf(chargeDef.get("amount"))); + Assertions.assertEquals("0.0", String.valueOf(chargeDef.get("amountOutstanding"))); + Assertions.assertEquals("0", String.valueOf(chargeDef.get("amountPaid"))); }else { - Assert.fail("Other Charge defintion found"); + Assertions.fail("Other Charge defintion found"); } } @@ -467,13 +467,13 @@ public class ShareAccountIntegrationTests { shareAccountData = ShareAccountTransactionHelper .retrieveShareAccount(shareAccountId, requestSpec, responseSpec); Map statusMap = (Map) shareAccountData.get("status"); - Assert.assertEquals("shareAccountStatusType.approved", String.valueOf(statusMap.get("code"))); + Assertions.assertEquals("shareAccountStatusType.approved", String.valueOf(statusMap.get("code"))); Map timelineMap = (Map) shareAccountData.get("timeline"); List dateList = (List) timelineMap.get("approvedDate"); Calendar cal = Calendar.getInstance(); cal.set(dateList.get(0), dateList.get(1) - 1, dateList.get(2)); Date approvedDate = cal.getTime(); - Assert.assertEquals("01 Jan 2016", simple.format(approvedDate)); + Assertions.assertEquals("01 Jan 2016", simple.format(approvedDate)); //charges verification chargesList = (List>) shareAccountData.get("charges") ; @@ -481,20 +481,20 @@ public class ShareAccountIntegrationTests { Map chargeTimeTypeMap = (Map) chargeDef.get("chargeTimeType") ; String chargeTimeType = String.valueOf(chargeTimeTypeMap.get("code")) ; if(chargeTimeType.equals("chargeTimeType.activation")) { - Assert.assertEquals("2.0", String.valueOf(chargeDef.get("amount"))); - Assert.assertEquals("2.0", String.valueOf(chargeDef.get("amountOutstanding"))); - Assert.assertEquals("0", String.valueOf(chargeDef.get("amountPaid"))); + Assertions.assertEquals("2.0", String.valueOf(chargeDef.get("amount"))); + Assertions.assertEquals("2.0", String.valueOf(chargeDef.get("amountOutstanding"))); + Assertions.assertEquals("0", String.valueOf(chargeDef.get("amountPaid"))); }else if(chargeTimeType.equals("chargeTimeType.sharespurchase")) { - Assert.assertEquals("2.0", String.valueOf(chargeDef.get("amount"))); - Assert.assertEquals("0.0", String.valueOf(chargeDef.get("amountOutstanding"))); - Assert.assertEquals("2.0", String.valueOf(chargeDef.get("amountPaid"))); + Assertions.assertEquals("2.0", String.valueOf(chargeDef.get("amount"))); + Assertions.assertEquals("0.0", String.valueOf(chargeDef.get("amountOutstanding"))); + Assertions.assertEquals("2.0", String.valueOf(chargeDef.get("amountPaid"))); }else if(chargeTimeType.equals("chargeTimeType.sharesredeem")) { - Assert.assertEquals("1.0", String.valueOf(chargeDef.get("amountOrPercentage"))); - Assert.assertEquals("0.0", String.valueOf(chargeDef.get("amount"))); - Assert.assertEquals("0.0", String.valueOf(chargeDef.get("amountOutstanding"))); - Assert.assertEquals("0", String.valueOf(chargeDef.get("amountPaid"))); + Assertions.assertEquals("1.0", String.valueOf(chargeDef.get("amountOrPercentage"))); + Assertions.assertEquals("0.0", String.valueOf(chargeDef.get("amount"))); + Assertions.assertEquals("0.0", String.valueOf(chargeDef.get("amountOutstanding"))); + Assertions.assertEquals("0", String.valueOf(chargeDef.get("amountPaid"))); }else { - Assert.fail("Other Charge defintion found"); + Assertions.fail("Other Charge defintion found"); } } @@ -506,17 +506,17 @@ public class ShareAccountIntegrationTests { ShareAccountTransactionHelper.postCommand("activate", shareAccountId, activateJson, requestSpec, responseSpec); shareAccountData = ShareAccountTransactionHelper.retrieveShareAccount(shareAccountId, requestSpec, responseSpec); statusMap = (Map) shareAccountData.get("status"); - Assert.assertEquals("shareAccountStatusType.active", String.valueOf(statusMap.get("code"))); + Assertions.assertEquals("shareAccountStatusType.active", String.valueOf(statusMap.get("code"))); timelineMap = (Map) shareAccountData.get("timeline"); dateList = (List) timelineMap.get("activatedDate"); cal = Calendar.getInstance(); cal.set(dateList.get(0), dateList.get(1) - 1, dateList.get(2)); Date activatedDate = cal.getTime(); - Assert.assertEquals("01 Jan 2016", simple.format(activatedDate)); + Assertions.assertEquals("01 Jan 2016", simple.format(activatedDate)); transactions = (List>) shareAccountData.get("purchasedShares"); - Assert.assertNotNull(transactions); - Assert.assertEquals(2, transactions.size()); + Assertions.assertNotNull(transactions); + Assertions.assertEquals(2, transactions.size()); for (int i = 0; i < transactions.size(); i++) { Map transaction = transactions.get(i); Map transactionTypeMap = (Map) transaction.get("type"); @@ -526,17 +526,17 @@ public class ShareAccountIntegrationTests { Date date = cal.getTime(); String transactionType = (String) transactionTypeMap.get("code"); if (transactionType.equals("purchasedSharesType.purchased")) { - Assert.assertEquals("30", String.valueOf(transaction.get("numberOfShares"))); - Assert.assertEquals("62.0", String.valueOf(transaction.get("amount"))); - Assert.assertEquals("62.0", String.valueOf(transaction.get("amountPaid"))); - Assert.assertEquals("2.0", String.valueOf(transaction.get("chargeAmount"))); - Assert.assertEquals("2.0", String.valueOf(transaction.get("purchasedPrice"))); - Assert.assertEquals("02 Mar 2016", simple.format(date)); + Assertions.assertEquals("30", String.valueOf(transaction.get("numberOfShares"))); + Assertions.assertEquals("62.0", String.valueOf(transaction.get("amount"))); + Assertions.assertEquals("62.0", String.valueOf(transaction.get("amountPaid"))); + Assertions.assertEquals("2.0", String.valueOf(transaction.get("chargeAmount"))); + Assertions.assertEquals("2.0", String.valueOf(transaction.get("purchasedPrice"))); + Assertions.assertEquals("02 Mar 2016", simple.format(date)); } else if (transactionType.equals("charge.payment")) { - Assert.assertEquals("2.0", String.valueOf(transaction.get("amount"))); - Assert.assertEquals("2.0", String.valueOf(transaction.get("amountPaid"))); - Assert.assertEquals("0", String.valueOf(transaction.get("chargeAmount"))); - Assert.assertEquals("01 Jan 2016", simple.format(date)); + Assertions.assertEquals("2.0", String.valueOf(transaction.get("amount"))); + Assertions.assertEquals("2.0", String.valueOf(transaction.get("amountPaid"))); + Assertions.assertEquals("0", String.valueOf(transaction.get("chargeAmount"))); + Assertions.assertEquals("01 Jan 2016", simple.format(date)); } } @@ -546,26 +546,26 @@ public class ShareAccountIntegrationTests { Map chargeTimeTypeMap = (Map) chargeDef.get("chargeTimeType") ; String chargeTimeType = String.valueOf(chargeTimeTypeMap.get("code")) ; if(chargeTimeType.equals("chargeTimeType.activation")) { - Assert.assertEquals("2.0", String.valueOf(chargeDef.get("amount"))); - Assert.assertEquals("0.0", String.valueOf(chargeDef.get("amountOutstanding"))); - Assert.assertEquals("2.0", String.valueOf(chargeDef.get("amountPaid"))); + Assertions.assertEquals("2.0", String.valueOf(chargeDef.get("amount"))); + Assertions.assertEquals("0.0", String.valueOf(chargeDef.get("amountOutstanding"))); + Assertions.assertEquals("2.0", String.valueOf(chargeDef.get("amountPaid"))); }else if(chargeTimeType.equals("chargeTimeType.sharespurchase")) { - Assert.assertEquals("2.0", String.valueOf(chargeDef.get("amount"))); - Assert.assertEquals("0.0", String.valueOf(chargeDef.get("amountOutstanding"))); - Assert.assertEquals("2.0", String.valueOf(chargeDef.get("amountPaid"))); + Assertions.assertEquals("2.0", String.valueOf(chargeDef.get("amount"))); + Assertions.assertEquals("0.0", String.valueOf(chargeDef.get("amountOutstanding"))); + Assertions.assertEquals("2.0", String.valueOf(chargeDef.get("amountPaid"))); }else if(chargeTimeType.equals("chargeTimeType.sharesredeem")) { - Assert.assertEquals("1.0", String.valueOf(chargeDef.get("amountOrPercentage"))); - Assert.assertEquals("0.0", String.valueOf(chargeDef.get("amount"))); - Assert.assertEquals("0.0", String.valueOf(chargeDef.get("amountOutstanding"))); - Assert.assertEquals("0", String.valueOf(chargeDef.get("amountPaid"))); + Assertions.assertEquals("1.0", String.valueOf(chargeDef.get("amountOrPercentage"))); + Assertions.assertEquals("0.0", String.valueOf(chargeDef.get("amount"))); + Assertions.assertEquals("0.0", String.valueOf(chargeDef.get("amountOutstanding"))); + Assertions.assertEquals("0", String.valueOf(chargeDef.get("amountPaid"))); }else { - Assert.fail("Other Charge defintion found"); + Assertions.fail("Other Charge defintion found"); } } Map summaryMap = (Map) shareAccountData.get("summary"); - Assert.assertEquals("30", String.valueOf(summaryMap.get("totalApprovedShares"))); - Assert.assertEquals("0", String.valueOf(summaryMap.get("totalPendingForApprovalShares"))); + Assertions.assertEquals("30", String.valueOf(summaryMap.get("totalApprovedShares"))); + Assertions.assertEquals("0", String.valueOf(summaryMap.get("totalPendingForApprovalShares"))); // apply additional shares Map additionalSharesRequestMap = new HashMap<>(); @@ -578,8 +578,8 @@ public class ShareAccountIntegrationTests { responseSpec); shareAccountData = ShareAccountTransactionHelper.retrieveShareAccount(shareAccountId, requestSpec, responseSpec); transactions = (List>) shareAccountData.get("purchasedShares"); - Assert.assertNotNull(transactions); - Assert.assertEquals(3, transactions.size()); + Assertions.assertNotNull(transactions); + Assertions.assertEquals(3, transactions.size()); String addtionalSharesRequestId = null; for (int i = 0; i < transactions.size(); i++) { Map transaction = transactions.get(i); @@ -591,26 +591,26 @@ public class ShareAccountIntegrationTests { String transactionType = (String) transactionTypeMap.get("code"); String transactionDate = simple.format(date); if (transactionType.equals("purchasedSharesType.purchased") && transactionDate.equals("02 Mar 2016")) { - Assert.assertEquals("30", String.valueOf(transaction.get("numberOfShares"))); - Assert.assertEquals("62.0", String.valueOf(transaction.get("amount"))); - Assert.assertEquals("62.0", String.valueOf(transaction.get("amountPaid"))); - Assert.assertEquals("2.0", String.valueOf(transaction.get("chargeAmount"))); - Assert.assertEquals("2.0", String.valueOf(transaction.get("purchasedPrice"))); + Assertions.assertEquals("30", String.valueOf(transaction.get("numberOfShares"))); + Assertions.assertEquals("62.0", String.valueOf(transaction.get("amount"))); + Assertions.assertEquals("62.0", String.valueOf(transaction.get("amountPaid"))); + Assertions.assertEquals("2.0", String.valueOf(transaction.get("chargeAmount"))); + Assertions.assertEquals("2.0", String.valueOf(transaction.get("purchasedPrice"))); } else if (transactionType.equals("purchasedSharesType.purchased") && transactionDate.equals("01 Apr 2016")) { addtionalSharesRequestId = String.valueOf(transaction.get("id")); - Assert.assertEquals("15", String.valueOf(transaction.get("numberOfShares"))); - Assert.assertEquals("32.0", String.valueOf(transaction.get("amount"))); - Assert.assertEquals("30.0", String.valueOf(transaction.get("amountPaid"))); - Assert.assertEquals("2.0", String.valueOf(transaction.get("chargeAmount"))); - Assert.assertEquals("2.0", String.valueOf(transaction.get("purchasedPrice"))); + Assertions.assertEquals("15", String.valueOf(transaction.get("numberOfShares"))); + Assertions.assertEquals("32.0", String.valueOf(transaction.get("amount"))); + Assertions.assertEquals("30.0", String.valueOf(transaction.get("amountPaid"))); + Assertions.assertEquals("2.0", String.valueOf(transaction.get("chargeAmount"))); + Assertions.assertEquals("2.0", String.valueOf(transaction.get("purchasedPrice"))); Map transactionstatusMap = (Map) transaction.get("status"); - Assert.assertEquals("purchasedSharesStatusType.applied", String.valueOf(transactionstatusMap.get("code"))); + Assertions.assertEquals("purchasedSharesStatusType.applied", String.valueOf(transactionstatusMap.get("code"))); } else if (transactionType.equals("charge.payment")) { - Assert.assertEquals("2.0", String.valueOf(transaction.get("amount"))); - Assert.assertEquals("2.0", String.valueOf(transaction.get("amountPaid"))); - Assert.assertEquals("0", String.valueOf(transaction.get("chargeAmount"))); - Assert.assertEquals("01 Jan 2016", transactionDate); + Assertions.assertEquals("2.0", String.valueOf(transaction.get("amount"))); + Assertions.assertEquals("2.0", String.valueOf(transaction.get("amountPaid"))); + Assertions.assertEquals("0", String.valueOf(transaction.get("chargeAmount"))); + Assertions.assertEquals("01 Jan 2016", transactionDate); } } @@ -620,26 +620,26 @@ public class ShareAccountIntegrationTests { Map chargeTimeTypeMap = (Map) chargeDef.get("chargeTimeType") ; String chargeTimeType = String.valueOf(chargeTimeTypeMap.get("code")) ; if(chargeTimeType.equals("chargeTimeType.activation")) { - Assert.assertEquals("2.0", String.valueOf(chargeDef.get("amount"))); - Assert.assertEquals("0.0", String.valueOf(chargeDef.get("amountOutstanding"))); - Assert.assertEquals("2.0", String.valueOf(chargeDef.get("amountPaid"))); + Assertions.assertEquals("2.0", String.valueOf(chargeDef.get("amount"))); + Assertions.assertEquals("0.0", String.valueOf(chargeDef.get("amountOutstanding"))); + Assertions.assertEquals("2.0", String.valueOf(chargeDef.get("amountPaid"))); }else if(chargeTimeType.equals("chargeTimeType.sharespurchase")) { - Assert.assertEquals("4.0", String.valueOf(chargeDef.get("amount"))); - Assert.assertEquals("2.0", String.valueOf(chargeDef.get("amountOutstanding"))); - Assert.assertEquals("2.0", String.valueOf(chargeDef.get("amountPaid"))); + Assertions.assertEquals("4.0", String.valueOf(chargeDef.get("amount"))); + Assertions.assertEquals("2.0", String.valueOf(chargeDef.get("amountOutstanding"))); + Assertions.assertEquals("2.0", String.valueOf(chargeDef.get("amountPaid"))); }else if(chargeTimeType.equals("chargeTimeType.sharesredeem")) { - Assert.assertEquals("1.0", String.valueOf(chargeDef.get("amountOrPercentage"))); - Assert.assertEquals("0.0", String.valueOf(chargeDef.get("amount"))); - Assert.assertEquals("0.0", String.valueOf(chargeDef.get("amountOutstanding"))); - Assert.assertEquals("0", String.valueOf(chargeDef.get("amountPaid"))); + Assertions.assertEquals("1.0", String.valueOf(chargeDef.get("amountOrPercentage"))); + Assertions.assertEquals("0.0", String.valueOf(chargeDef.get("amount"))); + Assertions.assertEquals("0.0", String.valueOf(chargeDef.get("amountOutstanding"))); + Assertions.assertEquals("0", String.valueOf(chargeDef.get("amountPaid"))); }else { - Assert.fail("Other Charge defintion found"); + Assertions.fail("Other Charge defintion found"); } } summaryMap = (Map) shareAccountData.get("summary"); - Assert.assertEquals("30", String.valueOf(summaryMap.get("totalApprovedShares"))); - Assert.assertEquals("15", String.valueOf(summaryMap.get("totalPendingForApprovalShares"))); + Assertions.assertEquals("30", String.valueOf(summaryMap.get("totalApprovedShares"))); + Assertions.assertEquals("15", String.valueOf(summaryMap.get("totalPendingForApprovalShares"))); // Approve additional Shares request Map>> approveadditionalsharesMap = new HashMap<>(); @@ -654,8 +654,8 @@ public class ShareAccountIntegrationTests { shareAccountData = ShareAccountTransactionHelper.retrieveShareAccount(shareAccountId, requestSpec, responseSpec); transactions = (List>) shareAccountData.get("purchasedShares"); - Assert.assertNotNull(transactions); - Assert.assertEquals(3, transactions.size()); + Assertions.assertNotNull(transactions); + Assertions.assertEquals(3, transactions.size()); for (int i = 0; i < transactions.size(); i++) { Map transaction = transactions.get(i); Map transactionTypeMap = (Map) transaction.get("type"); @@ -666,25 +666,25 @@ public class ShareAccountIntegrationTests { String transactionType = (String) transactionTypeMap.get("code"); String transactionDate = simple.format(date); if (transactionType.equals("purchasedSharesType.purchased") && transactionDate.equals("02 Mar 2016")) { - Assert.assertEquals("30", String.valueOf(transaction.get("numberOfShares"))); - Assert.assertEquals("62.0", String.valueOf(transaction.get("amount"))); - Assert.assertEquals("62.0", String.valueOf(transaction.get("amountPaid"))); - Assert.assertEquals("2.0", String.valueOf(transaction.get("chargeAmount"))); - Assert.assertEquals("2.0", String.valueOf(transaction.get("purchasedPrice"))); + Assertions.assertEquals("30", String.valueOf(transaction.get("numberOfShares"))); + Assertions.assertEquals("62.0", String.valueOf(transaction.get("amount"))); + Assertions.assertEquals("62.0", String.valueOf(transaction.get("amountPaid"))); + Assertions.assertEquals("2.0", String.valueOf(transaction.get("chargeAmount"))); + Assertions.assertEquals("2.0", String.valueOf(transaction.get("purchasedPrice"))); } else if (transactionType.equals("purchasedSharesType.purchased") && transactionDate.equals("01 Apr 2016")) { - Assert.assertEquals("15", String.valueOf(transaction.get("numberOfShares"))); - Assert.assertEquals("32.0", String.valueOf(transaction.get("amount"))); - Assert.assertEquals("32.0", String.valueOf(transaction.get("amountPaid"))); - Assert.assertEquals("2.0", String.valueOf(transaction.get("chargeAmount"))); - Assert.assertEquals("2.0", String.valueOf(transaction.get("purchasedPrice"))); + Assertions.assertEquals("15", String.valueOf(transaction.get("numberOfShares"))); + Assertions.assertEquals("32.0", String.valueOf(transaction.get("amount"))); + Assertions.assertEquals("32.0", String.valueOf(transaction.get("amountPaid"))); + Assertions.assertEquals("2.0", String.valueOf(transaction.get("chargeAmount"))); + Assertions.assertEquals("2.0", String.valueOf(transaction.get("purchasedPrice"))); Map transactionstatusMap = (Map) transaction.get("status"); - Assert.assertEquals("purchasedSharesStatusType.approved", String.valueOf(transactionstatusMap.get("code"))); + Assertions.assertEquals("purchasedSharesStatusType.approved", String.valueOf(transactionstatusMap.get("code"))); } else if (transactionType.equals("charge.payment")) { - Assert.assertEquals("2.0", String.valueOf(transaction.get("amount"))); - Assert.assertEquals("2.0", String.valueOf(transaction.get("amountPaid"))); - Assert.assertEquals("0", String.valueOf(transaction.get("chargeAmount"))); - Assert.assertEquals("01 Jan 2016", transactionDate); + Assertions.assertEquals("2.0", String.valueOf(transaction.get("amount"))); + Assertions.assertEquals("2.0", String.valueOf(transaction.get("amountPaid"))); + Assertions.assertEquals("0", String.valueOf(transaction.get("chargeAmount"))); + Assertions.assertEquals("01 Jan 2016", transactionDate); } } @@ -694,26 +694,26 @@ public class ShareAccountIntegrationTests { Map chargeTimeTypeMap = (Map) chargeDef.get("chargeTimeType") ; String chargeTimeType = String.valueOf(chargeTimeTypeMap.get("code")) ; if(chargeTimeType.equals("chargeTimeType.activation")) { - Assert.assertEquals("2.0", String.valueOf(chargeDef.get("amount"))); - Assert.assertEquals("0.0", String.valueOf(chargeDef.get("amountOutstanding"))); - Assert.assertEquals("2.0", String.valueOf(chargeDef.get("amountPaid"))); + Assertions.assertEquals("2.0", String.valueOf(chargeDef.get("amount"))); + Assertions.assertEquals("0.0", String.valueOf(chargeDef.get("amountOutstanding"))); + Assertions.assertEquals("2.0", String.valueOf(chargeDef.get("amountPaid"))); }else if(chargeTimeType.equals("chargeTimeType.sharespurchase")) { - Assert.assertEquals("4.0", String.valueOf(chargeDef.get("amount"))); - Assert.assertEquals("0.0", String.valueOf(chargeDef.get("amountOutstanding"))); - Assert.assertEquals("4.0", String.valueOf(chargeDef.get("amountPaid"))); + Assertions.assertEquals("4.0", String.valueOf(chargeDef.get("amount"))); + Assertions.assertEquals("0.0", String.valueOf(chargeDef.get("amountOutstanding"))); + Assertions.assertEquals("4.0", String.valueOf(chargeDef.get("amountPaid"))); }else if(chargeTimeType.equals("chargeTimeType.sharesredeem")) { - Assert.assertEquals("1.0", String.valueOf(chargeDef.get("amountOrPercentage"))); - Assert.assertEquals("0.0", String.valueOf(chargeDef.get("amount"))); - Assert.assertEquals("0.0", String.valueOf(chargeDef.get("amountOutstanding"))); - Assert.assertEquals("0", String.valueOf(chargeDef.get("amountPaid"))); + Assertions.assertEquals("1.0", String.valueOf(chargeDef.get("amountOrPercentage"))); + Assertions.assertEquals("0.0", String.valueOf(chargeDef.get("amount"))); + Assertions.assertEquals("0.0", String.valueOf(chargeDef.get("amountOutstanding"))); + Assertions.assertEquals("0", String.valueOf(chargeDef.get("amountPaid"))); }else { - Assert.fail("Other Charge defintion found"); + Assertions.fail("Other Charge defintion found"); } } summaryMap = (Map) shareAccountData.get("summary"); - Assert.assertEquals("45", String.valueOf(summaryMap.get("totalApprovedShares"))); - Assert.assertEquals("0", String.valueOf(summaryMap.get("totalPendingForApprovalShares"))); + Assertions.assertEquals("45", String.valueOf(summaryMap.get("totalApprovedShares"))); + Assertions.assertEquals("0", String.valueOf(summaryMap.get("totalPendingForApprovalShares"))); // apply aditional shres and reject it additionalSharesRequestMap = new HashMap<>(); @@ -726,8 +726,8 @@ public class ShareAccountIntegrationTests { responseSpec); shareAccountData = ShareAccountTransactionHelper.retrieveShareAccount(shareAccountId, requestSpec, responseSpec); transactions = (List>) shareAccountData.get("purchasedShares"); - Assert.assertNotNull(transactions); - Assert.assertEquals(4, transactions.size()); + Assertions.assertNotNull(transactions); + Assertions.assertEquals(4, transactions.size()); addtionalSharesRequestId = null; for (int i = 0; i < transactions.size(); i++) { Map transaction = transactions.get(i); @@ -740,13 +740,13 @@ public class ShareAccountIntegrationTests { String transactionDate = simple.format(date); if (transactionType.equals("purchasedSharesType.purchased") && transactionDate.equals("01 May 2016")) { addtionalSharesRequestId = String.valueOf(transaction.get("id")); - Assert.assertEquals("20", String.valueOf(transaction.get("numberOfShares"))); - Assert.assertEquals("42.0", String.valueOf(transaction.get("amount"))); - Assert.assertEquals("40.0", String.valueOf(transaction.get("amountPaid"))); - Assert.assertEquals("2.0", String.valueOf(transaction.get("chargeAmount"))); - Assert.assertEquals("2.0", String.valueOf(transaction.get("purchasedPrice"))); + Assertions.assertEquals("20", String.valueOf(transaction.get("numberOfShares"))); + Assertions.assertEquals("42.0", String.valueOf(transaction.get("amount"))); + Assertions.assertEquals("40.0", String.valueOf(transaction.get("amountPaid"))); + Assertions.assertEquals("2.0", String.valueOf(transaction.get("chargeAmount"))); + Assertions.assertEquals("2.0", String.valueOf(transaction.get("purchasedPrice"))); Map transactionstatusMap = (Map) transaction.get("status"); - Assert.assertEquals("purchasedSharesStatusType.applied", String.valueOf(transactionstatusMap.get("code"))); + Assertions.assertEquals("purchasedSharesStatusType.applied", String.valueOf(transactionstatusMap.get("code"))); } } @@ -756,26 +756,26 @@ public class ShareAccountIntegrationTests { Map chargeTimeTypeMap = (Map) chargeDef.get("chargeTimeType") ; String chargeTimeType = String.valueOf(chargeTimeTypeMap.get("code")) ; if(chargeTimeType.equals("chargeTimeType.activation")) { - Assert.assertEquals("2.0", String.valueOf(chargeDef.get("amount"))); - Assert.assertEquals("0.0", String.valueOf(chargeDef.get("amountOutstanding"))); - Assert.assertEquals("2.0", String.valueOf(chargeDef.get("amountPaid"))); + Assertions.assertEquals("2.0", String.valueOf(chargeDef.get("amount"))); + Assertions.assertEquals("0.0", String.valueOf(chargeDef.get("amountOutstanding"))); + Assertions.assertEquals("2.0", String.valueOf(chargeDef.get("amountPaid"))); }else if(chargeTimeType.equals("chargeTimeType.sharespurchase")) { - Assert.assertEquals("6.0", String.valueOf(chargeDef.get("amount"))); - Assert.assertEquals("2.0", String.valueOf(chargeDef.get("amountOutstanding"))); - Assert.assertEquals("4.0", String.valueOf(chargeDef.get("amountPaid"))); + Assertions.assertEquals("6.0", String.valueOf(chargeDef.get("amount"))); + Assertions.assertEquals("2.0", String.valueOf(chargeDef.get("amountOutstanding"))); + Assertions.assertEquals("4.0", String.valueOf(chargeDef.get("amountPaid"))); }else if(chargeTimeType.equals("chargeTimeType.sharesredeem")) { - Assert.assertEquals("1.0", String.valueOf(chargeDef.get("amountOrPercentage"))); - Assert.assertEquals("0.0", String.valueOf(chargeDef.get("amount"))); - Assert.assertEquals("0.0", String.valueOf(chargeDef.get("amountOutstanding"))); - Assert.assertEquals("0", String.valueOf(chargeDef.get("amountPaid"))); + Assertions.assertEquals("1.0", String.valueOf(chargeDef.get("amountOrPercentage"))); + Assertions.assertEquals("0.0", String.valueOf(chargeDef.get("amount"))); + Assertions.assertEquals("0.0", String.valueOf(chargeDef.get("amountOutstanding"))); + Assertions.assertEquals("0", String.valueOf(chargeDef.get("amountPaid"))); }else { - Assert.fail("Other Charge defintion found"); + Assertions.fail("Other Charge defintion found"); } } summaryMap = (Map) shareAccountData.get("summary"); - Assert.assertEquals("45", String.valueOf(summaryMap.get("totalApprovedShares"))); - Assert.assertEquals("20", String.valueOf(summaryMap.get("totalPendingForApprovalShares"))); + Assertions.assertEquals("45", String.valueOf(summaryMap.get("totalApprovedShares"))); + Assertions.assertEquals("20", String.valueOf(summaryMap.get("totalPendingForApprovalShares"))); // rejectadditionalshares Map>> rejectadditionalsharesMap = new HashMap<>(); @@ -789,8 +789,8 @@ public class ShareAccountIntegrationTests { responseSpec); shareAccountData = ShareAccountTransactionHelper.retrieveShareAccount(shareAccountId, requestSpec, responseSpec); transactions = (List>) shareAccountData.get("purchasedShares"); - Assert.assertNotNull(transactions); - Assert.assertEquals(4, transactions.size()); + Assertions.assertNotNull(transactions); + Assertions.assertEquals(4, transactions.size()); for (int i = 0; i < transactions.size(); i++) { Map transaction = transactions.get(i); Map transactionTypeMap = (Map) transaction.get("type"); @@ -802,13 +802,13 @@ public class ShareAccountIntegrationTests { String transactionDate = simple.format(date); if (transactionType.equals("purchasedSharesType.purchased") && transactionDate.equals("01 May 2016")) { addtionalSharesRequestId = String.valueOf(transaction.get("id")); - Assert.assertEquals("20", String.valueOf(transaction.get("numberOfShares"))); - Assert.assertEquals("40.0", String.valueOf(transaction.get("amount"))); - Assert.assertEquals("40.0", String.valueOf(transaction.get("amountPaid"))); - Assert.assertEquals("2.0", String.valueOf(transaction.get("chargeAmount"))); - Assert.assertEquals("2.0", String.valueOf(transaction.get("purchasedPrice"))); + Assertions.assertEquals("20", String.valueOf(transaction.get("numberOfShares"))); + Assertions.assertEquals("40.0", String.valueOf(transaction.get("amount"))); + Assertions.assertEquals("40.0", String.valueOf(transaction.get("amountPaid"))); + Assertions.assertEquals("2.0", String.valueOf(transaction.get("chargeAmount"))); + Assertions.assertEquals("2.0", String.valueOf(transaction.get("purchasedPrice"))); Map transactionstatusMap = (Map) transaction.get("status"); - Assert.assertEquals("purchasedSharesStatusType.rejected", String.valueOf(transactionstatusMap.get("code"))); + Assertions.assertEquals("purchasedSharesStatusType.rejected", String.valueOf(transactionstatusMap.get("code"))); } } @@ -818,26 +818,26 @@ public class ShareAccountIntegrationTests { Map chargeTimeTypeMap = (Map) chargeDef.get("chargeTimeType") ; String chargeTimeType = String.valueOf(chargeTimeTypeMap.get("code")) ; if(chargeTimeType.equals("chargeTimeType.activation")) { - Assert.assertEquals("2.0", String.valueOf(chargeDef.get("amount"))); - Assert.assertEquals("0.0", String.valueOf(chargeDef.get("amountOutstanding"))); - Assert.assertEquals("2.0", String.valueOf(chargeDef.get("amountPaid"))); + Assertions.assertEquals("2.0", String.valueOf(chargeDef.get("amount"))); + Assertions.assertEquals("0.0", String.valueOf(chargeDef.get("amountOutstanding"))); + Assertions.assertEquals("2.0", String.valueOf(chargeDef.get("amountPaid"))); }else if(chargeTimeType.equals("chargeTimeType.sharespurchase")) { - Assert.assertEquals("6.0", String.valueOf(chargeDef.get("amount"))); - Assert.assertEquals("0.0", String.valueOf(chargeDef.get("amountOutstanding"))); - Assert.assertEquals("6.0", String.valueOf(chargeDef.get("amountPaid"))); + Assertions.assertEquals("6.0", String.valueOf(chargeDef.get("amount"))); + Assertions.assertEquals("0.0", String.valueOf(chargeDef.get("amountOutstanding"))); + Assertions.assertEquals("6.0", String.valueOf(chargeDef.get("amountPaid"))); }else if(chargeTimeType.equals("chargeTimeType.sharesredeem")) { - Assert.assertEquals("1.0", String.valueOf(chargeDef.get("amountOrPercentage"))); - Assert.assertEquals("0.0", String.valueOf(chargeDef.get("amount"))); - Assert.assertEquals("0.0", String.valueOf(chargeDef.get("amountOutstanding"))); - Assert.assertEquals("0", String.valueOf(chargeDef.get("amountPaid"))); + Assertions.assertEquals("1.0", String.valueOf(chargeDef.get("amountOrPercentage"))); + Assertions.assertEquals("0.0", String.valueOf(chargeDef.get("amount"))); + Assertions.assertEquals("0.0", String.valueOf(chargeDef.get("amountOutstanding"))); + Assertions.assertEquals("0", String.valueOf(chargeDef.get("amountPaid"))); }else { - Assert.fail("Other Charge defintion found"); + Assertions.fail("Other Charge defintion found"); } } summaryMap = (Map) shareAccountData.get("summary"); - Assert.assertEquals("45", String.valueOf(summaryMap.get("totalApprovedShares"))); - Assert.assertEquals("0", String.valueOf(summaryMap.get("totalPendingForApprovalShares"))); + Assertions.assertEquals("45", String.valueOf(summaryMap.get("totalApprovedShares"))); + Assertions.assertEquals("0", String.valueOf(summaryMap.get("totalPendingForApprovalShares"))); // redeem shares Map redeemRequestMap = new HashMap<>(); @@ -849,8 +849,8 @@ public class ShareAccountIntegrationTests { ShareAccountTransactionHelper.postCommand("redeemshares", shareAccountId, redeemRequestJson, requestSpec, responseSpec); shareAccountData = ShareAccountTransactionHelper.retrieveShareAccount(shareAccountId, requestSpec, responseSpec); transactions = (List>) shareAccountData.get("purchasedShares"); - Assert.assertNotNull(transactions); - Assert.assertEquals(5, transactions.size()); + Assertions.assertNotNull(transactions); + Assertions.assertEquals(5, transactions.size()); for (int i = 0; i < transactions.size(); i++) { Map transaction = transactions.get(i); Map transactionTypeMap = (Map) transaction.get("type"); @@ -861,31 +861,31 @@ public class ShareAccountIntegrationTests { String transactionType = (String) transactionTypeMap.get("code"); String transactionDate = simple.format(date); if (transactionType.equals("purchasedSharesType.purchased") && transactionDate.equals("02 Mar 2016")) { - Assert.assertEquals("30", String.valueOf(transaction.get("numberOfShares"))); - Assert.assertEquals("62.0", String.valueOf(transaction.get("amount"))); - Assert.assertEquals("62.0", String.valueOf(transaction.get("amountPaid"))); - Assert.assertEquals("2.0", String.valueOf(transaction.get("chargeAmount"))); - Assert.assertEquals("2.0", String.valueOf(transaction.get("purchasedPrice"))); + Assertions.assertEquals("30", String.valueOf(transaction.get("numberOfShares"))); + Assertions.assertEquals("62.0", String.valueOf(transaction.get("amount"))); + Assertions.assertEquals("62.0", String.valueOf(transaction.get("amountPaid"))); + Assertions.assertEquals("2.0", String.valueOf(transaction.get("chargeAmount"))); + Assertions.assertEquals("2.0", String.valueOf(transaction.get("purchasedPrice"))); } else if (transactionType.equals("purchasedSharesType.purchased") && transactionDate.equals("01 Apr 2016")) { - Assert.assertEquals("15", String.valueOf(transaction.get("numberOfShares"))); - Assert.assertEquals("32.0", String.valueOf(transaction.get("amount"))); - Assert.assertEquals("32.0", String.valueOf(transaction.get("amountPaid"))); - Assert.assertEquals("2.0", String.valueOf(transaction.get("chargeAmount"))); - Assert.assertEquals("2.0", String.valueOf(transaction.get("purchasedPrice"))); + Assertions.assertEquals("15", String.valueOf(transaction.get("numberOfShares"))); + Assertions.assertEquals("32.0", String.valueOf(transaction.get("amount"))); + Assertions.assertEquals("32.0", String.valueOf(transaction.get("amountPaid"))); + Assertions.assertEquals("2.0", String.valueOf(transaction.get("chargeAmount"))); + Assertions.assertEquals("2.0", String.valueOf(transaction.get("purchasedPrice"))); Map transactionstatusMap = (Map) transaction.get("status"); - Assert.assertEquals("purchasedSharesStatusType.approved", String.valueOf(transactionstatusMap.get("code"))); + Assertions.assertEquals("purchasedSharesStatusType.approved", String.valueOf(transactionstatusMap.get("code"))); } else if (transactionType.equals("purchasedSharesType.redeemed") && transactionDate.equals("05 May 2016")) { - Assert.assertEquals("15", String.valueOf(transaction.get("numberOfShares"))); - Assert.assertEquals("29.0", String.valueOf(transaction.get("amount"))); - Assert.assertEquals("29.0", String.valueOf(transaction.get("amountPaid"))); - Assert.assertEquals("1.0", String.valueOf(transaction.get("chargeAmount"))); + Assertions.assertEquals("15", String.valueOf(transaction.get("numberOfShares"))); + Assertions.assertEquals("29.0", String.valueOf(transaction.get("amount"))); + Assertions.assertEquals("29.0", String.valueOf(transaction.get("amountPaid"))); + Assertions.assertEquals("1.0", String.valueOf(transaction.get("chargeAmount"))); Map transactionstatusMap = (Map) transaction.get("status"); - Assert.assertEquals("purchasedSharesStatusType.approved", String.valueOf(transactionstatusMap.get("code"))); + Assertions.assertEquals("purchasedSharesStatusType.approved", String.valueOf(transactionstatusMap.get("code"))); } else if (transactionType.equals("charge.payment")) { - Assert.assertEquals("2.0", String.valueOf(transaction.get("amount"))); - Assert.assertEquals("2.0", String.valueOf(transaction.get("amountPaid"))); - Assert.assertEquals("0", String.valueOf(transaction.get("chargeAmount"))); - Assert.assertEquals("01 Jan 2016", transactionDate); + Assertions.assertEquals("2.0", String.valueOf(transaction.get("amount"))); + Assertions.assertEquals("2.0", String.valueOf(transaction.get("amountPaid"))); + Assertions.assertEquals("0", String.valueOf(transaction.get("chargeAmount"))); + Assertions.assertEquals("01 Jan 2016", transactionDate); } } @@ -895,25 +895,25 @@ public class ShareAccountIntegrationTests { Map chargeTimeTypeMap = (Map) chargeDef.get("chargeTimeType") ; String chargeTimeType = String.valueOf(chargeTimeTypeMap.get("code")) ; if(chargeTimeType.equals("chargeTimeType.activation")) { - Assert.assertEquals("2.0", String.valueOf(chargeDef.get("amount"))); - Assert.assertEquals("0.0", String.valueOf(chargeDef.get("amountOutstanding"))); - Assert.assertEquals("2.0", String.valueOf(chargeDef.get("amountPaid"))); + Assertions.assertEquals("2.0", String.valueOf(chargeDef.get("amount"))); + Assertions.assertEquals("0.0", String.valueOf(chargeDef.get("amountOutstanding"))); + Assertions.assertEquals("2.0", String.valueOf(chargeDef.get("amountPaid"))); }else if(chargeTimeType.equals("chargeTimeType.sharespurchase")) { - Assert.assertEquals("6.0", String.valueOf(chargeDef.get("amount"))); - Assert.assertEquals("0.0", String.valueOf(chargeDef.get("amountOutstanding"))); - Assert.assertEquals("6.0", String.valueOf(chargeDef.get("amountPaid"))); + Assertions.assertEquals("6.0", String.valueOf(chargeDef.get("amount"))); + Assertions.assertEquals("0.0", String.valueOf(chargeDef.get("amountOutstanding"))); + Assertions.assertEquals("6.0", String.valueOf(chargeDef.get("amountPaid"))); }else if(chargeTimeType.equals("chargeTimeType.sharesredeem")) { - Assert.assertEquals("1.0", String.valueOf(chargeDef.get("amountOrPercentage"))); - Assert.assertEquals("1.0", String.valueOf(chargeDef.get("amount"))); - Assert.assertEquals("0.0", String.valueOf(chargeDef.get("amountOutstanding"))); - Assert.assertEquals("1.0", String.valueOf(chargeDef.get("amountPaid"))); + Assertions.assertEquals("1.0", String.valueOf(chargeDef.get("amountOrPercentage"))); + Assertions.assertEquals("1.0", String.valueOf(chargeDef.get("amount"))); + Assertions.assertEquals("0.0", String.valueOf(chargeDef.get("amountOutstanding"))); + Assertions.assertEquals("1.0", String.valueOf(chargeDef.get("amountPaid"))); }else { - Assert.fail("Other Charge defintion found"); + Assertions.fail("Other Charge defintion found"); } } summaryMap = (Map) shareAccountData.get("summary"); - Assert.assertEquals("30", String.valueOf(summaryMap.get("totalApprovedShares"))); - Assert.assertEquals("0", String.valueOf(summaryMap.get("totalPendingForApprovalShares"))); + Assertions.assertEquals("30", String.valueOf(summaryMap.get("totalApprovedShares"))); + Assertions.assertEquals("0", String.valueOf(summaryMap.get("totalPendingForApprovalShares"))); //Close Share Account Map closeAccountMap = new HashMap<>(); @@ -926,10 +926,10 @@ public class ShareAccountIntegrationTests { shareAccountData = ShareAccountTransactionHelper .retrieveShareAccount(shareAccountId, requestSpec, responseSpec); statusMap = (Map) shareAccountData.get("status"); - Assert.assertEquals("shareAccountStatusType.closed", String.valueOf(statusMap.get("code"))); + Assertions.assertEquals("shareAccountStatusType.closed", String.valueOf(statusMap.get("code"))); transactions = (List>) shareAccountData.get("purchasedShares"); - Assert.assertNotNull(transactions); - Assert.assertEquals(6, transactions.size()); + Assertions.assertNotNull(transactions); + Assertions.assertEquals(6, transactions.size()); for (int i = 0; i < transactions.size(); i++) { Map transaction = transactions.get(i); Map transactionTypeMap = (Map) transaction.get("type"); @@ -940,38 +940,38 @@ public class ShareAccountIntegrationTests { String transactionType = (String) transactionTypeMap.get("code"); String transactionDate = simple.format(date); if (transactionType.equals("purchasedSharesType.purchased") && transactionDate.equals("02 Mar 2016")) { - Assert.assertEquals("30", String.valueOf(transaction.get("numberOfShares"))); - Assert.assertEquals("62.0", String.valueOf(transaction.get("amount"))); - Assert.assertEquals("62.0", String.valueOf(transaction.get("amountPaid"))); - Assert.assertEquals("2.0", String.valueOf(transaction.get("chargeAmount"))); - Assert.assertEquals("2.0", String.valueOf(transaction.get("purchasedPrice"))); + Assertions.assertEquals("30", String.valueOf(transaction.get("numberOfShares"))); + Assertions.assertEquals("62.0", String.valueOf(transaction.get("amount"))); + Assertions.assertEquals("62.0", String.valueOf(transaction.get("amountPaid"))); + Assertions.assertEquals("2.0", String.valueOf(transaction.get("chargeAmount"))); + Assertions.assertEquals("2.0", String.valueOf(transaction.get("purchasedPrice"))); } else if (transactionType.equals("purchasedSharesType.purchased") && transactionDate.equals("01 Apr 2016")) { - Assert.assertEquals("15", String.valueOf(transaction.get("numberOfShares"))); - Assert.assertEquals("32.0", String.valueOf(transaction.get("amount"))); - Assert.assertEquals("32.0", String.valueOf(transaction.get("amountPaid"))); - Assert.assertEquals("2.0", String.valueOf(transaction.get("chargeAmount"))); - Assert.assertEquals("2.0", String.valueOf(transaction.get("purchasedPrice"))); + Assertions.assertEquals("15", String.valueOf(transaction.get("numberOfShares"))); + Assertions.assertEquals("32.0", String.valueOf(transaction.get("amount"))); + Assertions.assertEquals("32.0", String.valueOf(transaction.get("amountPaid"))); + Assertions.assertEquals("2.0", String.valueOf(transaction.get("chargeAmount"))); + Assertions.assertEquals("2.0", String.valueOf(transaction.get("purchasedPrice"))); Map transactionstatusMap = (Map) transaction.get("status"); - Assert.assertEquals("purchasedSharesStatusType.approved", String.valueOf(transactionstatusMap.get("code"))); + Assertions.assertEquals("purchasedSharesStatusType.approved", String.valueOf(transactionstatusMap.get("code"))); } else if (transactionType.equals("purchasedSharesType.redeemed") && transactionDate.equals("05 May 2016")) { - Assert.assertEquals("15", String.valueOf(transaction.get("numberOfShares"))); - Assert.assertEquals("29.0", String.valueOf(transaction.get("amount"))); - Assert.assertEquals("29.0", String.valueOf(transaction.get("amountPaid"))); - Assert.assertEquals("1.0", String.valueOf(transaction.get("chargeAmount"))); + Assertions.assertEquals("15", String.valueOf(transaction.get("numberOfShares"))); + Assertions.assertEquals("29.0", String.valueOf(transaction.get("amount"))); + Assertions.assertEquals("29.0", String.valueOf(transaction.get("amountPaid"))); + Assertions.assertEquals("1.0", String.valueOf(transaction.get("chargeAmount"))); Map transactionstatusMap = (Map) transaction.get("status"); - Assert.assertEquals("purchasedSharesStatusType.approved", String.valueOf(transactionstatusMap.get("code"))); + Assertions.assertEquals("purchasedSharesStatusType.approved", String.valueOf(transactionstatusMap.get("code"))); }else if (transactionType.equals("purchasedSharesType.redeemed") && transactionDate.equals("10 May 2016")) { - Assert.assertEquals("30", String.valueOf(transaction.get("numberOfShares"))); - Assert.assertEquals("59.0", String.valueOf(transaction.get("amount"))); - Assert.assertEquals("59.0", String.valueOf(transaction.get("amountPaid"))); - Assert.assertEquals("1.0", String.valueOf(transaction.get("chargeAmount"))); + Assertions.assertEquals("30", String.valueOf(transaction.get("numberOfShares"))); + Assertions.assertEquals("59.0", String.valueOf(transaction.get("amount"))); + Assertions.assertEquals("59.0", String.valueOf(transaction.get("amountPaid"))); + Assertions.assertEquals("1.0", String.valueOf(transaction.get("chargeAmount"))); Map transactionstatusMap = (Map) transaction.get("status"); - Assert.assertEquals("purchasedSharesStatusType.approved", String.valueOf(transactionstatusMap.get("code"))); + Assertions.assertEquals("purchasedSharesStatusType.approved", String.valueOf(transactionstatusMap.get("code"))); }else if (transactionType.equals("charge.payment")) { - Assert.assertEquals("2.0", String.valueOf(transaction.get("amount"))); - Assert.assertEquals("2.0", String.valueOf(transaction.get("amountPaid"))); - Assert.assertEquals("0", String.valueOf(transaction.get("chargeAmount"))); - Assert.assertEquals("01 Jan 2016", transactionDate); + Assertions.assertEquals("2.0", String.valueOf(transaction.get("amount"))); + Assertions.assertEquals("2.0", String.valueOf(transaction.get("amountPaid"))); + Assertions.assertEquals("0", String.valueOf(transaction.get("chargeAmount"))); + Assertions.assertEquals("01 Jan 2016", transactionDate); } } //charges verification @@ -980,25 +980,25 @@ public class ShareAccountIntegrationTests { Map chargeTimeTypeMap = (Map) chargeDef.get("chargeTimeType") ; String chargeTimeType = String.valueOf(chargeTimeTypeMap.get("code")) ; if(chargeTimeType.equals("chargeTimeType.activation")) { - Assert.assertEquals("2.0", String.valueOf(chargeDef.get("amount"))); - Assert.assertEquals("0.0", String.valueOf(chargeDef.get("amountOutstanding"))); - Assert.assertEquals("2.0", String.valueOf(chargeDef.get("amountPaid"))); + Assertions.assertEquals("2.0", String.valueOf(chargeDef.get("amount"))); + Assertions.assertEquals("0.0", String.valueOf(chargeDef.get("amountOutstanding"))); + Assertions.assertEquals("2.0", String.valueOf(chargeDef.get("amountPaid"))); }else if(chargeTimeType.equals("chargeTimeType.sharespurchase")) { - Assert.assertEquals("6.0", String.valueOf(chargeDef.get("amount"))); - Assert.assertEquals("0.0", String.valueOf(chargeDef.get("amountOutstanding"))); - Assert.assertEquals("6.0", String.valueOf(chargeDef.get("amountPaid"))); + Assertions.assertEquals("6.0", String.valueOf(chargeDef.get("amount"))); + Assertions.assertEquals("0.0", String.valueOf(chargeDef.get("amountOutstanding"))); + Assertions.assertEquals("6.0", String.valueOf(chargeDef.get("amountPaid"))); }else if(chargeTimeType.equals("chargeTimeType.sharesredeem")) { - Assert.assertEquals("1.0", String.valueOf(chargeDef.get("amountOrPercentage"))); - Assert.assertEquals("2.0", String.valueOf(chargeDef.get("amount"))); - Assert.assertEquals("0.0", String.valueOf(chargeDef.get("amountOutstanding"))); - Assert.assertEquals("2.0", String.valueOf(chargeDef.get("amountPaid"))); + Assertions.assertEquals("1.0", String.valueOf(chargeDef.get("amountOrPercentage"))); + Assertions.assertEquals("2.0", String.valueOf(chargeDef.get("amount"))); + Assertions.assertEquals("0.0", String.valueOf(chargeDef.get("amountOutstanding"))); + Assertions.assertEquals("2.0", String.valueOf(chargeDef.get("amountPaid"))); }else { - Assert.fail("Other Charge defintion found"); + Assertions.fail("Other Charge defintion found"); } } summaryMap = (Map) shareAccountData.get("summary"); - Assert.assertEquals("0", String.valueOf(summaryMap.get("totalApprovedShares"))); - Assert.assertEquals("0", String.valueOf(summaryMap.get("totalPendingForApprovalShares"))); + Assertions.assertEquals("0", String.valueOf(summaryMap.get("totalApprovedShares"))); + Assertions.assertEquals("0", String.valueOf(summaryMap.get("totalPendingForApprovalShares"))); } private Integer createShareProduct() { diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/shares/ShareProductHelper.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/shares/ShareProductHelper.java index 34b175a0a..76ffc0a03 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/shares/ShareProductHelper.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/shares/ShareProductHelper.java @@ -28,7 +28,7 @@ import java.util.Map; import org.apache.fineract.infrastructure.core.service.DateUtils; import org.apache.fineract.integrationtests.common.Utils; import org.joda.time.LocalDate; -import org.junit.Assert; +import org.junit.jupiter.api.Assertions; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -134,61 +134,61 @@ public class ShareProductHelper { @SuppressWarnings("unchecked") public void verifyShareProduct(Map shareProductData) { String productName = (String)shareProductData.get("name") ; - Assert.assertEquals(this.productName, productName); + Assertions.assertEquals(this.productName, productName); String shortName = (String)shareProductData.get("shortName") ; - Assert.assertEquals(this.shortName, shortName); + Assertions.assertEquals(this.shortName, shortName); String description = (String)shareProductData.get("description") ; - Assert.assertEquals(this.description, description); + Assertions.assertEquals(this.description, description); Map currency = (Map)shareProductData.get("currency") ; String currencyCode = currency.get("code") ; - Assert.assertEquals(this.currencyCode, currencyCode); + Assertions.assertEquals(this.currencyCode, currencyCode); String digitsAfterDecimal = String.valueOf(currency.get("decimalPlaces")) ; - Assert.assertEquals(DIGITS_AFTER_DECIMAL, digitsAfterDecimal); + Assertions.assertEquals(DIGITS_AFTER_DECIMAL, digitsAfterDecimal); String inMultiplesOf = String.valueOf(currency.get("inMultiplesOf")) ; - Assert.assertEquals(IN_MULTIPLES_OF, inMultiplesOf); + Assertions.assertEquals(IN_MULTIPLES_OF, inMultiplesOf); String totalShares = String.valueOf(shareProductData.get("totalShares")) ; - Assert.assertEquals(this.totalShares, totalShares); + Assertions.assertEquals(this.totalShares, totalShares); String sharesIssued = String.valueOf(shareProductData.get("totalSharesIssued")) ; - Assert.assertEquals(this.sharesIssued, sharesIssued); + Assertions.assertEquals(this.sharesIssued, sharesIssued); String unitPrice = String.valueOf(shareProductData.get("unitPrice")) ; - Assert.assertEquals(this.unitPrice, unitPrice); + Assertions.assertEquals(this.unitPrice, unitPrice); String minimumShares = String.valueOf(shareProductData.get("minimumShares")) ; - Assert.assertEquals(this.minimumShares, minimumShares); + Assertions.assertEquals(this.minimumShares, minimumShares); String nominalShares = String.valueOf(shareProductData.get("nominalShares")) ; - Assert.assertEquals(this.nominalShares, nominalShares); + Assertions.assertEquals(this.nominalShares, nominalShares); String maximumShares = String.valueOf(shareProductData.get("maximumShares")) ; - Assert.assertEquals(this.maximumShares, maximumShares); + Assertions.assertEquals(this.maximumShares, maximumShares); String allowDividendCalculationForInactiveClients = String.valueOf(shareProductData.get("allowDividendCalculationForInactiveClients")) ; - Assert.assertEquals(this.allowDividendCalculationForInactiveClients, allowDividendCalculationForInactiveClients); + Assertions.assertEquals(this.allowDividendCalculationForInactiveClients, allowDividendCalculationForInactiveClients); Map accountingRuleMap = (Map) shareProductData.get("accountingRule") ; String accountingRule = String.valueOf(accountingRuleMap.get("id")) ; - Assert.assertEquals(this.accountingRule, accountingRule); + Assertions.assertEquals(this.accountingRule, accountingRule); String minimumActivePeriodForDividends = String.valueOf(shareProductData.get("minimumActivePeriod")) ; - Assert.assertEquals(this.minimumActivePeriodForDividends, minimumActivePeriodForDividends); + Assertions.assertEquals(this.minimumActivePeriodForDividends, minimumActivePeriodForDividends); Map minimumActivePeriodType = (Map) shareProductData.get("minimumActivePeriodForDividendsTypeEnum") ; String minimumactiveperiodFrequencyType = String.valueOf(minimumActivePeriodType.get("id")) ; - Assert.assertEquals(this.minimumactiveperiodFrequencyType, minimumactiveperiodFrequencyType); + Assertions.assertEquals(this.minimumactiveperiodFrequencyType, minimumactiveperiodFrequencyType); String lockinPeriodFrequency = String.valueOf(shareProductData.get("lockinPeriod")) ; - Assert.assertEquals(this.lockinPeriodFrequency, lockinPeriodFrequency); + Assertions.assertEquals(this.lockinPeriodFrequency, lockinPeriodFrequency); Map lockinPeriodType = (Map) shareProductData.get("lockPeriodTypeEnum") ; String lockinPeriodFrequencyType = String.valueOf(lockinPeriodType.get("id")) ; - Assert.assertEquals(this.lockinPeriodFrequencyType, lockinPeriodFrequencyType); + Assertions.assertEquals(this.lockinPeriodFrequencyType, lockinPeriodFrequencyType); //ArrayList> charges = (ArrayList>)shareProductData.get("chargesSelected") ; diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/system/DatatableHelper.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/system/DatatableHelper.java index f44381d2c..0e9bc9cc5 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/system/DatatableHelper.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/system/DatatableHelper.java @@ -18,7 +18,7 @@ */ package org.apache.fineract.integrationtests.common.system; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import com.google.gson.Gson; import io.restassured.specification.RequestSpecification; diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/interoperation/InteropTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/interoperation/InteropTest.java index 3725cc43f..685442991 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/interoperation/InteropTest.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/interoperation/InteropTest.java @@ -49,9 +49,9 @@ import org.apache.fineract.interoperation.util.InteropUtil; import org.apache.fineract.interoperation.util.MathUtil; import org.apache.fineract.portfolio.charge.domain.ChargeTimeType; import org.apache.fineract.portfolio.savings.SavingsApiConstants; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -82,7 +82,7 @@ public class InteropTest { private String quoteCode; private String transferCode; - @Before + @BeforeEach public void setup() { Utils.initializeRESTAssured(); requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build(); @@ -115,7 +115,7 @@ public class InteropTest { private void createClient() { clientId = ClientHelper.createClient(requestSpec, responseSpec); - Assert.assertNotNull(clientId); + Assertions.assertNotNull(clientId); } private void createSavingsProduct() { @@ -138,7 +138,7 @@ public class InteropTest { .withAccountingRuleAsCashBased(accounts) .build(); savingsProductId = SavingsProductHelper.createSavingsProduct(savingsProductJSON, requestSpec, responseSpec); - Assert.assertNotNull(savingsProductId); + Assertions.assertNotNull(savingsProductId); LOG.debug("Sucessfully created Interoperable Saving Product (id: {})", savingsProductId); } @@ -146,13 +146,13 @@ public class InteropTest { private void createCharge() { chargeId = ChargesHelper.createCharges(requestSpec, responseSpec, ChargesHelper.getSavingsJSON(interopHelper.getFee().toString(), interopHelper.getCurrency(), ChargeTimeType.WITHDRAWAL_FEE)); - Assert.assertNotNull(chargeId); + Assertions.assertNotNull(chargeId); } private void openSavingsAccount() { LOG.debug("------------------------------ Create Interoperable Saving Account ---------------------------------------"); savingsId = savingsAccountHelper.applyForSavingsApplicationWithExternalId(clientId, savingsProductId, ACCOUNT_TYPE_INDIVIDUAL, interopHelper.getAccountExternalId(), true); - Assert.assertNotNull(savingsId); + Assertions.assertNotNull(savingsId); HashMap savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(requestSpec, responseSpec, savingsId); SavingsStatusChecker.verifySavingsIsPending(savingsStatusHashMap); @@ -173,22 +173,22 @@ public class InteropTest { private void testParties() { String idValue = UUID.randomUUID().toString(); String accountId = interopHelper.postParty(InteropIdentifierType.MSISDN, idValue); - Assert.assertEquals(interopHelper.getAccountExternalId(), accountId); + Assertions.assertEquals(interopHelper.getAccountExternalId(), accountId); interopHelper.setResponseSpec(responseErrorSpec); accountId = interopHelper.postParty(InteropIdentifierType.MSISDN, idValue); - Assert.assertNull(accountId); + Assertions.assertNull(accountId); interopHelper.setResponseSpec(responseSpec); accountId = interopHelper.getParty(InteropIdentifierType.MSISDN, idValue); - Assert.assertEquals(interopHelper.getAccountExternalId(), accountId); + Assertions.assertEquals(interopHelper.getAccountExternalId(), accountId); accountId = interopHelper.deleteParty(InteropIdentifierType.MSISDN, idValue); - Assert.assertEquals(interopHelper.getAccountExternalId(), accountId); + Assertions.assertEquals(interopHelper.getAccountExternalId(), accountId); interopHelper.setResponseSpec(responseErrorSpec); accountId = interopHelper.getParty(InteropIdentifierType.MSISDN, idValue); - Assert.assertNull(accountId); + Assertions.assertNull(accountId); interopHelper.setResponseSpec(responseSpec); } @@ -196,8 +196,8 @@ public class InteropTest { requestCode = UUID.randomUUID().toString(); String response = interopHelper.postTransactionRequest(requestCode, InteropTransactionRole.PAYER); JsonPath json = JsonPath.from(response); - Assert.assertEquals(requestCode, json.getString(InteropUtil.PARAM_REQUEST_CODE)); - Assert.assertEquals(InteropActionState.ACCEPTED.toString(), json.getString(InteropHelper.PARAM_ACTION_STATE)); + Assertions.assertEquals(requestCode, json.getString(InteropUtil.PARAM_REQUEST_CODE)); + Assertions.assertEquals(InteropActionState.ACCEPTED.toString(), json.getString(InteropHelper.PARAM_ACTION_STATE)); interopHelper.setResponseSpec(responseClientErrorSpec); interopHelper.postTransactionRequest(requestCode, InteropTransactionRole.PAYEE); @@ -209,25 +209,25 @@ public class InteropTest { quoteCode = UUID.randomUUID().toString(); String response = interopHelper.postQuote(quoteCode, InteropTransactionRole.PAYER); JsonPath json = JsonPath.from(response); - Assert.assertEquals(quoteCode, json.getString(InteropUtil.PARAM_QUOTE_CODE)); - Assert.assertEquals(InteropActionState.ACCEPTED.toString(), json.getString(InteropHelper.PARAM_ACTION_STATE)); + Assertions.assertEquals(quoteCode, json.getString(InteropUtil.PARAM_QUOTE_CODE)); + Assertions.assertEquals(InteropActionState.ACCEPTED.toString(), json.getString(InteropHelper.PARAM_ACTION_STATE)); Map fee = json.getMap(InteropUtil.PARAM_FSP_FEE); - Assert.assertNotNull(fee); + Assertions.assertNotNull(fee); BigDecimal feeAmount = ObjectConverter.convertObjectTo(fee.get(InteropUtil.PARAM_AMOUNT), BigDecimal.class); - Assert.assertTrue("Quote fee expected: " + interopHelper.getFee() + ", actual: " + feeAmount, MathUtil.isEqualTo(interopHelper.getFee(), feeAmount)); - Assert.assertEquals(interopHelper.getCurrency(), fee.get(InteropUtil.PARAM_CURRENCY)); + Assertions.assertTrue(MathUtil.isEqualTo(interopHelper.getFee(), feeAmount), "Quote fee expected: " + interopHelper.getFee() + ", actual: " + feeAmount); + Assertions.assertEquals(interopHelper.getCurrency(), fee.get(InteropUtil.PARAM_CURRENCY)); // payee response = interopHelper.postQuote(quoteCode, InteropTransactionRole.PAYEE); json = JsonPath.from(response); - Assert.assertEquals(quoteCode, json.getString(InteropUtil.PARAM_QUOTE_CODE)); - Assert.assertEquals(InteropActionState.ACCEPTED.toString(), json.getString(InteropHelper.PARAM_ACTION_STATE)); + Assertions.assertEquals(quoteCode, json.getString(InteropUtil.PARAM_QUOTE_CODE)); + Assertions.assertEquals(InteropActionState.ACCEPTED.toString(), json.getString(InteropHelper.PARAM_ACTION_STATE)); fee = json.getMap(InteropUtil.PARAM_FSP_FEE); if (fee != null) { feeAmount = ObjectConverter.convertObjectTo(fee.get(InteropUtil.PARAM_AMOUNT), BigDecimal.class); - Assert.assertTrue("PAYEE Quote fee expected: " + BigDecimal.ZERO + ", actual: " + feeAmount, MathUtil.isZero(feeAmount)); + Assertions.assertTrue(MathUtil.isZero(feeAmount), "PAYEE Quote fee expected: " + BigDecimal.ZERO + ", actual: " + feeAmount); } } @@ -240,8 +240,8 @@ public class InteropTest { transferCode = UUID.randomUUID().toString(); String response = interopHelper.prepareTransfer(transferCode); JsonPath json = JsonPath.from(response); - Assert.assertEquals(transferCode, json.getString(InteropUtil.PARAM_TRANSFER_CODE)); - Assert.assertEquals(InteropActionState.ACCEPTED.toString(), json.getString(InteropHelper.PARAM_ACTION_STATE)); + Assertions.assertEquals(transferCode, json.getString(InteropUtil.PARAM_TRANSFER_CODE)); + Assertions.assertEquals(InteropActionState.ACCEPTED.toString(), json.getString(InteropHelper.PARAM_ACTION_STATE)); // prepare savings = (String) savingsAccountHelper.getSavingsAccountDetail(savingsId, null); @@ -252,29 +252,29 @@ public class InteropTest { BigDecimal transferAmount = interopHelper.getTransferAmount(); BigDecimal expectedHold = MathUtil.add(onHold, transferAmount, MATHCONTEXT); - Assert.assertTrue("On hold amount expected: " + expectedHold + ", actual: " + onHold2, MathUtil.isEqualTo(expectedHold, onHold2)); + Assertions.assertTrue(MathUtil.isEqualTo(expectedHold, onHold2), "On hold amount expected: " + expectedHold + ", actual: " + onHold2); BigDecimal expectedBalance = MathUtil.subtract(balance, transferAmount, MATHCONTEXT); - Assert.assertTrue("Balance amount expected: " + expectedBalance + ", actual: " + balance2, MathUtil.isEqualTo(expectedBalance, balance2)); + Assertions.assertTrue(MathUtil.isEqualTo(expectedBalance, balance2), "Balance amount expected: " + expectedBalance + ", actual: " + balance2); // payer response = interopHelper.createTransfer(transferCode, InteropTransactionRole.PAYER); json = JsonPath.from(response); - Assert.assertEquals(transferCode, json.getString(InteropUtil.PARAM_TRANSFER_CODE)); - Assert.assertEquals(InteropActionState.ACCEPTED.toString(), json.getString(InteropHelper.PARAM_ACTION_STATE)); + Assertions.assertEquals(transferCode, json.getString(InteropUtil.PARAM_TRANSFER_CODE)); + Assertions.assertEquals(InteropActionState.ACCEPTED.toString(), json.getString(InteropHelper.PARAM_ACTION_STATE)); savings = (String) savingsAccountHelper.getSavingsAccountDetail(savingsId, null); LOG.debug("Response Interoperable GET Saving: {}", savings); savingsJson = JsonPath.from(savings); BigDecimal onHold3 = ObjectConverter.convertObjectTo(savingsJson.get(SavingsApiConstants.savingsAmountOnHold), BigDecimal.class); BigDecimal balance3 = ObjectConverter.convertObjectTo(savingsJson.get(PARAM_ACCOUNT_BALANCE), BigDecimal.class); - Assert.assertTrue("On hold amount expected: " + onHold + ", actual: " + onHold3, MathUtil.isEqualTo(onHold, onHold3)); - Assert.assertTrue("Balance amount expected: " + expectedBalance + ", actual: " + balance3, MathUtil.isEqualTo(expectedBalance, balance3)); + Assertions.assertTrue(MathUtil.isEqualTo(onHold, onHold3), "On hold amount expected: " + onHold + ", actual: " + onHold3); + Assertions.assertTrue(MathUtil.isEqualTo(expectedBalance, balance3), "Balance amount expected: " + expectedBalance + ", actual: " + balance3); // payee response = interopHelper.createTransfer(transferCode, InteropTransactionRole.PAYEE); json = JsonPath.from(response); - Assert.assertEquals(transferCode, json.getString(InteropUtil.PARAM_TRANSFER_CODE)); - Assert.assertEquals(InteropActionState.ACCEPTED.toString(), json.getString(InteropHelper.PARAM_ACTION_STATE)); + Assertions.assertEquals(transferCode, json.getString(InteropUtil.PARAM_TRANSFER_CODE)); + Assertions.assertEquals(InteropActionState.ACCEPTED.toString(), json.getString(InteropHelper.PARAM_ACTION_STATE)); savings = (String) savingsAccountHelper.getSavingsAccountDetail(savingsId, null); LOG.debug("Response Interoperable GET Saving: {}", savings); @@ -282,7 +282,7 @@ public class InteropTest { BigDecimal onHold4 = ObjectConverter.convertObjectTo(savingsJson.get(SavingsApiConstants.savingsAmountOnHold), BigDecimal.class); BigDecimal balance4 = ObjectConverter.convertObjectTo(savingsJson.get(PARAM_ACCOUNT_BALANCE), BigDecimal.class); expectedBalance = MathUtil.subtract(balance, interopHelper.getFee(), MATHCONTEXT); - Assert.assertTrue("On hold amount expected: " + onHold + ", actual: " + onHold4, MathUtil.isEqualTo(onHold, onHold4)); - Assert.assertTrue("Balance amount expected: " + expectedBalance + ", actual: " + balance4, MathUtil.isEqualTo(balance, balance4)); + Assertions.assertTrue(MathUtil.isEqualTo(onHold, onHold4), "On hold amount expected: " + onHold + ", actual: " + onHold4); + Assertions.assertTrue(MathUtil.isEqualTo(balance, balance4), "Balance amount expected: " + expectedBalance + ", actual: " + balance4); } } diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/loanaccount/guarantor/GuarantorTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/loanaccount/guarantor/GuarantorTest.java index dc9df9067..d351e0c6b 100755 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/loanaccount/guarantor/GuarantorTest.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/loanaccount/guarantor/GuarantorTest.java @@ -18,9 +18,9 @@ */ package org.apache.fineract.integrationtests.loanaccount.guarantor; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import io.restassured.builder.RequestSpecBuilder; import io.restassured.builder.ResponseSpecBuilder; @@ -42,9 +42,9 @@ import org.apache.fineract.integrationtests.common.loans.LoanProductTestBuilder; import org.apache.fineract.integrationtests.common.loans.LoanStatusChecker; import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper; import org.apache.fineract.integrationtests.common.savings.SavingsAccountHelper; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -62,7 +62,7 @@ public class GuarantorTest { private final Float external1_guarantee = Float.valueOf((float)2000); private final Float external2_guarantee = Float.valueOf((float)1000); - @Before + @BeforeEach public void setUp() throws Exception { Utils.initializeRESTAssured(); this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build(); @@ -100,17 +100,17 @@ public class GuarantorTest { todaysDate.add(Calendar.DAY_OF_MONTH, -7 * 4); String LOAN_DISBURSEMENT_DATE = dateFormat.format(todaysDate.getTime()); final Integer loanID = applyForLoanApplication(clientID, loanProductID, LOAN_DISBURSEMENT_DATE); - Assert.assertNotNull(loanID); + Assertions.assertNotNull(loanID); HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID); LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap); String guarantorJSON = new GuarantorTestBuilder().externalCustomer().build(); Integer externalGuarantor = this.guarantorHelper.createGuarantor(loanID, guarantorJSON); - Assert.assertNotNull(externalGuarantor); + Assertions.assertNotNull(externalGuarantor); guarantorJSON = new GuarantorTestBuilder().existingCustomerWithoutGuaranteeAmount(String.valueOf(clientID_external)).build(); Integer withoutGuaranteeAmount = this.guarantorHelper.createGuarantor(loanID, guarantorJSON); - Assert.assertNotNull(withoutGuaranteeAmount); + Assertions.assertNotNull(withoutGuaranteeAmount); ArrayList errorData = (ArrayList) this.loanTransactionHelper.approveLoan(LOAN_DISBURSEMENT_DATE, null, loanID, CommonConstants.RESPONSE_ERROR); @@ -122,7 +122,7 @@ public class GuarantorTest { String.valueOf(selfSavigsId), String.valueOf(self1_guarantee)).build(); Integer selfGuarantee = this.guarantorHelper.createGuarantor(loanID, guarantorJSON); verifySavingsOnHoldBalance(selfSavigsId, null); - Assert.assertNotNull(selfGuarantee); + Assertions.assertNotNull(selfGuarantee); errorData = (ArrayList) this.loanTransactionHelper.approveLoan(LOAN_DISBURSEMENT_DATE, null, loanID, CommonConstants.RESPONSE_ERROR); @@ -134,7 +134,7 @@ public class GuarantorTest { String.valueOf(externalSavigsId_1), String.valueOf(external1_guarantee)).build(); Integer externalGuarantee_1 = this.guarantorHelper.createGuarantor(loanID, guarantorJSON); verifySavingsOnHoldBalance(externalSavigsId_1, null); - Assert.assertNotNull(externalGuarantee_1); + Assertions.assertNotNull(externalGuarantee_1); errorData = (ArrayList) this.loanTransactionHelper.approveLoan(LOAN_DISBURSEMENT_DATE, null, loanID, CommonConstants.RESPONSE_ERROR); @@ -146,7 +146,7 @@ public class GuarantorTest { String.valueOf(externalSavigsId_2), String.valueOf(external2_guarantee)).build(); Integer externalGuarantee_2 = this.guarantorHelper.createGuarantor(loanID, guarantorJSON); verifySavingsOnHoldBalance(externalSavigsId_2, null); - Assert.assertNotNull(externalGuarantee_2); + Assertions.assertNotNull(externalGuarantee_2); LOG.info("-----------------------------------APPROVE LOAN-----------------------------------------"); loanStatusHashMap = this.loanTransactionHelper.approveLoan(LOAN_DISBURSEMENT_DATE, loanID); @@ -257,17 +257,17 @@ public class GuarantorTest { todaysDate.add(Calendar.DAY_OF_MONTH, -7 * 4); String LOAN_DISBURSEMENT_DATE = dateFormat.format(todaysDate.getTime()); final Integer loanID = applyForLoanApplication(clientID, loanProductID, LOAN_DISBURSEMENT_DATE); - Assert.assertNotNull(loanID); + Assertions.assertNotNull(loanID); HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID); LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap); String guarantorJSON = new GuarantorTestBuilder().externalCustomer().build(); Integer externalGuarantor = this.guarantorHelper.createGuarantor(loanID, guarantorJSON); - Assert.assertNotNull(externalGuarantor); + Assertions.assertNotNull(externalGuarantor); guarantorJSON = new GuarantorTestBuilder().existingCustomerWithoutGuaranteeAmount(String.valueOf(clientID_external)).build(); Integer withoutGuaranteeAmount = this.guarantorHelper.createGuarantor(loanID, guarantorJSON); - Assert.assertNotNull(withoutGuaranteeAmount); + Assertions.assertNotNull(withoutGuaranteeAmount); ArrayList errorData = (ArrayList) this.loanTransactionHelper.approveLoan(LOAN_DISBURSEMENT_DATE, null, loanID, CommonConstants.RESPONSE_ERROR); @@ -279,7 +279,7 @@ public class GuarantorTest { String.valueOf(selfSavigsId), String.valueOf(self1_guarantee)).build(); Integer selfGuarantee = this.guarantorHelper.createGuarantor(loanID, guarantorJSON); verifySavingsOnHoldBalance(selfSavigsId, null); - Assert.assertNotNull(selfGuarantee); + Assertions.assertNotNull(selfGuarantee); errorData = (ArrayList) this.loanTransactionHelper.approveLoan(LOAN_DISBURSEMENT_DATE, null, loanID, CommonConstants.RESPONSE_ERROR); @@ -291,7 +291,7 @@ public class GuarantorTest { String.valueOf(externalSavigsId_1), String.valueOf(external1_guarantee)).build(); Integer externalGuarantee_1 = this.guarantorHelper.createGuarantor(loanID, guarantorJSON); verifySavingsOnHoldBalance(externalSavigsId_1, null); - Assert.assertNotNull(externalGuarantee_1); + Assertions.assertNotNull(externalGuarantee_1); errorData = (ArrayList) this.loanTransactionHelper.approveLoan(LOAN_DISBURSEMENT_DATE, null, loanID, CommonConstants.RESPONSE_ERROR); @@ -302,7 +302,7 @@ public class GuarantorTest { guarantorJSON = new GuarantorTestBuilder().existingCustomerWithGuaranteeAmount(String.valueOf(clientID_external2), String.valueOf(externalSavigsId_2), String.valueOf(external2_guarantee)).build(); Integer externalGuarantee_2 = this.guarantorHelper.createGuarantor(loanID, guarantorJSON); - Assert.assertNotNull(externalGuarantee_2); + Assertions.assertNotNull(externalGuarantee_2); verifySavingsOnHoldBalance(externalSavigsId_2, null); LOG.info("-----------------------------------APPROVE LOAN-----------------------------------------"); @@ -349,7 +349,7 @@ public class GuarantorTest { String.valueOf(externalSavigsId_3), String.valueOf(external1_guarantee)).build(); Integer externalGuarantee_3 = this.guarantorHelper.createGuarantor(loanID, guarantorJSON); verifySavingsOnHoldBalance(externalSavigsId_3, external1_guarantee); - Assert.assertNotNull(externalGuarantee_3); + Assertions.assertNotNull(externalGuarantee_3); this.guarantorHelper.deleteGuarantor(externalGuarantee_1, fundDetailId, loanID); guarantors = this.guarantorHelper.getAllGuarantor(loanID); @@ -443,7 +443,7 @@ public class GuarantorTest { todaysDate.add(Calendar.DAY_OF_MONTH, -21); String LOAN_DISBURSEMENT_DATE = dateFormat.format(todaysDate.getTime()); final Integer loanID = applyForLoanApplication(clientID, loanProductID, LOAN_DISBURSEMENT_DATE); - Assert.assertNotNull(loanID); + Assertions.assertNotNull(loanID); HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID); LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap); @@ -451,13 +451,13 @@ public class GuarantorTest { String.valueOf(selfSavigsId), String.valueOf(self1_guarantee)).build(); Integer selfGuarantee = this.guarantorHelper.createGuarantor(loanID, guarantorJSON); verifySavingsOnHoldBalance(selfSavigsId, null); - Assert.assertNotNull(selfGuarantee); + Assertions.assertNotNull(selfGuarantee); guarantorJSON = new GuarantorTestBuilder().existingCustomerWithGuaranteeAmount(String.valueOf(clientID_external), String.valueOf(externalSavigsId_1), String.valueOf(external1_guarantee)).build(); Integer externalGuarantee_1 = this.guarantorHelper.createGuarantor(loanID, guarantorJSON); verifySavingsOnHoldBalance(externalSavigsId_1, null); - Assert.assertNotNull(externalGuarantee_1); + Assertions.assertNotNull(externalGuarantee_1); LOG.info("-----------------------------------APPROVE LOAN-----------------------------------------"); loanStatusHashMap = this.loanTransactionHelper.approveLoan(LOAN_DISBURSEMENT_DATE, loanID); @@ -516,7 +516,7 @@ public class GuarantorTest { todaysDate.add(Calendar.DAY_OF_MONTH, -21); String LOAN_DISBURSEMENT_DATE = dateFormat.format(todaysDate.getTime()); final Integer loanID = applyForLoanApplication(clientID, loanProductID, LOAN_DISBURSEMENT_DATE); - Assert.assertNotNull(loanID); + Assertions.assertNotNull(loanID); HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID); LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap); @@ -524,13 +524,13 @@ public class GuarantorTest { String.valueOf(selfSavigsId), String.valueOf(selfguarantee)).build(); Integer selfGuarantee = this.guarantorHelper.createGuarantor(loanID, guarantorJSON); verifySavingsOnHoldBalance(selfSavigsId, null); - Assert.assertNotNull(selfGuarantee); + Assertions.assertNotNull(selfGuarantee); guarantorJSON = new GuarantorTestBuilder().existingCustomerWithGuaranteeAmount(String.valueOf(clientID_external), String.valueOf(externalSavigsId_1), String.valueOf(externalguarantee)).build(); Integer externalGuarantee_1 = this.guarantorHelper.createGuarantor(loanID, guarantorJSON); verifySavingsOnHoldBalance(externalSavigsId_1, null); - Assert.assertNotNull(externalGuarantee_1); + Assertions.assertNotNull(externalGuarantee_1); LOG.info("-----------------------------------APPROVE LOAN-----------------------------------------"); loanStatusHashMap = this.loanTransactionHelper.approveLoan(LOAN_DISBURSEMENT_DATE, loanID); @@ -585,7 +585,7 @@ public class GuarantorTest { todaysDate.add(Calendar.DAY_OF_MONTH, -21); String LOAN_DISBURSEMENT_DATE = dateFormat.format(todaysDate.getTime()); final Integer loanID = applyForLoanApplication(clientID, loanProductID, LOAN_DISBURSEMENT_DATE); - Assert.assertNotNull(loanID); + Assertions.assertNotNull(loanID); HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID); LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap); @@ -593,12 +593,12 @@ public class GuarantorTest { String.valueOf(selfSavigsId), String.valueOf(self1_guarantee)).build(); Integer selfGuarantee = this.guarantorHelper.createGuarantor(loanID, guarantorJSON); verifySavingsOnHoldBalance(selfSavigsId, null); - Assert.assertNotNull(selfGuarantee); + Assertions.assertNotNull(selfGuarantee); guarantorJSON = new GuarantorTestBuilder().existingCustomerWithGuaranteeAmount(String.valueOf(clientID_external), String.valueOf(externalSavigsId_1), String.valueOf(external1_guarantee)).build(); Integer externalGuarantee_1 = this.guarantorHelper.createGuarantor(loanID, guarantorJSON); - Assert.assertNotNull(externalGuarantee_1); + Assertions.assertNotNull(externalGuarantee_1); verifySavingsOnHoldBalance(externalSavigsId_1, null); LOG.info("-----------------------------------APPROVE LOAN-----------------------------------------"); @@ -635,15 +635,15 @@ public class GuarantorTest { private void verifySavingsOnHoldBalance(final Integer savingsId, final Float expectedBalance) { Float onHoldAmount = (Float) this.savingsAccountHelper.getSavingsDetails(savingsId, "onHoldFunds"); - assertEquals("Verifying On Hold Funds", expectedBalance, onHoldAmount); + assertEquals(expectedBalance, onHoldAmount, "Verifying On Hold Funds"); } @SuppressWarnings({ "rawtypes", "cast" }) private void verifySavingsBalanceAndOnHoldBalance(final Integer savingsId, final Float expectedBalance, final Float accountBalance) { HashMap savingsDetails = (HashMap) this.savingsAccountHelper.getSavingsDetails(savingsId); - assertEquals("Verifying On Hold Funds", expectedBalance, savingsDetails.get("onHoldFunds")); + assertEquals(expectedBalance, savingsDetails.get("onHoldFunds"), "Verifying On Hold Funds"); HashMap summary = (HashMap) savingsDetails.get("summary"); - assertEquals("Verifying Account balance", accountBalance, summary.get("accountBalance")); + assertEquals(accountBalance, summary.get("accountBalance"), "Verifying Account balance"); } @SuppressWarnings("rawtypes") diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/variableinstallments/VariableInstallmentsIntegrationTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/variableinstallments/VariableInstallmentsIntegrationTest.java index bdb9e70b9..4026e4542 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/variableinstallments/VariableInstallmentsIntegrationTest.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/variableinstallments/VariableInstallmentsIntegrationTest.java @@ -30,9 +30,9 @@ import org.apache.fineract.integrationtests.common.ClientHelper; import org.apache.fineract.integrationtests.common.Utils; import org.apache.fineract.integrationtests.common.loans.LoanStatusChecker; import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -44,7 +44,7 @@ public class VariableInstallmentsIntegrationTest { private ResponseSpecification responseSpec; private LoanTransactionHelper loanTransactionHelper; - @Before + @BeforeEach public void setup() { Utils.initializeRESTAssured(); this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build(); @@ -59,9 +59,9 @@ public class VariableInstallmentsIntegrationTest { final Integer loanProductID = this.loanTransactionHelper.getLoanProductId(json); LOG.info("------------------------------RETRIEVING CREATED LOAN PRODUCT DETAILS ---------------------------------------"); Map loanProduct = (Map)loanTransactionHelper.getLoanProductDetail(requestSpec, responseSpec, loanProductID, "") ; - Assert.assertTrue((Boolean)loanProduct.get("allowVariableInstallments")) ; - Assert.assertEquals(Integer.valueOf(5), loanProduct.get("minimumGap")) ; - Assert.assertEquals(Integer.valueOf(90), loanProduct.get("maximumGap")) ; + Assertions.assertTrue((Boolean)loanProduct.get("allowVariableInstallments")) ; + Assertions.assertEquals(Integer.valueOf(5), loanProduct.get("minimumGap")) ; + Assertions.assertEquals(Integer.valueOf(90), loanProduct.get("maximumGap")) ; } @@ -71,7 +71,7 @@ public class VariableInstallmentsIntegrationTest { Integer loanProductID = this.loanTransactionHelper.getLoanProductId(josn); LOG.info("------------------------------RETRIEVING CREATED LOAN PRODUCT DETAILS ---------------------------------------"); Map loanProduct = (Map)loanTransactionHelper.getLoanProductDetail(requestSpec, responseSpec, loanProductID, "") ; - Assert.assertTrue(!(Boolean)loanProduct.get("allowVariableInstallments")) ; + Assertions.assertTrue(!(Boolean)loanProduct.get("allowVariableInstallments")) ; } @Test @@ -106,12 +106,12 @@ public class VariableInstallmentsIntegrationTest { } private void assertAfterSubmit(ArrayList serverData, ArrayList expectedData) { - Assert.assertTrue(serverData.size() == expectedData.size()) ; + Assertions.assertTrue(serverData.size() == expectedData.size()) ; for(int i = 0 ; i < serverData.size(); i++) { Map serverMap = serverData.get(i) ; Map expectedMap = expectedData.get(i) ; - Assert.assertTrue(VariableInstallmentsDecliningBalanceHelper.formatDate((ArrayList)serverMap.get("dueDate")).equals(expectedMap.get("dueDate"))) ; - Assert.assertTrue(serverMap.get("totalOutstandingForPeriod").toString().equals(expectedMap.get("installmentAmount"))) ; + Assertions.assertTrue(VariableInstallmentsDecliningBalanceHelper.formatDate((ArrayList)serverMap.get("dueDate")).equals(expectedMap.get("dueDate"))) ; + Assertions.assertTrue(serverMap.get("totalOutstandingForPeriod").toString().equals(expectedMap.get("installmentAmount"))) ; } } diff --git a/fineract-provider/src/test/java/org/apache/fineract/accounting/common/AccountingConstantsTest.java b/fineract-provider/src/test/java/org/apache/fineract/accounting/common/AccountingConstantsTest.java index 8f39eb833..71a215674 100644 --- a/fineract-provider/src/test/java/org/apache/fineract/accounting/common/AccountingConstantsTest.java +++ b/fineract-provider/src/test/java/org/apache/fineract/accounting/common/AccountingConstantsTest.java @@ -18,7 +18,7 @@ */ package org.apache.fineract.accounting.common; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.util.Assert; public class AccountingConstantsTest { diff --git a/fineract-provider/src/test/java/org/apache/fineract/batch/BatchBuilder.java b/fineract-provider/src/test/java/org/apache/fineract/batch/BatchBuilder.java index 5aa448ee8..7acb3a9bf 100644 --- a/fineract-provider/src/test/java/org/apache/fineract/batch/BatchBuilder.java +++ b/fineract-provider/src/test/java/org/apache/fineract/batch/BatchBuilder.java @@ -24,8 +24,8 @@ import javax.ws.rs.core.UriInfo; import org.apache.fineract.batch.domain.BatchRequest; import org.apache.fineract.batch.domain.BatchResponse; import org.apache.fineract.batch.service.BatchApiService; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import org.mockito.Mockito; /** @@ -60,6 +60,6 @@ public class BatchBuilder { Mockito.verify(serviceTest).handleBatchRequestsWithoutEnclosingTransaction(requestList, uriInfo); // Verifies a non-empty response by the BatchApiResource - Assert.assertNotNull(result); + Assertions.assertNotNull(result); } } diff --git a/fineract-provider/src/test/java/org/apache/fineract/commands/provider/CommandHandlerProviderTest.java b/fineract-provider/src/test/java/org/apache/fineract/commands/provider/CommandHandlerProviderTest.java index 91dda5d5e..754dcc2bb 100644 --- a/fineract-provider/src/test/java/org/apache/fineract/commands/provider/CommandHandlerProviderTest.java +++ b/fineract-provider/src/test/java/org/apache/fineract/commands/provider/CommandHandlerProviderTest.java @@ -18,22 +18,23 @@ */ package org.apache.fineract.commands.provider; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import org.apache.fineract.commands.exception.UnsupportedCommandException; import org.apache.fineract.commands.handler.NewCommandSourceHandler; import org.apache.fineract.infrastructure.configuration.spring.TestsWithoutDatabaseAndNoJobsConfiguration; import org.apache.fineract.infrastructure.core.api.JsonCommand; import org.apache.fineract.infrastructure.core.data.CommandProcessingResult; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.context.web.WebAppConfiguration; -@RunWith(SpringJUnit4ClassRunner.class) +@ExtendWith(SpringExtension.class) @WebAppConfiguration @ActiveProfiles("basicauth") @ContextConfiguration(classes = TestsWithoutDatabaseAndNoJobsConfiguration.class) @@ -58,8 +59,10 @@ public class CommandHandlerProviderTest { assertEquals(testCommandId, result.commandId()); } - @Test(expected = UnsupportedCommandException.class) - public void shouldThrowUnsupportedCommandException() { - this.commandHandlerProvider.getHandler("WHATEVER", "DOSOMETHING"); + @Test + public void shouldThrowUnsupportedCommandException() throws UnsupportedCommandException { + Assertions.assertThrows(UnsupportedCommandException.class, () -> { + this.commandHandlerProvider.getHandler("WHATEVER", "DOSOMETHING"); + }); } } diff --git a/fineract-provider/src/test/java/org/apache/fineract/common/Utils.java b/fineract-provider/src/test/java/org/apache/fineract/common/Utils.java index d9b0004b5..f14320856 100644 --- a/fineract-provider/src/test/java/org/apache/fineract/common/Utils.java +++ b/fineract-provider/src/test/java/org/apache/fineract/common/Utils.java @@ -22,7 +22,7 @@ import static io.restassured.RestAssured.given; import static io.restassured.path.json.JsonPath.from; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.is; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.fail; import io.restassured.RestAssured; import io.restassured.path.json.JsonPath; diff --git a/fineract-provider/src/test/java/org/apache/fineract/infrastructure/classdupes/ClasspathHellDuplicatesCheckRule.java b/fineract-provider/src/test/java/org/apache/fineract/infrastructure/classdupes/ClasspathHellDuplicatesCheckExtension.java similarity index 82% rename from fineract-provider/src/test/java/org/apache/fineract/infrastructure/classdupes/ClasspathHellDuplicatesCheckRule.java rename to fineract-provider/src/test/java/org/apache/fineract/infrastructure/classdupes/ClasspathHellDuplicatesCheckExtension.java index e15ae7948..862018c43 100644 --- a/fineract-provider/src/test/java/org/apache/fineract/infrastructure/classdupes/ClasspathHellDuplicatesCheckRule.java +++ b/fineract-provider/src/test/java/org/apache/fineract/infrastructure/classdupes/ClasspathHellDuplicatesCheckExtension.java @@ -20,10 +20,9 @@ package org.apache.fineract.infrastructure.classdupes; import java.util.List; import java.util.Map; -import junit.framework.AssertionFailedError; -import org.junit.rules.TestRule; -import org.junit.runner.Description; -import org.junit.runners.model.Statement; +import org.junit.jupiter.api.extension.AfterEachCallback; +import org.junit.jupiter.api.extension.ExtensionContext; +import org.opentest4j.AssertionFailedError; /** * JUnit Rule to run detect duplicate entries on the classpath. Usage: @@ -39,22 +38,21 @@ import org.junit.runners.model.Statement; * * @author Michael Vorburger.ch */ -public class ClasspathHellDuplicatesCheckRule implements TestRule { +public class ClasspathHellDuplicatesCheckExtension implements AfterEachCallback { private final ClasspathHellDuplicatesChecker checker; - public ClasspathHellDuplicatesCheckRule(ClasspathHellDuplicatesChecker checker) { + public ClasspathHellDuplicatesCheckExtension(ClasspathHellDuplicatesChecker checker) { this.checker = checker; } - public ClasspathHellDuplicatesCheckRule() { + public ClasspathHellDuplicatesCheckExtension() { this(ClasspathHellDuplicatesChecker.INSTANCE); } @Override - public Statement apply(Statement base, Description description) { + public void afterEach(ExtensionContext context) throws Exception { checkClasspath(); - return base; } protected void checkClasspath() { diff --git a/fineract-provider/src/test/java/org/apache/fineract/infrastructure/classdupes/ClasspathHellDuplicatesCheckRuleTest.java b/fineract-provider/src/test/java/org/apache/fineract/infrastructure/classdupes/ClasspathHellDuplicatesCheckRuleTest.java index a81797f1a..7861c492b 100644 --- a/fineract-provider/src/test/java/org/apache/fineract/infrastructure/classdupes/ClasspathHellDuplicatesCheckRuleTest.java +++ b/fineract-provider/src/test/java/org/apache/fineract/infrastructure/classdupes/ClasspathHellDuplicatesCheckRuleTest.java @@ -18,17 +18,17 @@ */ package org.apache.fineract.infrastructure.classdupes; -import org.junit.ClassRule; -import org.junit.Test; - +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; /** * {@link ClasspathHellDuplicatesCheckRule} test. * * @author Michael Vorburger */ +@ExtendWith(ClasspathHellDuplicatesCheckExtension.class) public class ClasspathHellDuplicatesCheckRuleTest { - @ClassRule public static ClasspathHellDuplicatesCheckRule jHades = new ClasspathHellDuplicatesCheckRule(); + // @ClassRule public static ClasspathHellDuplicatesCheckRule jHades = new ClasspathHellDuplicatesCheckRule(); @Test // we just need this because JUnit doesn't like a *Test class with only a Rule public void testIfThereAreAnyDuplicatesOnTheClasspath() throws Exception { } diff --git a/fineract-provider/src/test/java/org/apache/fineract/infrastructure/configuration/spring/SpringConfigurationTest.java b/fineract-provider/src/test/java/org/apache/fineract/infrastructure/configuration/spring/SpringConfigurationTest.java index 5e71525f3..cfb8b3665 100644 --- a/fineract-provider/src/test/java/org/apache/fineract/infrastructure/configuration/spring/SpringConfigurationTest.java +++ b/fineract-provider/src/test/java/org/apache/fineract/infrastructure/configuration/spring/SpringConfigurationTest.java @@ -18,11 +18,11 @@ */ package org.apache.fineract.infrastructure.configuration.spring; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.context.web.WebAppConfiguration; /** @@ -37,7 +37,7 @@ import org.springframework.test.context.web.WebAppConfiguration; * TestsWithoutDatabaseAndNoJobsConfiguration used extends * AbstractApplicationConfiguration). */ -@RunWith(SpringJUnit4ClassRunner.class) +@ExtendWith(SpringExtension.class) @WebAppConfiguration @ActiveProfiles("basicauth") @ContextConfiguration(classes = TestsWithoutDatabaseAndNoJobsConfiguration.class) diff --git a/fineract-provider/src/test/java/org/apache/fineract/infrastructure/core/boot/tests/AbstractSpringBootWithMariaDB4jIntegrationTest.java b/fineract-provider/src/test/java/org/apache/fineract/infrastructure/core/boot/tests/AbstractSpringBootWithMariaDB4jIntegrationTest.java index a346b8be8..39288cf4b 100644 --- a/fineract-provider/src/test/java/org/apache/fineract/infrastructure/core/boot/tests/AbstractSpringBootWithMariaDB4jIntegrationTest.java +++ b/fineract-provider/src/test/java/org/apache/fineract/infrastructure/core/boot/tests/AbstractSpringBootWithMariaDB4jIntegrationTest.java @@ -19,13 +19,13 @@ package org.apache.fineract.infrastructure.core.boot.tests; import org.apache.fineract.ServerWithMariaDB4jApplication; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.ActiveProfiles; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.context.web.WebAppConfiguration; -@RunWith(SpringJUnit4ClassRunner.class) +@ExtendWith(SpringExtension.class) @SpringBootTest(classes = ServerWithMariaDB4jApplication.Configuration.class) @WebAppConfiguration @ActiveProfiles("basicauth") diff --git a/fineract-provider/src/test/java/org/apache/fineract/infrastructure/core/boot/tests/EmbeddedTomcatWithSSLConfigurationTest.java b/fineract-provider/src/test/java/org/apache/fineract/infrastructure/core/boot/tests/EmbeddedTomcatWithSSLConfigurationTest.java index 2d7266656..b16f7d3be 100644 --- a/fineract-provider/src/test/java/org/apache/fineract/infrastructure/core/boot/tests/EmbeddedTomcatWithSSLConfigurationTest.java +++ b/fineract-provider/src/test/java/org/apache/fineract/infrastructure/core/boot/tests/EmbeddedTomcatWithSSLConfigurationTest.java @@ -18,13 +18,13 @@ */ package org.apache.fineract.infrastructure.core.boot.tests; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.File; import java.io.IOException; import org.apache.fineract.infrastructure.core.boot.EmbeddedTomcatWithSSLConfiguration; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.Resource; diff --git a/fineract-provider/src/test/java/org/apache/fineract/infrastructure/core/boot/tests/SpringBootServerLoginTest.java b/fineract-provider/src/test/java/org/apache/fineract/infrastructure/core/boot/tests/SpringBootServerLoginTest.java index ff81aedd1..e5b69b01b 100644 --- a/fineract-provider/src/test/java/org/apache/fineract/infrastructure/core/boot/tests/SpringBootServerLoginTest.java +++ b/fineract-provider/src/test/java/org/apache/fineract/infrastructure/core/boot/tests/SpringBootServerLoginTest.java @@ -19,15 +19,15 @@ package org.apache.fineract.infrastructure.core.boot.tests; import static org.hamcrest.Matchers.is; -import static org.junit.Assert.assertThat; +import static org.junit.jupiter.api.Assertions.assertThat; import java.util.List; import java.util.Map; import org.apache.fineract.ServerApplication; import org.apache.fineract.common.RestAssuredFixture; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; /** * This is an integration test for the Spring Boot launch stuff. @@ -39,7 +39,7 @@ public class SpringBootServerLoginTest extends AbstractSpringBootWithMariaDB4jIn protected RestAssuredFixture util; @Test - @Ignore("Failing on Cloubees") + @Disabled("Failing on Cloubees") public void hasPlatformStarted() { util = new RestAssuredFixture(8443); List> response = util.httpGet("/users"); diff --git a/fineract-provider/src/test/java/org/apache/fineract/infrastructure/core/exception/MultiExceptionTest.java b/fineract-provider/src/test/java/org/apache/fineract/infrastructure/core/exception/MultiExceptionTest.java index 0ff474c58..f28526840 100644 --- a/fineract-provider/src/test/java/org/apache/fineract/infrastructure/core/exception/MultiExceptionTest.java +++ b/fineract-provider/src/test/java/org/apache/fineract/infrastructure/core/exception/MultiExceptionTest.java @@ -18,7 +18,7 @@ */ package org.apache.fineract.infrastructure.core.exception; -import static org.junit.Assert.assertThrows; +import static org.junit.jupiter.api.Assertions.assertThrows; import java.util.Collections; import java.util.List; diff --git a/fineract-provider/src/test/java/org/apache/fineract/infrastructure/security/utils/SQLBuilderTest.java b/fineract-provider/src/test/java/org/apache/fineract/infrastructure/security/utils/SQLBuilderTest.java index 6ea5f2581..62707411e 100644 --- a/fineract-provider/src/test/java/org/apache/fineract/infrastructure/security/utils/SQLBuilderTest.java +++ b/fineract-provider/src/test/java/org/apache/fineract/infrastructure/security/utils/SQLBuilderTest.java @@ -18,11 +18,11 @@ */ package org.apache.fineract.infrastructure.security.utils; -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertThrows; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * Unit Test for {@link SQLBuilder}. @@ -67,20 +67,46 @@ public class SQLBuilderTest { } @Test - public void testAddIllegalArguments() { - assertThrows("space between column and operator", IllegalArgumentException.class, () -> new SQLBuilder().addCriteria("age<", 123)); - assertThrows("null Criteria Fragment", IllegalArgumentException.class, () -> new SQLBuilder().addCriteria(null, "argument")); - assertThrows("empty Criteria Fragment", IllegalArgumentException.class, () -> new SQLBuilder().addCriteria("", "argument")); - assertThrows("space only Criteria Fragment", IllegalArgumentException.class, () -> new SQLBuilder().addCriteria(" ", "argument")); - assertThrows("Criteria Fragment with ?", IllegalArgumentException.class, () -> new SQLBuilder().addCriteria("age = ?", 123)); - assertThrows("Criteria Fragment missing operator", IllegalArgumentException.class, () -> new SQLBuilder().addCriteria("age", 123)); - assertThrows("Criteria starts with AND", IllegalArgumentException.class, () -> new SQLBuilder().addCriteria("and age = ?", 123)); - assertThrows("Criteria ends with AND", IllegalArgumentException.class, () -> new SQLBuilder().addCriteria("age = ? and", 123)); - assertThrows("Criteria starts with OR", IllegalArgumentException.class, () -> new SQLBuilder().addCriteria("or age =", 123)); - assertThrows("Criteria ends with OR", IllegalArgumentException.class, () -> new SQLBuilder().addCriteria("age = ? or", 123)); - assertThrows("Criteria contains opening parentheis", IllegalArgumentException.class, () -> new SQLBuilder().addCriteria("(age =", 123)); - assertThrows("Criteria contains closing parentheis", IllegalArgumentException.class, () -> new SQLBuilder().addCriteria("age = ?)", 123)); - assertThrows("Offset corner case", IllegalArgumentException.class, () -> new SQLBuilder().addCriteria("age< = ?)", 123)); + public void testAddIllegalArguments() throws Exception { + assertThrows(IllegalArgumentException.class, ()-> { + new SQLBuilder().addCriteria("age<", 123); + }, "space between column and operator" ); + assertThrows(IllegalArgumentException.class, () -> { + new SQLBuilder().addCriteria(null, "argument"); + }, "null Criteria Fragment"); + assertThrows(IllegalArgumentException.class, () -> { + new SQLBuilder().addCriteria("", "argument"); + }, "empty Criteria Fragment" ); + assertThrows(IllegalArgumentException.class, () -> { + new SQLBuilder().addCriteria(" ", "argument"); + }, "space only Criteria Fragment"); + assertThrows(IllegalArgumentException.class, () -> { + new SQLBuilder().addCriteria("age = ?", 123); + }, "Criteria Fragment with ?"); + assertThrows(IllegalArgumentException.class, () -> { + new SQLBuilder().addCriteria("age", 123); + }, "Criteria Fragment missing operator"); + assertThrows(IllegalArgumentException.class, () -> { + new SQLBuilder().addCriteria("and age = ?", 123); + }, "Criteria starts with AND"); + assertThrows(IllegalArgumentException.class, () -> { + new SQLBuilder().addCriteria("age = ? and", 123); + }, "Criteria ends with AND"); + assertThrows(IllegalArgumentException.class, () -> { + new SQLBuilder().addCriteria("or age =", 123); + }, "Criteria starts with OR"); + assertThrows(IllegalArgumentException.class, () -> { + new SQLBuilder().addCriteria("age = ? or", 123); + }, "Criteria ends with OR"); + assertThrows(IllegalArgumentException.class, () -> { + new SQLBuilder().addCriteria("(age =", 123); + }, "Criteria contains opening parentheis"); + assertThrows(IllegalArgumentException.class, () -> { + new SQLBuilder().addCriteria("age = ?)", 123); + }, "Criteria contains closing parentheis"); + assertThrows(IllegalArgumentException.class, () -> { + new SQLBuilder().addCriteria("age< = ?)", 123); + }, "Offset corner case"); } } diff --git a/fineract-provider/src/test/java/org/apache/fineract/mix/report/service/ReadTaxonomyMappingServiceImplTest.java b/fineract-provider/src/test/java/org/apache/fineract/mix/report/service/ReadTaxonomyMappingServiceImplTest.java index 1ec2a037b..8f72afa2a 100644 --- a/fineract-provider/src/test/java/org/apache/fineract/mix/report/service/ReadTaxonomyMappingServiceImplTest.java +++ b/fineract-provider/src/test/java/org/apache/fineract/mix/report/service/ReadTaxonomyMappingServiceImplTest.java @@ -18,23 +18,23 @@ */ package org.apache.fineract.mix.report.service; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import java.util.ArrayList; import org.apache.fineract.infrastructure.core.service.RoutingDataSource; import org.apache.fineract.mix.service.XBRLResultServiceImpl; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mockito; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class ReadTaxonomyMappingServiceImplTest { private XBRLResultServiceImpl readService; - @Before + @BeforeEach public void setUp() throws Exception { final RoutingDataSource dataSource = Mockito.mock(RoutingDataSource.class); this.readService = new XBRLResultServiceImpl(dataSource, null, null); diff --git a/fineract-provider/src/test/java/org/apache/fineract/mix/report/service/XBRLBuilderTest.java b/fineract-provider/src/test/java/org/apache/fineract/mix/report/service/XBRLBuilderTest.java index c16dcb946..e68dec78a 100644 --- a/fineract-provider/src/test/java/org/apache/fineract/mix/report/service/XBRLBuilderTest.java +++ b/fineract-provider/src/test/java/org/apache/fineract/mix/report/service/XBRLBuilderTest.java @@ -18,8 +18,8 @@ */ package org.apache.fineract.mix.report.service; -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.Mockito.lenient; import static org.mockito.Mockito.when; @@ -35,20 +35,20 @@ import org.apache.fineract.mix.data.MixTaxonomyData; import org.apache.fineract.mix.data.NamespaceData; import org.apache.fineract.mix.service.NamespaceReadPlatformServiceImpl; import org.apache.fineract.mix.service.XBRLBuilder; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.ArgumentMatchers; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.w3c.dom.NodeList; import org.xml.sax.SAXException; -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class XBRLBuilderTest { private final static Logger LOG = LoggerFactory.getLogger(XBRLBuilderTest.class); @Mock @@ -57,7 +57,7 @@ public class XBRLBuilderTest { @InjectMocks private final XBRLBuilder xbrlBuilder = new XBRLBuilder(); - @Before + @BeforeEach public void setUp() { this.readNamespaceService = Mockito.mock(NamespaceReadPlatformServiceImpl.class); lenient().when(this.readNamespaceService.retrieveNamespaceByPrefix(ArgumentMatchers.anyString())) diff --git a/fineract-provider/src/test/java/org/apache/fineract/notification/ListenerTest.java b/fineract-provider/src/test/java/org/apache/fineract/notification/ListenerTest.java index f43ed09a4..42fa9d446 100644 --- a/fineract-provider/src/test/java/org/apache/fineract/notification/ListenerTest.java +++ b/fineract-provider/src/test/java/org/apache/fineract/notification/ListenerTest.java @@ -21,20 +21,20 @@ package org.apache.fineract.notification; import javax.jms.JMSException; import javax.jms.Session; import javax.jms.TextMessage; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mockito; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class ListenerTest { private Listener listener; private Session session; private TextMessage textMessageMock; - @Before + @BeforeEach public void setUp() { listener = new Listener(); session = Mockito.mock(Session.class); diff --git a/fineract-provider/src/test/java/org/apache/fineract/notification/StorageTest.java b/fineract-provider/src/test/java/org/apache/fineract/notification/StorageTest.java index efe585f60..053a0e107 100644 --- a/fineract-provider/src/test/java/org/apache/fineract/notification/StorageTest.java +++ b/fineract-provider/src/test/java/org/apache/fineract/notification/StorageTest.java @@ -18,7 +18,7 @@ */ package org.apache.fineract.notification; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.ArgumentMatchers.refEq; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; @@ -36,15 +36,15 @@ import org.apache.fineract.notification.service.NotificationMapperWritePlatformS import org.apache.fineract.notification.service.NotificationWritePlatformServiceImpl; import org.apache.fineract.useradministration.domain.AppUser; import org.apache.fineract.useradministration.domain.AppUserRepository; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.security.core.userdetails.User; -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class StorageTest { private NotificationWritePlatformServiceImpl notificationWritePlatformServiceImpl; @@ -61,7 +61,7 @@ public class StorageTest { @Mock private AppUserRepository appUserRepository; - @Before + @BeforeEach public void setUp() { notificationWritePlatformServiceImpl = new NotificationWritePlatformServiceImpl( notificationGeneratorWritePlatformService, @@ -71,7 +71,7 @@ public class StorageTest { } @Test - @Ignore // TODO FINERACT-828 + @Disabled // TODO FINERACT-828 public void testNotificationStorage() { Long userId = 1L; String objectType = "CLIENT"; diff --git a/fineract-provider/src/test/java/org/apache/fineract/notification/TopicTest.java b/fineract-provider/src/test/java/org/apache/fineract/notification/TopicTest.java index e79fa5ccf..aa997b9a4 100644 --- a/fineract-provider/src/test/java/org/apache/fineract/notification/TopicTest.java +++ b/fineract-provider/src/test/java/org/apache/fineract/notification/TopicTest.java @@ -18,7 +18,7 @@ */ package org.apache.fineract.notification; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.ArgumentMatchers.refEq; import static org.mockito.Mockito.lenient; import static org.mockito.Mockito.times; @@ -37,12 +37,12 @@ import org.apache.fineract.useradministration.domain.AppUser; import org.apache.fineract.useradministration.domain.AppUserRepository; import org.apache.fineract.useradministration.domain.Role; import org.apache.fineract.useradministration.domain.RoleRepository; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class TopicTest { @Mock diff --git a/fineract-provider/src/test/java/org/apache/fineract/portfolio/loanaccount/AdhikarLoanRepaymentScheduleTransactionProcessorTest.java b/fineract-provider/src/test/java/org/apache/fineract/portfolio/loanaccount/AdhikarLoanRepaymentScheduleTransactionProcessorTest.java index e5c731477..f92dd1556 100644 --- a/fineract-provider/src/test/java/org/apache/fineract/portfolio/loanaccount/AdhikarLoanRepaymentScheduleTransactionProcessorTest.java +++ b/fineract-provider/src/test/java/org/apache/fineract/portfolio/loanaccount/AdhikarLoanRepaymentScheduleTransactionProcessorTest.java @@ -26,13 +26,13 @@ import org.apache.fineract.organisation.monetary.domain.MoneyHelper; import org.apache.fineract.portfolio.loanaccount.domain.LoanRepaymentScheduleInstallment; import org.apache.fineract.portfolio.loanaccount.domain.transactionprocessor.impl.RBILoanRepaymentScheduleTransactionProcessor; import org.joda.time.LocalDate; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.junit.MockitoJUnitRunner; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.junit.jupiter.MockitoExtension; @SuppressWarnings("unused") -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class AdhikarLoanRepaymentScheduleTransactionProcessorTest { // class under test @@ -43,7 +43,7 @@ public class AdhikarLoanRepaymentScheduleTransactionProcessorTest { private final MonetaryCurrency usDollars = new MonetaryCurrencyBuilder().withCode("USD").withDigitsAfterDecimal(2).build(); private List installments; - @Before + @BeforeEach public void setUpForEachTestCase() throws Exception { Field field = MoneyHelper.class.getDeclaredField("roundingMode"); diff --git a/fineract-provider/src/test/java/org/apache/fineract/portfolio/loanaccount/HeavensFamilyLoanRepaymentScheduleTransactionProcessorTest.java b/fineract-provider/src/test/java/org/apache/fineract/portfolio/loanaccount/HeavensFamilyLoanRepaymentScheduleTransactionProcessorTest.java index c0e6f7b2f..74c1f14f8 100644 --- a/fineract-provider/src/test/java/org/apache/fineract/portfolio/loanaccount/HeavensFamilyLoanRepaymentScheduleTransactionProcessorTest.java +++ b/fineract-provider/src/test/java/org/apache/fineract/portfolio/loanaccount/HeavensFamilyLoanRepaymentScheduleTransactionProcessorTest.java @@ -26,13 +26,13 @@ import org.apache.fineract.organisation.monetary.domain.MoneyHelper; import org.apache.fineract.portfolio.loanaccount.domain.LoanRepaymentScheduleInstallment; import org.apache.fineract.portfolio.loanaccount.domain.transactionprocessor.impl.HeavensFamilyLoanRepaymentScheduleTransactionProcessor; import org.joda.time.LocalDate; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.junit.MockitoJUnitRunner; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.junit.jupiter.MockitoExtension; @SuppressWarnings("unused") -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class HeavensFamilyLoanRepaymentScheduleTransactionProcessorTest { // class under test @@ -43,7 +43,7 @@ public class HeavensFamilyLoanRepaymentScheduleTransactionProcessorTest { private final MonetaryCurrency usDollars = new MonetaryCurrencyBuilder().withCode("USD").withDigitsAfterDecimal(2).build(); private List installments; - @Before + @BeforeEach public void setUpForEachTestCase() throws Exception { Field field = MoneyHelper.class.getDeclaredField("roundingMode"); diff --git a/fineract-provider/src/test/java/org/apache/fineract/template/TemplateMergeServiceTest.java b/fineract-provider/src/test/java/org/apache/fineract/template/TemplateMergeServiceTest.java index 87767fbcc..a98c9f52a 100644 --- a/fineract-provider/src/test/java/org/apache/fineract/template/TemplateMergeServiceTest.java +++ b/fineract-provider/src/test/java/org/apache/fineract/template/TemplateMergeServiceTest.java @@ -18,7 +18,7 @@ */ package org.apache.fineract.template; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import com.google.common.io.Resources; import com.google.common.reflect.TypeToken; @@ -45,14 +45,14 @@ import org.apache.fineract.template.domain.Template; import org.apache.fineract.template.domain.TemplateMapper; import org.apache.fineract.template.service.TemplateMergeService; import org.joda.time.LocalDate; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class TemplateMergeServiceTest { private TemplateMergeService tms = new TemplateMergeService(); - @Before + @BeforeEach public void setUpForEachTestCase() throws Exception { Field field = MoneyHelper.class.getDeclaredField("roundingMode");