From 0e4aeef1af7b15d9f9cabbdcdeb3a61b1b240683 Mon Sep 17 00:00:00 2001 From: Petri Tuomola Date: Tue, 5 May 2020 00:19:05 +0300 Subject: [PATCH] FINERACT-846: Migrating to Java 11, upgrading dependencies, fixing compiler warnings --- .travis.yml | 2 +- Dockerfile | 5 +- README.md | 2 +- fineract-provider/build.gradle | 29 +++- fineract-provider/dependencies.gradle | 16 +- .../integrationtests/AccountTransferTest.java | 32 ++-- .../AccountingScenarioIntegrationTest.java | 14 +- .../ClientLoanIntegrationTest.java | 148 ++++++++-------- .../ClientSavingsIntegrationTest.java | 159 +++++++++--------- ...ndoRejectAndWithdrawalIntegrationTest.java | 28 +-- .../integrationtests/FixedDepositTest.java | 81 ++++----- .../FundsIntegrationTest.java | 8 +- .../GroupLoanIntegrationTest.java | 18 +- .../GroupSavingsIntegrationTest.java | 16 +- ...oanDisbursementDetailsIntegrationTest.java | 12 +- ...iveInterestAndWriteOffIntegrationTest.java | 12 +- .../RecurringDepositTest.java | 88 +++++----- .../SchedulerJobsTestResults.java | 14 +- .../fineract/integrationtests/StaffTest.java | 4 +- .../integrationtests/common/CenterDomain.java | 8 +- .../integrationtests/common/ClientHelper.java | 10 +- .../common/GlobalConfigurationHelper.java | 6 +- .../integrationtests/common/HookHelper.java | 4 +- .../integrationtests/common/OfficeHelper.java | 2 +- .../common/ProvisioningIntegrationTest.java | 2 +- .../integrationtests/common/Utils.java | 2 +- .../common/organisation/CampaignsHelper.java | 8 +- .../common/organisation/CurrencyHelper.java | 6 +- .../provisioning/ProvisioningHelper.java | 14 +- .../interoperation/InteropTest.java | 2 +- .../loanaccount/guarantor/GuarantorTest.java | 114 ++++++------- .../importhandler/ImportHandlerUtils.java | 57 ++++--- .../populator/AbstractWorkbookPopulator.java | 4 +- .../populator/loan/LoanWorkbookPopulator.java | 7 +- ...ulkImportWorkbookPopulatorServiceImpl.java | 6 +- .../core/boot/WebFrontEndConfiguration.java | 4 +- .../boot/WebTwoFactorXmlConfiguration.java | 2 +- .../core/boot/WebXmlConfiguration.java | 8 +- .../core/boot/WebXmlOauthConfiguration.java | 8 +- .../core/domain/MySQLDictionaryCustom.java | 1 + .../core/serialization/FromJsonHelper.java | 6 +- .../service/TenantDatabaseUpgradeService.java | 4 +- .../ReadWriteNonCoreDataServiceImpl.java | 4 +- .../S3ContentRepository.java | 3 - .../infrastructure/gcm/domain/Sender.java | 6 +- .../hooks/processor/TwilioHookProcessor.java | 4 +- .../hooks/processor/WebHookProcessor.java | 2 +- .../security/domain/OTPRequestRepository.java | 6 +- ...WritePlatformServiceJpaRepositoryImpl.java | 2 +- ...WritePlatformServiceJpaRepositoryImpl.java | 8 +- .../group/api/GroupsApiResource.java | 10 +- .../savings/api/SelfSavingsApiResource.java | 4 +- .../org/apache/fineract/common/Utils.java | 2 +- .../ReadTaxonomyMappingServiceImplTest.java | 2 +- .../mix/report/service/XBRLBuilderTest.java | 6 +- .../fineract/notification/ListenerTest.java | 2 +- .../fineract/notification/StorageTest.java | 2 +- .../fineract/notification/TopicTest.java | 2 +- ...ymentScheduleTransactionProcessorTest.java | 4 +- ...ymentScheduleTransactionProcessorTest.java | 4 +- .../template/TemplateMergeServiceTest.java | 2 +- 61 files changed, 530 insertions(+), 518 deletions(-) diff --git a/.travis.yml b/.travis.yml index 70d7c4721..fad6d6d99 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,7 +22,7 @@ dist: trusty language: java jdk: - - openjdk8 + - openjdk12 services: - mysql diff --git a/Dockerfile b/Dockerfile index b01953a3a..859f2a38e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,7 +15,7 @@ # specific language governing permissions and limitations # under the License. # -FROM openjdk:8 AS builder +FROM openjdk:11 AS builder # COPY . fineract is slow e.g. when using Podman instead of Docker (because it doesn't honor .dockerignore and copies all of .git/** into the container..), so let's explicitly list only what we need: COPY fineract-provider/src/main fineract/fineract-provider/src/main/ @@ -39,13 +39,10 @@ RUN ./gradlew clean -x rat -x test war FROM bitnami/tomcat:9.0 as fineract -ENV JAVA_HOME /usr/local/openjdk-8/jre - USER root RUN apt-get update -qq && apt-get install -y wget COPY --from=builder /fineract/build/libs/fineract-provider.war /opt/bitnami/tomcat/webapps -COPY --from=builder /usr/local/openjdk-8/jre /usr/local/openjdk-8/jre RUN keytool -genkey -keyalg RSA -alias tomcat -keystore /opt/bitnami/tomcat/tomcat.keystore -keypass xyz123 -storepass xyz123 -noprompt -dname "CN=Fineract, OU=Fineract, O=Fineract, L=Unknown, ST=Unknown, C=Unknown" COPY ./docker/server.xml /opt/bitnami/tomcat/conf diff --git a/README.md b/README.md index cbc630e48..208685ced 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ If you are interested in contributing to this project, but perhaps don't quite k Requirements ============ -* Java >= 1.8 (Oracle JVMs have been tested) +* Java >= 11 (Oracle JVMs have been tested) * MySQL 5.5 * Tomcat 9, if deploying to a separate servlet container. Until FINERACT-730, Tomcat 7/8 were also supported, but now Tomcat 9 is required. diff --git a/fineract-provider/build.gradle b/fineract-provider/build.gradle index d3cb3ee90..b746a67df 100644 --- a/fineract-provider/build.gradle +++ b/fineract-provider/build.gradle @@ -21,6 +21,8 @@ Run as: gradle clean bootRun''' project.ext.jerseyVersion = '1.19.4' +ext["groovy.version"] = '3.0.3' + buildscript { ext { @@ -103,12 +105,17 @@ dependencyManagement { dependency 'io.swagger:swagger-jersey-jaxrs:1.5.15' dependency 'jakarta.management.j2ee:jakarta.management.j2ee-api:1.1.4' dependency 'jakarta.jms:jakarta.jms-api:2.0.3' + dependency 'jakarta.xml.bind:jakarta.xml.bind-api:2.3.3' dependency 'org.apache.activemq:activemq-broker:+' dependency 'org.apache.bval:org.apache.bval.bundle:2.0.2' dependency 'junit:junit:+' dependency 'org.mockito:mockito-core:+' - dependency 'org.slf4j:slf4j-simple:1.7.30' + dependency 'org.slf4j:slf4j-simple:1.8.0-beta4' + dependency 'org.slf4j:slf4j-api:1.8.0-beta4' dependency 'com.mockrunner:mockrunner-jms:2.0.1' + dependency 'dom4j:dom4j:1.6.1' + dependency 'xerces:xercesImpl:2.12.0' + dependency 'io.github.classgraph:classgraph:4.8.43' dependencySet(group: 'com.sun.jersey', version: jerseyVersion) { entry 'jersey-core' @@ -120,18 +127,24 @@ dependencyManagement { entry 'jersey-spring' entry 'jersey-multipart' } - dependencySet(group: 'org.apache.poi', version: '3.9') { + dependencySet(group: 'org.apache.poi', version: '4.1.2') { entry 'poi' entry 'poi-ooxml' entry 'poi-ooxml-schemas' - } + } + dependencySet(group: 'io.rest-assured', version: '4.3.0') + { + entry 'rest-assured' + entry 'json-path' + entry 'xml-path' + } } } /* define the valid syntax level for source files */ -sourceCompatibility = JavaVersion.VERSION_1_8 +sourceCompatibility = JavaVersion.VERSION_11 /* define binary compatibility version */ -targetCompatibility = JavaVersion.VERSION_1_8 +targetCompatibility = JavaVersion.VERSION_11 project.ext.mysqlUser='root' project.ext.mysqlPassword='mysql' @@ -270,6 +283,12 @@ configurations { runtime all*.exclude module: 'jul-to-slf4j' // see FINERACT-700 re. ClassCircularityError: java/util/logging/LogRecord } + +tasks.withType(JavaCompile) { + options.compilerArgs << '-Xlint:unchecked' + options.deprecation = true +} + /* Pick up dependencies based on the environemnt, defaults to production */ if (project.hasProperty('env') && project.getProperty('env') == 'dev') { apply from: 'dev-dependencies.gradle' diff --git a/fineract-provider/dependencies.gradle b/fineract-provider/dependencies.gradle index ea2596f1d..5bd9834f8 100644 --- a/fineract-provider/dependencies.gradle +++ b/fineract-provider/dependencies.gradle @@ -83,6 +83,7 @@ dependencies { 'org.apache.poi:poi', 'org.apache.poi:poi-ooxml', 'org.apache.poi:poi-ooxml-schemas', + 'dom4j:dom4j', 'com.lowagie:itext', @@ -96,7 +97,10 @@ dependencies { // it's useful to have this for the Spring Boot TestRestTemplate http://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle/#boot-features-rest-templates-test-utility 'org.apache.httpcomponents:httpclient', - 'org.apache.bval:org.apache.bval.bundle' + 'org.apache.bval:org.apache.bval.bundle', + + // JAX-B dependencies for JDK 9+ + "jakarta.xml.bind:jakarta.xml.bind-api" ) implementation ('io.swagger:swagger-jersey-jaxrs') { exclude group: 'javax.validation' @@ -106,8 +110,9 @@ dependencies { } testCompile 'junit:junit', + 'xerces:xercesImpl', 'org.mockito:mockito-core', - 'io.github.classgraph:classgraph:4.8.43', + 'io.github.classgraph:classgraph', 'com.google.code.gson:gson', 'org.springframework:spring-jms', 'joda-time:joda-time', @@ -115,13 +120,14 @@ dependencies { 'org.apache.poi:poi-ooxml', 'org.springframework:spring-context-support', 'com.sun.jersey:jersey-core' - testCompile ('com.mockrunner:mockrunner-jms') { - exclude group: 'regexp' - } + testCompile ('io.rest-assured:rest-assured') { exclude group: 'commons-logging' exclude group: 'org.apache.sling' } + testCompile ('com.mockrunner:mockrunner-jms') { + exclude group: 'regexp' + } testCompile ('org.springframework.boot:spring-boot-starter-test') { exclude group: 'com.jayway.jsonpath', module: 'json-path' } 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 d941731ad..5b7678507 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 @@ -77,8 +77,8 @@ public class AccountTransferTest { private AccountHelper accountHelper; private JournalEntryHelper journalEntryHelper; - Float TRANSFER_AMOUNT = new Float(ACCOUNT_TRANSFER_AMOUNT); - Float TRANSFER_AMOUNT_ADJUST = new Float(ACCOUNT_TRANSFER_AMOUNT_ADJUST); + Float TRANSFER_AMOUNT = Float.valueOf(ACCOUNT_TRANSFER_AMOUNT); + Float TRANSFER_AMOUNT_ADJUST = Float.valueOf(ACCOUNT_TRANSFER_AMOUNT_ADJUST); private FinancialActivityAccountHelper financialActivityAccountHelper; private Integer financialActivityAccountId; @@ -195,14 +195,14 @@ public class AccountTransferTest { final HashMap fromSavingsSummaryBefore = this.savingsAccountHelper.getSavingsSummary(fromSavingsID); - Float fromSavingsBalance = new Float(MINIMUM_OPENING_BALANCE); - Float toSavingsBalance = new Float(MINIMUM_OPENING_BALANCE); + Float fromSavingsBalance = Float.valueOf(MINIMUM_OPENING_BALANCE); + Float toSavingsBalance = Float.valueOf(MINIMUM_OPENING_BALANCE); this.accountTransferHelper.accountTransfer(fromClientID, fromSavingsID, fromClientID, toSavingsID, FROM_SAVINGS_ACCOUNT_TYPE, TO_SAVINGS_ACCOUNT_TYPE, ACCOUNT_TRANSFER_AMOUNT); - fromSavingsBalance -= new Float(ACCOUNT_TRANSFER_AMOUNT); - toSavingsBalance += new Float(ACCOUNT_TRANSFER_AMOUNT); + fromSavingsBalance -= Float.valueOf(ACCOUNT_TRANSFER_AMOUNT); + toSavingsBalance += Float.valueOf(ACCOUNT_TRANSFER_AMOUNT); HashMap fromSavingsSummaryAfter = this.savingsAccountHelper.getSavingsSummary(fromSavingsID); assertEquals("Verifying From Savings Account Balance after Account Transfer", fromSavingsBalance, @@ -211,9 +211,9 @@ public class AccountTransferTest { HashMap toSavingsSummaryAfter = this.savingsAccountHelper.getSavingsSummary(toSavingsID); assertEquals("Verifying To Savings Account Balance after Account Transfer", toSavingsBalance, toSavingsSummaryAfter.get("accountBalance")); - final JournalEntry[] office1LiabilityEntries = { new JournalEntry(new Float(ACCOUNT_TRANSFER_AMOUNT), + final JournalEntry[] office1LiabilityEntries = { new JournalEntry(Float.valueOf(ACCOUNT_TRANSFER_AMOUNT), JournalEntry.TransactionType.CREDIT) }; - final JournalEntry[] office2LiabilityEntries = { new JournalEntry(new Float(ACCOUNT_TRANSFER_AMOUNT), + final JournalEntry[] office2LiabilityEntries = { new JournalEntry(Float.valueOf(ACCOUNT_TRANSFER_AMOUNT), JournalEntry.TransactionType.DEBIT) }; this.journalEntryHelper.checkJournalEntryForLiabilityAccount(fromOfficeId, liabilityTransferAccount, @@ -293,7 +293,7 @@ public class AccountTransferTest { final HashMap fromSavingsSummaryBefore = this.savingsAccountHelper.getSavingsSummary(fromSavingsID); - Float fromSavingsBalance = new Float(MINIMUM_OPENING_BALANCE); + Float fromSavingsBalance = Float.valueOf(MINIMUM_OPENING_BALANCE); this.accountTransferHelper.accountTransfer(fromClientID, fromSavingsID, toClientID, toLoanID, FROM_SAVINGS_ACCOUNT_TYPE, TO_LOAN_ACCOUNT_TYPE, ACCOUNT_TRANSFER_AMOUNT_ADJUST); @@ -308,9 +308,9 @@ public class AccountTransferTest { assertEquals("Verifying To Loan Repayment Amount after Account Transfer", TRANSFER_AMOUNT_ADJUST, toLoanSummaryAfter.get("totalRepayment")); - final JournalEntry[] office1LiabilityEntries = { new JournalEntry(new Float(ACCOUNT_TRANSFER_AMOUNT_ADJUST), + final JournalEntry[] office1LiabilityEntries = { new JournalEntry(Float.valueOf(ACCOUNT_TRANSFER_AMOUNT_ADJUST), JournalEntry.TransactionType.CREDIT) }; - final JournalEntry[] office2LiabilityEntries = { new JournalEntry(new Float(ACCOUNT_TRANSFER_AMOUNT_ADJUST), + final JournalEntry[] office2LiabilityEntries = { new JournalEntry(Float.valueOf(ACCOUNT_TRANSFER_AMOUNT_ADJUST), JournalEntry.TransactionType.DEBIT) }; this.journalEntryHelper.checkJournalEntryForLiabilityAccount(fromOfficeId, liabilityTransferAccount, @@ -403,7 +403,7 @@ public class AccountTransferTest { final HashMap toSavingsSummaryBefore = this.savingsAccountHelper.getSavingsSummary(toSavingsID); - Float fromSavingsBalance = new Float(MINIMUM_OPENING_BALANCE); + Float fromSavingsBalance = Float.valueOf(MINIMUM_OPENING_BALANCE); this.accountTransferHelper.accountTransfer(fromClientID, fromSavingsID, fromClientID, loanID, FROM_SAVINGS_ACCOUNT_TYPE, TO_LOAN_ACCOUNT_TYPE, ACCOUNT_TRANSFER_AMOUNT); @@ -416,7 +416,7 @@ public class AccountTransferTest { assertEquals("Verifying From Savings Account Balance after Account Transfer", fromSavingsBalance, fromSavingsSummaryAfter.get("accountBalance")); - Float toSavingsBalance = new Float(MINIMUM_OPENING_BALANCE); + Float toSavingsBalance = Float.valueOf(MINIMUM_OPENING_BALANCE); this.accountTransferHelper.accountTransfer(fromClientID, loanID, toClientID, toSavingsID, FROM_LOAN_ACCOUNT_TYPE, TO_SAVINGS_ACCOUNT_TYPE, ACCOUNT_TRANSFER_AMOUNT_ADJUST); @@ -429,9 +429,9 @@ public class AccountTransferTest { assertEquals("Verifying From Savings Account Balance after Account Transfer", toSavingsBalance, toSavingsSummaryAfter.get("accountBalance")); - final JournalEntry[] office1LiabilityEntries = { new JournalEntry(new Float(ACCOUNT_TRANSFER_AMOUNT_ADJUST), + final JournalEntry[] office1LiabilityEntries = { new JournalEntry(Float.valueOf(ACCOUNT_TRANSFER_AMOUNT_ADJUST), JournalEntry.TransactionType.CREDIT) }; - final JournalEntry[] office2LiabilityEntries = { new JournalEntry(new Float(ACCOUNT_TRANSFER_AMOUNT_ADJUST), + final JournalEntry[] office2LiabilityEntries = { new JournalEntry(Float.valueOf(ACCOUNT_TRANSFER_AMOUNT_ADJUST), JournalEntry.TransactionType.DEBIT) }; this.journalEntryHelper.checkJournalEntryForLiabilityAccount(fromOfficeId, liabilityTransferAccount, @@ -487,4 +487,4 @@ public class AccountTransferTest { .build(clientID.toString(), loanProductID.toString(), null); return this.loanTransactionHelper.getLoanId(loanApplicationJSON); } -} \ No newline at end of file +} 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 02aee8df0..31d89abcf 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 @@ -88,10 +88,10 @@ public class AccountingScenarioIntegrationTest { public static final String WITHDRAWAL_AMOUNT = "3000"; public static final String WITHDRAWAL_AMOUNT_ADJUSTED = "2000"; - Float SP_BALANCE = new Float(MINIMUM_OPENING_BALANCE); - Float SP_DEPOSIT_AMOUNT = new Float(DEPOSIT_AMOUNT); - Float SP_WITHDRAWAL_AMOUNT = new Float(WITHDRAWAL_AMOUNT); - Float SP_WITHDRAWAL_AMOUNT_ADJUSTED = new Float(WITHDRAWAL_AMOUNT_ADJUSTED); + Float SP_BALANCE = Float.valueOf(MINIMUM_OPENING_BALANCE); + Float SP_DEPOSIT_AMOUNT = Float.valueOf(DEPOSIT_AMOUNT); + Float SP_WITHDRAWAL_AMOUNT = Float.valueOf(WITHDRAWAL_AMOUNT); + Float SP_WITHDRAWAL_AMOUNT_ADJUSTED = Float.valueOf(WITHDRAWAL_AMOUNT_ADJUSTED); private final String REPAYMENT_DATE[] = { "", "04 May 2011", "04 July 2011", "04 September 2011", "04 November 2011", "04 January 2012" }; private final Float REPAYMENT_AMOUNT[] = { .0f, 2200.0f, 3000.0f, 900.0f, 2000.0f, 2500.0f }; @@ -817,7 +817,7 @@ public class AccountingScenarioIntegrationTest { float totalInterest = (float) loanSchedule.get(1).get("interestOriginalDue"); DecimalFormat numberFormat = new DecimalFormat("#.00", new DecimalFormatSymbols(Locale.US)); float INTEREST_4_DAYS = totalInterest / totalDaysInPeriod * 4; - INTEREST_4_DAYS = new Float(numberFormat.format(INTEREST_4_DAYS)); + INTEREST_4_DAYS = Float.valueOf(numberFormat.format(INTEREST_4_DAYS)); this.loanTransactionHelper.checkAccrualTransactionForRepayment(getDateAsLocalDate(currentDate), INTEREST_4_DAYS, FEE_PORTION, PENALTY_PORTION, loanID); @@ -931,7 +931,7 @@ public class AccountingScenarioIntegrationTest { float totalInterest = (float) loanSchedule.get(1).get("interestOriginalDue"); DecimalFormat numberFormat = new DecimalFormat("#.00", new DecimalFormatSymbols(Locale.US)); float INTEREST_3_DAYS = totalInterest / totalDaysInPeriod * 3; - INTEREST_3_DAYS = new Float(numberFormat.format(INTEREST_3_DAYS)); + INTEREST_3_DAYS = Float.valueOf(numberFormat.format(INTEREST_3_DAYS)); this.loanTransactionHelper.checkAccrualTransactionForRepayment(getDateAsLocalDate(runOndate), INTEREST_3_DAYS, FEE_PORTION, PENALTY_PORTION, loanID); @@ -939,7 +939,7 @@ public class AccountingScenarioIntegrationTest { this.periodicAccrualAccountingHelper.runPeriodicAccrualAccounting(runOndate); float interestPerDay = (totalInterest / totalDaysInPeriod * 4) - INTEREST_3_DAYS; - interestPerDay = new Float(numberFormat.format(interestPerDay)); + interestPerDay = Float.valueOf(numberFormat.format(interestPerDay)); this.loanTransactionHelper.checkAccrualTransactionForRepayment(getDateAsLocalDate(runOndate), interestPerDay, NEXT_FEE_PORTION, NEXT_PENALTY_PORTION, loanID); 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 b0a863b4c..ea9620ad2 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 @@ -721,7 +721,7 @@ public class ClientLoanIntegrationTest { LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap); HashMap summary = savingsAccountHelper.getSavingsSummary(savingsId); - Float balance = new Float(MINIMUM_OPENING_BALANCE); + Float balance = Float.valueOf(MINIMUM_OPENING_BALANCE); assertEquals("Verifying opening Balance", balance, summary.get("accountBalance")); // DISBURSE @@ -730,7 +730,7 @@ public class ClientLoanIntegrationTest { LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap); summary = savingsAccountHelper.getSavingsSummary(savingsId); - balance = new Float(MINIMUM_OPENING_BALANCE) + new Float("12000"); + balance = Float.valueOf(MINIMUM_OPENING_BALANCE) + Float.valueOf("12000"); assertEquals("Verifying opening Balance", balance, summary.get("accountBalance")); loanStatusHashMap = this.loanTransactionHelper.undoDisbursal(loanID); @@ -738,7 +738,7 @@ public class ClientLoanIntegrationTest { LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap); summary = savingsAccountHelper.getSavingsSummary(savingsId); - balance = new Float(MINIMUM_OPENING_BALANCE); + balance = Float.valueOf(MINIMUM_OPENING_BALANCE); assertEquals("Verifying opening Balance", balance, summary.get("accountBalance")); } @@ -810,7 +810,7 @@ public class ClientLoanIntegrationTest { LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap); HashMap summary = savingsAccountHelper.getSavingsSummary(savingsId); - Float balance = new Float(MINIMUM_OPENING_BALANCE); + Float balance = Float.valueOf(MINIMUM_OPENING_BALANCE); assertEquals("Verifying opening Balance", balance, summary.get("accountBalance")); // DISBURSE first Tranche @@ -819,7 +819,7 @@ public class ClientLoanIntegrationTest { LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap); summary = savingsAccountHelper.getSavingsSummary(savingsId); - balance = new Float(MINIMUM_OPENING_BALANCE) + new Float("25000"); + balance = Float.valueOf(MINIMUM_OPENING_BALANCE) + Float.valueOf("25000"); assertEquals("Verifying opening Balance", balance, summary.get("accountBalance")); // DISBURSE Second Tranche @@ -828,7 +828,7 @@ public class ClientLoanIntegrationTest { LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap); summary = savingsAccountHelper.getSavingsSummary(savingsId); - balance = new Float(MINIMUM_OPENING_BALANCE) + new Float("25000") + new Float("20000"); + balance = Float.valueOf(MINIMUM_OPENING_BALANCE) + Float.valueOf("25000") + Float.valueOf("20000"); assertEquals("Verifying opening Balance", balance, summary.get("accountBalance")); loanStatusHashMap = this.loanTransactionHelper.undoDisbursal(loanID); @@ -836,7 +836,7 @@ public class ClientLoanIntegrationTest { LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap); summary = savingsAccountHelper.getSavingsSummary(savingsId); - balance = new Float(MINIMUM_OPENING_BALANCE); + balance = Float.valueOf(MINIMUM_OPENING_BALANCE); assertEquals("Verifying opening Balance", balance, summary.get("accountBalance")); } @@ -844,37 +844,37 @@ public class ClientLoanIntegrationTest { 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(new Float(amount).compareTo(new Float(String.valueOf(chargeDetail.get("amountOrPercentage")))) == 0); - Assert.assertTrue(new Float(outstanding).compareTo(new Float(String.valueOf(chargeDetail.get("amountOutstanding")))) == 0); - Assert.assertTrue(new Float(amountPaid).compareTo(new Float(String.valueOf(chargeDetail.get("amountPaid")))) == 0); - Assert.assertTrue(new Float(amountWaived).compareTo(new Float(String.valueOf(chargeDetail.get("amountWaived")))) == 0); + Assert.assertTrue(Float.valueOf(amount).compareTo(Float.valueOf(String.valueOf(chargeDetail.get("amountOrPercentage")))) == 0); + Assert.assertTrue(Float.valueOf(outstanding).compareTo(Float.valueOf(String.valueOf(chargeDetail.get("amountOutstanding")))) == 0); + Assert.assertTrue(Float.valueOf(amountPaid).compareTo(Float.valueOf(String.valueOf(chargeDetail.get("amountPaid")))) == 0); + Assert.assertTrue(Float.valueOf(amountWaived).compareTo(Float.valueOf(String.valueOf(chargeDetail.get("amountWaived")))) == 0); } private void validateChargeExcludePrecission(Integer amountPercentage, final List loanCharges, final String amount, final String outstanding, String amountPaid, String amountWaived) { DecimalFormat twoDForm = new DecimalFormat("#"); HashMap chargeDetail = getloanCharge(amountPercentage, loanCharges); - Assert.assertTrue(new Float(twoDForm.format(new Float(amount))).compareTo(new Float(twoDForm.format(new Float(String + Assert.assertTrue(Float.valueOf(twoDForm.format(Float.valueOf(amount))).compareTo(Float.valueOf(twoDForm.format(Float.valueOf(String .valueOf(chargeDetail.get("amountOrPercentage")))))) == 0); - Assert.assertTrue(new Float(twoDForm.format(new Float(outstanding))).compareTo(new Float(twoDForm.format(new Float(String + Assert.assertTrue(Float.valueOf(twoDForm.format(Float.valueOf(outstanding))).compareTo(Float.valueOf(twoDForm.format(Float.valueOf(String .valueOf(chargeDetail.get("amountOutstanding")))))) == 0); - Assert.assertTrue(new Float(twoDForm.format(new Float(amountPaid))).compareTo(new Float(twoDForm.format(new Float(String + Assert.assertTrue(Float.valueOf(twoDForm.format(Float.valueOf(amountPaid))).compareTo(Float.valueOf(twoDForm.format(Float.valueOf(String .valueOf(chargeDetail.get("amountPaid")))))) == 0); - Assert.assertTrue(new Float(twoDForm.format(new Float(amountWaived))).compareTo(new Float(twoDForm.format(new Float(String + Assert.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(new Float(val).compareTo(new Float(val2)) == 0); + Assert.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, new Float(val).compareTo(new Float(val2)) == 0); + Assert.assertTrue(msg + "expected " + val + " but was " + val2, Float.valueOf(val).compareTo(Float.valueOf(val2)) == 0); } public void validateNumberForEqualExcludePrecission(String val, String val2) { DecimalFormat twoDForm = new DecimalFormat("#"); - Assert.assertTrue(new Float(twoDForm.format(new Float(val))).compareTo(new Float(twoDForm.format(new Float(val2)))) == 0); + Assert.assertTrue(Float.valueOf(twoDForm.format(Float.valueOf(val))).compareTo(Float.valueOf(twoDForm.format(Float.valueOf(val2)))) == 0); } private Integer createLoanProduct(final boolean multiDisburseLoan, final String accountingRule, final Account... accounts) { @@ -1063,65 +1063,65 @@ public class ClientLoanIntegrationTest { 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", new Float("2911.49"), loanSchedule.get(1).get("principalOriginalDue")); - assertEquals("Checking for Interest Due for 1st Month", new Float("240.00"), loanSchedule.get(1).get("interestOriginalDue")); + 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("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", new Float("2969.72"), loanSchedule.get(2).get("principalDue")); - assertEquals("Checking for Interest Due for 2nd Month", new Float("181.77"), loanSchedule.get(2).get("interestOriginalDue")); + 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("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", new Float("3029.11"), loanSchedule.get(3).get("principalDue")); - assertEquals("Checking for Interest Due for 3rd Month", new Float("122.38"), loanSchedule.get(3).get("interestOriginalDue")); + 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("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", new Float("3089.68"), loanSchedule.get(4).get("principalDue")); - assertEquals("Checking for Interest Due for 4th Month", new Float("61.79"), loanSchedule.get(4).get("interestOriginalDue")); + 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")); } private void verifyLoanRepaymentScheduleForEqualPrincipal(final ArrayList loanSchedule) { System.out.println("--------------------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", new Float("416700"), loanSchedule.get(1).get("principalOriginalDue")); - assertEquals("Checking for Interest Due for 1st Month", new Float("200000"), loanSchedule.get(1).get("interestOriginalDue")); + 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("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", new Float("416700"), loanSchedule.get(2).get("principalDue")); - assertEquals("Checking for Interest Due for 2nd Month", new Float("191700"), loanSchedule.get(2).get("interestOriginalDue")); + 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("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", new Float("416700"), loanSchedule.get(3).get("principalDue")); - assertEquals("Checking for Interest Due for 3rd Month", new Float("183300"), loanSchedule.get(3).get("interestOriginalDue")); + 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("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", new Float("416700"), loanSchedule.get(4).get("principalDue")); - assertEquals("Checking for Interest Due for 4th Month", new Float("175000"), loanSchedule.get(4).get("interestOriginalDue")); + 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("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", new Float("416700"), loanSchedule.get(5).get("principalDue")); - assertEquals("Checking for Interest Due for 5th Month", new Float("166700"), loanSchedule.get(5).get("interestOriginalDue")); + 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("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", new Float("416700"), loanSchedule.get(6).get("principalDue")); - assertEquals("Checking for Interest Due for 6th Month", new Float("158300"), loanSchedule.get(6).get("interestOriginalDue")); + 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("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", new Float("416700"), loanSchedule.get(10).get("principalDue")); - assertEquals("Checking for Interest Due for 10th Month", new Float("125000"), loanSchedule.get(10).get("interestOriginalDue")); + 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("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", new Float("416700"), loanSchedule.get(20).get("principalDue")); - assertEquals("Checking for Interest Due for 20th Month", new Float("41700"), loanSchedule.get(20).get("interestOriginalDue")); + 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("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", new Float("415900"), loanSchedule.get(24).get("principalDue")); - assertEquals("Checking for Interest Due for 24th Month", new Float("8300"), loanSchedule.get(24).get("interestOriginalDue")); + 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")); } @@ -1131,50 +1131,50 @@ public class ClientLoanIntegrationTest { 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", new Float("200000"), loanSchedule.get(1).get("interestOriginalDue")); + assertEquals("Checking for Interest Due for 1st Month", Float.valueOf("200000"), loanSchedule.get(1).get("interestOriginalDue")); 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", new Float("200000"), loanSchedule.get(2).get("interestOriginalDue")); + assertEquals("Checking for Interest Due for 2nd Month", Float.valueOf("200000"), loanSchedule.get(2).get("interestOriginalDue")); 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", new Float("200000"), loanSchedule.get(3).get("interestOriginalDue")); + assertEquals("Checking for Interest Due for 3rd Month", Float.valueOf("200000"), loanSchedule.get(3).get("interestOriginalDue")); 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", new Float("200000"), loanSchedule.get(4).get("interestOriginalDue")); + assertEquals("Checking for Interest Due for 4th Month", Float.valueOf("200000"), loanSchedule.get(4).get("interestOriginalDue")); assertEquals("Checking for Due Date for 5th Month", new ArrayList<>(Arrays.asList(2014, 11, 2)), loanSchedule.get(5).get("dueDate")); validateNumberForEqualWithMsg("Checking for Principal Due for 5th Month", "0", String.valueOf(loanSchedule.get(5).get("principalDue"))); - assertEquals("Checking for Interest Due for 5th Month", new Float("200000"), loanSchedule.get(5).get("interestOriginalDue")); + assertEquals("Checking for Interest Due for 5th Month", Float.valueOf("200000"), loanSchedule.get(5).get("interestOriginalDue")); 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", new Float("526300"), loanSchedule.get(6).get("principalDue")); - assertEquals("Checking for Interest Due for 6th Month", new Float("200000"), loanSchedule.get(6).get("interestOriginalDue")); + 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("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", new Float("526300"), loanSchedule.get(7).get("principalDue")); - assertEquals("Checking for Interest Due for 7th Month", new Float("189500"), loanSchedule.get(7).get("interestOriginalDue")); + 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("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", new Float("526300"), loanSchedule.get(10).get("principalDue")); - assertEquals("Checking for Interest Due for 10th Month", new Float("157900"), loanSchedule.get(10).get("interestOriginalDue")); + 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("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", new Float("526300"), loanSchedule.get(20).get("principalDue")); - assertEquals("Checking for Interest Due for 20th Month", new Float("52600"), loanSchedule.get(20).get("interestOriginalDue")); + 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("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", new Float("526600"), loanSchedule.get(24).get("principalDue")); - assertEquals("Checking for Interest Due for 24th Month", new Float("10500"), loanSchedule.get(24).get("interestOriginalDue")); + 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")); } @@ -3209,7 +3209,7 @@ public class ClientLoanIntegrationTest { addRepaymentValues(expectedvalues, todaysDate, 1, false, "2517.29", "11.62", "0.0", "0.0"); verifyLoanRepaymentSchedule(loanSchedule, expectedvalues); - Float earlyPayment = new Float("4000"); + Float earlyPayment = Float.valueOf("4000"); todaysDate = Calendar.getInstance(Utils.getTimeZoneOfTenant()); todaysDate.add(Calendar.DAY_OF_MONTH, -5); final String LOAN_SECOND_REPAYMENT_DATE = dateFormat.format(todaysDate.getTime()); @@ -3228,7 +3228,7 @@ public class ClientLoanIntegrationTest { validateNumberForEqualWithMsg("verify pre-close amount", "3551.93", prepayAmount); todaysDate = Calendar.getInstance(Utils.getTimeZoneOfTenant()); String LOAN_REPAYMENT_DATE = dateFormat.format(todaysDate.getTime()); - this.loanTransactionHelper.makeRepayment(LOAN_REPAYMENT_DATE, new Float(prepayAmount), loanID); + this.loanTransactionHelper.makeRepayment(LOAN_REPAYMENT_DATE, Float.valueOf(prepayAmount), loanID); loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID); LoanStatusChecker.verifyLoanAccountIsClosed(loanStatusHashMap); } @@ -3322,7 +3322,7 @@ public class ClientLoanIntegrationTest { validateNumberForEqualWithMsg("verify pre-close amount", preCloseAmount, prepayAmount); todaysDate = Calendar.getInstance(Utils.getTimeZoneOfTenant()); String LOAN_REPAYMENT_DATE = dateFormat.format(todaysDate.getTime()); - this.loanTransactionHelper.makeRepayment(LOAN_REPAYMENT_DATE, new Float(prepayAmount), loanID); + this.loanTransactionHelper.makeRepayment(LOAN_REPAYMENT_DATE, Float.valueOf(prepayAmount), loanID); loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID); LoanStatusChecker.verifyLoanAccountIsClosed(loanStatusHashMap); } @@ -3400,7 +3400,7 @@ public class ClientLoanIntegrationTest { addRepaymentValues(expectedvalues, todaysDate, 1, false, "2517.29", "11.62", "1.16", "0.0"); verifyLoanRepaymentSchedule(loanSchedule, expectedvalues); - Float earlyPayment = new Float("4000"); + Float earlyPayment = Float.valueOf("4000"); todaysDate = Calendar.getInstance(Utils.getTimeZoneOfTenant()); todaysDate.add(Calendar.DAY_OF_MONTH, -5); final String LOAN_SECOND_REPAYMENT_DATE = dateFormat.format(todaysDate.getTime()); @@ -3418,7 +3418,7 @@ public class ClientLoanIntegrationTest { String prepayAmount = String.valueOf(prepayDetail.get("amount")); todaysDate = Calendar.getInstance(Utils.getTimeZoneOfTenant()); String LOAN_REPAYMENT_DATE = dateFormat.format(todaysDate.getTime()); - this.loanTransactionHelper.makeRepayment(LOAN_REPAYMENT_DATE, new Float(prepayAmount), loanID); + this.loanTransactionHelper.makeRepayment(LOAN_REPAYMENT_DATE, Float.valueOf(prepayAmount), loanID); loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID); LoanStatusChecker.verifyLoanAccountIsClosed(loanStatusHashMap); } @@ -3505,7 +3505,7 @@ public class ClientLoanIntegrationTest { addRepaymentValues(expectedvalues, todaysDate, 1, false, "2517.29", "11.62", "0.0", "0.0"); verifyLoanRepaymentSchedule(loanSchedule, expectedvalues); - Float earlyPayment = new Float("4000"); + Float earlyPayment = Float.valueOf("4000"); todaysDate = Calendar.getInstance(Utils.getTimeZoneOfTenant()); todaysDate.add(Calendar.DAY_OF_MONTH, -5); final String LOAN_SECOND_REPAYMENT_DATE = dateFormat.format(todaysDate.getTime()); @@ -3530,7 +3530,7 @@ public class ClientLoanIntegrationTest { String prepayAmount = String.valueOf(prepayDetail.get("amount")); todaysDate = Calendar.getInstance(Utils.getTimeZoneOfTenant()); String LOAN_REPAYMENT_DATE = dateFormat.format(todaysDate.getTime()); - this.loanTransactionHelper.makeRepayment(LOAN_REPAYMENT_DATE, new Float(prepayAmount), loanID); + this.loanTransactionHelper.makeRepayment(LOAN_REPAYMENT_DATE, Float.valueOf(prepayAmount), loanID); loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID); LoanStatusChecker.verifyLoanAccountIsClosed(loanStatusHashMap); @@ -3628,7 +3628,7 @@ public class ClientLoanIntegrationTest { addRepaymentValues(expectedvalues, todaysDate, 1, false, "2517.29", "11.62", "0.0", "0.0"); verifyLoanRepaymentSchedule(loanSchedule, expectedvalues); - Float earlyPayment = new Float("5100"); + Float earlyPayment = Float.valueOf("5100"); repaymentDate = Calendar.getInstance(Utils.getTimeZoneOfTenant()); repaymentDate.add(Calendar.DAY_OF_MONTH, -5); final String LOAN_SECOND_REPAYMENT_DATE = dateFormat.format(repaymentDate.getTime()); @@ -3647,7 +3647,7 @@ public class ClientLoanIntegrationTest { String prepayAmount = String.valueOf(prepayDetail.get("amount")); todaysDate = Calendar.getInstance(Utils.getTimeZoneOfTenant()); String LOAN_REPAYMENT_DATE = dateFormat.format(todaysDate.getTime()); - this.loanTransactionHelper.makeRepayment(LOAN_REPAYMENT_DATE, new Float(prepayAmount), loanID); + this.loanTransactionHelper.makeRepayment(LOAN_REPAYMENT_DATE, Float.valueOf(prepayAmount), loanID); loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID); LoanStatusChecker.verifyLoanAccountIsClosed(loanStatusHashMap); @@ -3765,7 +3765,7 @@ public class ClientLoanIntegrationTest { validateNumberForEqualWithMsg("verify pre-close amount", preCloseAmount, prepayAmount); todaysDate = Calendar.getInstance(Utils.getTimeZoneOfTenant()); String LOAN_REPAYMENT_DATE = dateFormat.format(todaysDate.getTime()); - this.loanTransactionHelper.makeRepayment(LOAN_REPAYMENT_DATE, new Float(prepayAmount), loanID); + this.loanTransactionHelper.makeRepayment(LOAN_REPAYMENT_DATE, Float.valueOf(prepayAmount), loanID); loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID); LoanStatusChecker.verifyLoanAccountIsClosed(loanStatusHashMap); } @@ -3857,7 +3857,7 @@ public class ClientLoanIntegrationTest { repaymentDate.add(Calendar.DAY_OF_MONTH, -7 * 2); final String LOAN_FIRST_REPAYMENT_DATE = dateFormat.format(repaymentDate.getTime()); Float totalDueForCurrentPeriod = (Float) loanSchedule.get(1).get("totalDueForPeriod"); - totalDueForCurrentPeriod = totalDueForCurrentPeriod - new Float("252.89"); + totalDueForCurrentPeriod = totalDueForCurrentPeriod - Float.valueOf("252.89"); this.loanTransactionHelper.makeRepayment(LOAN_FIRST_REPAYMENT_DATE, totalDueForCurrentPeriod, loanID); loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID); @@ -3983,7 +3983,7 @@ public class ClientLoanIntegrationTest { String prepayAmount = String.valueOf(prepayDetail.get("amount")); todaysDate = Calendar.getInstance(Utils.getTimeZoneOfTenant()); String LOAN_REPAYMENT_DATE = dateFormat.format(todaysDate.getTime()); - this.loanTransactionHelper.makeRepayment(LOAN_REPAYMENT_DATE, new Float(prepayAmount), loanID); + this.loanTransactionHelper.makeRepayment(LOAN_REPAYMENT_DATE, Float.valueOf(prepayAmount), loanID); loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID); LoanStatusChecker.verifyLoanAccountIsClosed(loanStatusHashMap); @@ -4225,7 +4225,7 @@ public class ClientLoanIntegrationTest { validateNumberForEqualWithMsg("verify pre-close amount", preCloseAmount, prepayAmount); todaysDate = Calendar.getInstance(Utils.getTimeZoneOfTenant()); String LOAN_REPAYMENT_DATE = dateFormat.format(todaysDate.getTime()); - this.loanTransactionHelper.makeRepayment(LOAN_REPAYMENT_DATE, new Float(prepayAmount), loanID); + this.loanTransactionHelper.makeRepayment(LOAN_REPAYMENT_DATE, Float.valueOf(prepayAmount), loanID); loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID); LoanStatusChecker.verifyLoanAccountIsClosed(loanStatusHashMap); } @@ -4851,7 +4851,7 @@ public class ClientLoanIntegrationTest { this.accountTransferHelper.refundLoanByTransfer(now, clientID, loanID, clientID, savingsId, FROM_LOAN_ACCOUNT_TYPE, TO_SAVINGS_ACCOUNT_TYPE, TRANSFER_AMOUNT.toString()); - Float toSavingsBalance = new Float(MINIMUM_OPENING_BALANCE); + Float toSavingsBalance = Float.valueOf(MINIMUM_OPENING_BALANCE); HashMap toSavingsSummaryAfter = this.savingsAccountHelper.getSavingsSummary(savingsId); @@ -5103,4 +5103,4 @@ public class ClientLoanIntegrationTest { return Integer.valueOf(dayOfMonth); } -} \ No newline at end of file +} 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 3ca12bc15..e48f8645d 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 @@ -249,7 +249,7 @@ public class ClientSavingsIntegrationTest { SavingsStatusChecker.verifySavingsIsActive(savingsStatusHashMap); HashMap summary = this.savingsAccountHelper.getSavingsSummary(savingsId); - Float balance = new Float(openningBalance); + Float balance = Float.valueOf(openningBalance); Float chargeAmt = 100f; balance -= chargeAmt; assertEquals("Verifying opening Balance", balance, summary.get("accountBalance")); @@ -266,15 +266,15 @@ public class ClientSavingsIntegrationTest { Integer depositTransactionId = (Integer) this.savingsAccountHelper.depositToSavingsAccount(savingsId, DEPOSIT_AMOUNT, TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID); HashMap depositTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, depositTransactionId); - balance += new Float(DEPOSIT_AMOUNT); - assertEquals("Verifying Deposit Amount", new Float(DEPOSIT_AMOUNT), depositTransaction.get("amount")); + 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")); Integer withdrawTransactionId = (Integer) this.savingsAccountHelper.withdrawalFromSavingsAccount(savingsId, withdrawAmt, TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID); HashMap withdrawTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, withdrawTransactionId); - balance -= new Float(withdrawAmt); - assertEquals("Verifying Withdrawal Amount", new Float(withdrawAmt), withdrawTransaction.get("amount")); + balance -= Float.valueOf(withdrawAmt); + assertEquals("Verifying Withdrawal Amount", Float.valueOf(withdrawAmt), withdrawTransaction.get("amount")); assertEquals("Verifying Balance after Withdrawal", balance, withdrawTransaction.get("runningBalance")); } @@ -435,28 +435,28 @@ public class ClientSavingsIntegrationTest { SavingsStatusChecker.verifySavingsIsActive(savingsStatusHashMap); HashMap summary = this.savingsAccountHelper.getSavingsSummary(savingsId); - Float balance = new Float(MINIMUM_OPENING_BALANCE); + Float balance = Float.valueOf(MINIMUM_OPENING_BALANCE); assertEquals("Verifying opening Balance", balance, summary.get("accountBalance")); Integer depositTransactionId = (Integer) this.savingsAccountHelper.depositToSavingsAccount(savingsId, DEPOSIT_AMOUNT, SavingsAccountHelper.TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID); HashMap depositTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, depositTransactionId); - balance += new Float(DEPOSIT_AMOUNT); - assertEquals("Verifying Deposit Amount", new Float(DEPOSIT_AMOUNT), depositTransaction.get("amount")); + 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")); Integer withdrawTransactionId = (Integer) this.savingsAccountHelper.withdrawalFromSavingsAccount(savingsId, WITHDRAW_AMOUNT, SavingsAccountHelper.TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID); HashMap withdrawTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, withdrawTransactionId); - balance -= new Float(WITHDRAW_AMOUNT); - assertEquals("Verifying Withdrawal Amount", new Float(WITHDRAW_AMOUNT), withdrawTransaction.get("amount")); + 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")); Integer newWithdrawTransactionId = this.savingsAccountHelper.updateSavingsAccountTransaction(savingsId, withdrawTransactionId, WITHDRAW_AMOUNT_ADJUSTED); HashMap newWithdrawTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, newWithdrawTransactionId); - balance = balance + new Float(WITHDRAW_AMOUNT) - new Float(WITHDRAW_AMOUNT_ADJUSTED); - assertEquals("Verifying adjusted Amount", new Float(WITHDRAW_AMOUNT_ADJUSTED), newWithdrawTransaction.get("amount")); + 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")); summary = this.savingsAccountHelper.getSavingsSummary(savingsId); assertEquals("Verifying Adjusted Balance", balance, summary.get("accountBalance")); @@ -467,7 +467,7 @@ public class ClientSavingsIntegrationTest { newWithdrawTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, withdrawTransactionId); Assert.assertTrue((Boolean) newWithdrawTransaction.get("reversed")); summary = this.savingsAccountHelper.getSavingsSummary(savingsId); - balance += new Float(WITHDRAW_AMOUNT_ADJUSTED); + balance += Float.valueOf(WITHDRAW_AMOUNT_ADJUSTED); assertEquals("Verifying Balance After Undo Transaction", balance, summary.get("accountBalance")); error = (List) savingsAccountHelperValidationError.withdrawalFromSavingsAccount(savingsId, "5000", @@ -740,8 +740,8 @@ public class ClientSavingsIntegrationTest { Integer withdrawTransactionId = (Integer) this.savingsAccountHelper.withdrawalFromSavingsAccount(savingsId, WITHDRAW_AMOUNT, ACTIVATION_DATE, CommonConstants.RESPONSE_RESOURCE_ID); HashMap withdrawTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, withdrawTransactionId); - balance -= new Float(WITHDRAW_AMOUNT); - assertEquals("Verifying Withdrawal Amount", new Float(WITHDRAW_AMOUNT), withdrawTransaction.get("amount")); + 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")); /*** @@ -754,8 +754,8 @@ public class ClientSavingsIntegrationTest { Integer depositTransactionId = (Integer) this.savingsAccountHelper.depositToSavingsAccount(savingsId, DEPOSIT_AMOUNT, TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID); HashMap depositTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, depositTransactionId); - balance += new Float(DEPOSIT_AMOUNT); - assertEquals("Verifying Deposit Amount", new Float(DEPOSIT_AMOUNT), depositTransaction.get("amount")); + 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")); /*** @@ -785,8 +785,8 @@ public class ClientSavingsIntegrationTest { */ DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US)); decimalFormat.applyPattern("#.###"); - interestPosted = new Float(decimalFormat.format(interestPosted)); - actualInterestPosted = new Float(decimalFormat.format(actualInterestPosted)); + interestPosted = Float.valueOf(decimalFormat.format(interestPosted)); + actualInterestPosted = Float.valueOf(decimalFormat.format(actualInterestPosted)); assertEquals("Verifying interest posted", interestPosted, actualInterestPosted); todaysDate = Calendar.getInstance(); @@ -897,8 +897,8 @@ public class ClientSavingsIntegrationTest { WITHDRAWAL_DATE, CommonConstants.RESPONSE_RESOURCE_ID); HashMap depositTransaction = this.savingsAccountHelper .getSavingsTransaction(savingsId, depositTransactionId); - balance += new Float(DEPOSIT_AMOUNT); - assertEquals("Verifying Deposit Amount", new Float(DEPOSIT_AMOUNT), + 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")); @@ -933,8 +933,8 @@ public class ClientSavingsIntegrationTest { DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US)); decimalFormat.applyPattern("#.###"); - interestPosted = new Float(decimalFormat.format(interestPosted)); - accountDetailsPostInterestPosted = new Float( + interestPosted = Float.valueOf(decimalFormat.format(interestPosted)); + accountDetailsPostInterestPosted = Float.valueOf( decimalFormat.format(accountDetailsPostInterestPosted)); assertEquals("Verifying interest posted", interestPosted, accountDetailsPostInterestPosted); @@ -965,8 +965,8 @@ public class ClientSavingsIntegrationTest { decimalFormat = new DecimalFormat("", new DecimalFormatSymbols( Locale.US)); decimalFormat.applyPattern("#.###"); - interestPosted = new Float(decimalFormat.format(interestPosted)); - accountDetailsPostInterestPosted = new Float( + interestPosted = Float.valueOf(decimalFormat.format(interestPosted)); + accountDetailsPostInterestPosted = Float.valueOf( decimalFormat.format(accountDetailsPostInterestPosted)); assertEquals("Verifying interest posted", interestPosted, accountDetailsPostInterestPosted); @@ -1002,8 +1002,8 @@ public class ClientSavingsIntegrationTest { decimalFormat = new DecimalFormat("", new DecimalFormatSymbols( Locale.US)); decimalFormat.applyPattern("#.###"); - interestPosted = new Float(decimalFormat.format(interestPosted)); - accountDetailsPostInterestPosted = new Float( + interestPosted = Float.valueOf(decimalFormat.format(interestPosted)); + accountDetailsPostInterestPosted = Float.valueOf( decimalFormat.format(accountDetailsPostInterestPosted)); assertEquals("Verifying interest posted", interestPosted, accountDetailsPostInterestPosted); @@ -1042,8 +1042,8 @@ public class ClientSavingsIntegrationTest { decimalFormat = new DecimalFormat("", new DecimalFormatSymbols( Locale.US)); decimalFormat.applyPattern("#.###"); - interestPosted = new Float(decimalFormat.format(interestPosted)); - accountDetailsPostInterestPosted = new Float( + interestPosted = Float.valueOf(decimalFormat.format(interestPosted)); + accountDetailsPostInterestPosted = Float.valueOf( decimalFormat.format(accountDetailsPostInterestPosted)); assertEquals("Verifying interest posted", interestPosted, accountDetailsPostInterestPosted); @@ -1086,8 +1086,8 @@ public class ClientSavingsIntegrationTest { decimalFormat = new DecimalFormat("", new DecimalFormatSymbols( Locale.US)); decimalFormat.applyPattern("#.###"); - interestPosted = new Float(decimalFormat.format(interestPosted)); - accountDetailsPostInterestPosted = new Float( + interestPosted = Float.valueOf(decimalFormat.format(interestPosted)); + accountDetailsPostInterestPosted = Float.valueOf( decimalFormat.format(accountDetailsPostInterestPosted)); assertEquals("Verifying interest posted", interestPosted, accountDetailsPostInterestPosted); @@ -1123,8 +1123,8 @@ public class ClientSavingsIntegrationTest { decimalFormat = new DecimalFormat("", new DecimalFormatSymbols( Locale.US)); decimalFormat.applyPattern("#.###"); - interestPosted = new Float(decimalFormat.format(interestPosted)); - accountDetailsPostInterestPosted = new Float( + interestPosted = Float.valueOf(decimalFormat.format(interestPosted)); + accountDetailsPostInterestPosted = Float.valueOf( decimalFormat.format(accountDetailsPostInterestPosted)); assertEquals("Verifying interest posted", interestPosted, accountDetailsPostInterestPosted); @@ -1228,8 +1228,8 @@ public class ClientSavingsIntegrationTest { Integer withdrawTransactionId = (Integer) this.savingsAccountHelper.withdrawalFromSavingsAccount(savingsId, WITHDRAW_AMOUNT, ACTIVATION_DATE, CommonConstants.RESPONSE_RESOURCE_ID); HashMap withdrawTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, withdrawTransactionId); - balance -= new Float(WITHDRAW_AMOUNT); - assertEquals("Verifying Withdrawal Amount", new Float(WITHDRAW_AMOUNT), withdrawTransaction.get("amount")); + 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")); /*** @@ -1242,8 +1242,8 @@ public class ClientSavingsIntegrationTest { Integer depositTransactionId = (Integer) this.savingsAccountHelper.depositToSavingsAccount(savingsId, DEPOSIT_AMOUNT, WITHDRAWAL_DATE, CommonConstants.RESPONSE_RESOURCE_ID); HashMap depositTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, depositTransactionId); - balance += new Float(DEPOSIT_AMOUNT); - assertEquals("Verifying Deposit Amount", new Float(DEPOSIT_AMOUNT), depositTransaction.get("amount")); + 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")); /*** @@ -1276,8 +1276,8 @@ public class ClientSavingsIntegrationTest { DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US)); decimalFormat.applyPattern("#.###"); - interestPosted = new Float(decimalFormat.format(interestPosted)); - accountDetailsPostInterestPosted = new Float( + interestPosted = Float.valueOf(decimalFormat.format(interestPosted)); + accountDetailsPostInterestPosted = Float.valueOf( decimalFormat.format(accountDetailsPostInterestPosted)); assertEquals("Verifying interest posted", interestPosted, accountDetailsPostInterestPosted); @@ -1308,8 +1308,8 @@ public class ClientSavingsIntegrationTest { decimalFormat = new DecimalFormat("", new DecimalFormatSymbols( Locale.US)); decimalFormat.applyPattern("#.###"); - interestPosted = new Float(decimalFormat.format(interestPosted)); - accountDetailsPostInterestPosted = new Float( + interestPosted = Float.valueOf(decimalFormat.format(interestPosted)); + accountDetailsPostInterestPosted = Float.valueOf( decimalFormat.format(accountDetailsPostInterestPosted)); assertEquals("Verifying interest posted", interestPosted, accountDetailsPostInterestPosted); @@ -1345,8 +1345,8 @@ public class ClientSavingsIntegrationTest { decimalFormat = new DecimalFormat("", new DecimalFormatSymbols( Locale.US)); decimalFormat.applyPattern("#.###"); - interestPosted = new Float(decimalFormat.format(interestPosted)); - accountDetailsPostInterestPosted = new Float( + interestPosted = Float.valueOf(decimalFormat.format(interestPosted)); + accountDetailsPostInterestPosted = Float.valueOf( decimalFormat.format(accountDetailsPostInterestPosted)); assertEquals("Verifying interest posted", interestPosted, accountDetailsPostInterestPosted); @@ -1385,8 +1385,8 @@ public class ClientSavingsIntegrationTest { decimalFormat = new DecimalFormat("", new DecimalFormatSymbols( Locale.US)); decimalFormat.applyPattern("#.###"); - interestPosted = new Float(decimalFormat.format(interestPosted)); - accountDetailsPostInterestPosted = new Float( + interestPosted = Float.valueOf(decimalFormat.format(interestPosted)); + accountDetailsPostInterestPosted = Float.valueOf( decimalFormat.format(accountDetailsPostInterestPosted)); assertEquals("Verifying interest posted", interestPosted, accountDetailsPostInterestPosted); @@ -1429,8 +1429,8 @@ public class ClientSavingsIntegrationTest { decimalFormat = new DecimalFormat("", new DecimalFormatSymbols( Locale.US)); decimalFormat.applyPattern("#.###"); - interestPosted = new Float(decimalFormat.format(interestPosted)); - accountDetailsPostInterestPosted = new Float( + interestPosted = Float.valueOf(decimalFormat.format(interestPosted)); + accountDetailsPostInterestPosted = Float.valueOf( decimalFormat.format(accountDetailsPostInterestPosted)); assertEquals("Verifying interest posted", interestPosted, accountDetailsPostInterestPosted); @@ -1466,8 +1466,8 @@ public class ClientSavingsIntegrationTest { decimalFormat = new DecimalFormat("", new DecimalFormatSymbols( Locale.US)); decimalFormat.applyPattern("#.###"); - interestPosted = new Float(decimalFormat.format(interestPosted)); - accountDetailsPostInterestPosted = new Float( + interestPosted = Float.valueOf(decimalFormat.format(interestPosted)); + accountDetailsPostInterestPosted = Float.valueOf( decimalFormat.format(accountDetailsPostInterestPosted)); assertEquals("Verifying interest posted", interestPosted, accountDetailsPostInterestPosted); @@ -1560,8 +1560,8 @@ public class ClientSavingsIntegrationTest { Integer withdrawTransactionId = (Integer) this.savingsAccountHelper.withdrawalFromSavingsAccount(savingsId, WITHDRAW_AMOUNT, ACTIVATION_DATE, CommonConstants.RESPONSE_RESOURCE_ID); HashMap withdrawTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, withdrawTransactionId); - balance -= new Float(WITHDRAW_AMOUNT); - assertEquals("Verifying Withdrawal Amount", new Float(WITHDRAW_AMOUNT), withdrawTransaction.get("amount")); + 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")); /*** @@ -1574,8 +1574,8 @@ public class ClientSavingsIntegrationTest { Integer depositTransactionId = (Integer) this.savingsAccountHelper.depositToSavingsAccount(savingsId, DEPOSIT_AMOUNT, TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID); HashMap depositTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, depositTransactionId); - balance += new Float(DEPOSIT_AMOUNT); - assertEquals("Verifying Deposit Amount", new Float(DEPOSIT_AMOUNT), depositTransaction.get("amount")); + 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")); /*** @@ -1616,8 +1616,8 @@ public class ClientSavingsIntegrationTest { */ DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US)); decimalFormat.applyPattern("#.###"); - interestPosted = new Float(decimalFormat.format(interestPosted)); - //actualInterestPosted = new Float(decimalFormat.format(accountDetailsPostInterestPosted)); + interestPosted = Float.valueOf(decimalFormat.format(interestPosted)); + //actualInterestPosted = Float.valueOf(decimalFormat.format(accountDetailsPostInterestPosted)); assertEquals("Verifying interest posted", interestPosted, accountDetailsPostInterestPosted); System.out.println("------Post Interest As On After doing a post interest Successfully worked--------"); @@ -1737,8 +1737,8 @@ public class ClientSavingsIntegrationTest { Integer withdrawTransactionId = (Integer) this.savingsAccountHelper.withdrawalFromSavingsAccount(savingsId, WITHDRAW_AMOUNT, ACTIVATION_DATE, CommonConstants.RESPONSE_RESOURCE_ID); HashMap withdrawTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, withdrawTransactionId); - balance -= new Float(WITHDRAW_AMOUNT); - assertEquals("Verifying Withdrawal Amount", new Float(WITHDRAW_AMOUNT), withdrawTransaction.get("amount")); + 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")); /*** @@ -1751,8 +1751,8 @@ public class ClientSavingsIntegrationTest { Integer depositTransactionId = (Integer) this.savingsAccountHelper.depositToSavingsAccount(savingsId, DEPOSIT_AMOUNT, TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID); HashMap depositTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, depositTransactionId); - balance += new Float(DEPOSIT_AMOUNT); - assertEquals("Verifying Deposit Amount", new Float(DEPOSIT_AMOUNT), depositTransaction.get("amount")); + 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")); /*** @@ -1783,8 +1783,8 @@ public class ClientSavingsIntegrationTest { */ DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US)); decimalFormat.applyPattern("#.###"); - interestPosted = new Float(decimalFormat.format(interestPosted)); - actualInterestPosted = new Float(decimalFormat.format(actualInterestPosted)); + interestPosted = Float.valueOf(decimalFormat.format(interestPosted)); + actualInterestPosted = Float.valueOf(decimalFormat.format(actualInterestPosted)); assertEquals("Verifying interest posted", interestPosted, actualInterestPosted); System.out.println("------Post Interest As On Successful Worked--------"); @@ -1803,8 +1803,8 @@ public class ClientSavingsIntegrationTest { DecimalFormat decimalLastFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US)); decimalLastFormat.applyPattern("#.###"); - interestLastPosted = new Float(decimalLastFormat.format(interestLastPosted)); - actualInterestPosted = new Float(decimalFormat.format(actualInterestPosted)); + interestLastPosted = Float.valueOf(decimalLastFormat.format(interestLastPosted)); + actualInterestPosted = Float.valueOf(decimalFormat.format(actualInterestPosted)); assertEquals("Verifying interest posted", interestLastPosted, actualInterestPosted); System.out.println("------Post Interest As On Successful Worked--------"); @@ -2108,7 +2108,7 @@ public class ClientSavingsIntegrationTest { * "--------------------VERIFYING THE BALANCE, INTEREST --------------------------" * ); * - * assertEquals("Verifying Interest Calculation", new Float("238.3399"), + * assertEquals("Verifying Interest Calculation", Float.valueOf("238.3399"), * savingsInterest); } */ @@ -2142,7 +2142,7 @@ public class ClientSavingsIntegrationTest { SavingsStatusChecker.verifySavingsIsActive(savingsStatusHashMap); HashMap summary = this.savingsAccountHelper.getSavingsSummary(savingsId); - Float balance = new Float(MINIMUM_OPENING_BALANCE); + Float balance = Float.valueOf(MINIMUM_OPENING_BALANCE); savingsStatusHashMap = this.savingsAccountHelper.blockSavings(savingsId); SavingsStatusChecker.verifySavingsSubStatusblock(savingsStatusHashMap); @@ -2162,8 +2162,8 @@ public class ClientSavingsIntegrationTest { Integer depositTransactionId = (Integer) this.savingsAccountHelper.depositToSavingsAccount(savingsId, DEPOSIT_AMOUNT, SavingsAccountHelper.TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID); HashMap depositTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, depositTransactionId); - balance += new Float(DEPOSIT_AMOUNT); - assertEquals("Verifying Deposit Amount", new Float(DEPOSIT_AMOUNT), depositTransaction.get("amount")); + balance += Float.valueOf(DEPOSIT_AMOUNT); + assertEquals("Verifying Deposit Amount", Float.valueOf(DEPOSIT_AMOUNT), depositTransaction.get("amount")); savingsStatusHashMap = this.savingsAccountHelper.blockDebit(savingsId); SavingsStatusChecker.verifySavingsSubStatusIsDebitBlocked(savingsStatusHashMap); @@ -2175,16 +2175,16 @@ public class ClientSavingsIntegrationTest { depositTransactionId = (Integer) this.savingsAccountHelper.depositToSavingsAccount(savingsId, DEPOSIT_AMOUNT, SavingsAccountHelper.TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID); depositTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, depositTransactionId); - balance += new Float(DEPOSIT_AMOUNT); - assertEquals("Verifying Deposit Amount", new Float(DEPOSIT_AMOUNT), depositTransaction.get("amount")); + balance += Float.valueOf(DEPOSIT_AMOUNT); + assertEquals("Verifying Deposit Amount", Float.valueOf(DEPOSIT_AMOUNT), depositTransaction.get("amount")); savingsStatusHashMap = this.savingsAccountHelper.unblockDebit(savingsId); SavingsStatusChecker.verifySavingsSubStatusIsNone(savingsStatusHashMap); Integer withdrawTransactionId = (Integer) this.savingsAccountHelper.withdrawalFromSavingsAccount(savingsId, WITHDRAW_AMOUNT, SavingsAccountHelper.TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID); HashMap withdrawTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, withdrawTransactionId); - balance -= new Float(WITHDRAW_AMOUNT); - assertEquals("Verifying Withdrawal Amount", new Float(WITHDRAW_AMOUNT), withdrawTransaction.get("amount")); + balance -= Float.valueOf(WITHDRAW_AMOUNT); + assertEquals("Verifying Withdrawal Amount", Float.valueOf(WITHDRAW_AMOUNT), withdrawTransaction.get("amount")); savingsStatusHashMap = this.savingsAccountHelper.blockCredit(savingsId); SavingsStatusChecker.verifySavingsSubStatusIsCreditBlocked(savingsStatusHashMap); @@ -2196,16 +2196,16 @@ public class ClientSavingsIntegrationTest { withdrawTransactionId = (Integer) this.savingsAccountHelper.withdrawalFromSavingsAccount(savingsId, WITHDRAW_AMOUNT, SavingsAccountHelper.TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID); withdrawTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, withdrawTransactionId); - balance -= new Float(WITHDRAW_AMOUNT); - assertEquals("Verifying Withdrawal Amount", new Float(WITHDRAW_AMOUNT), withdrawTransaction.get("amount")); + balance -= Float.valueOf(WITHDRAW_AMOUNT); + assertEquals("Verifying Withdrawal Amount", Float.valueOf(WITHDRAW_AMOUNT), withdrawTransaction.get("amount")); savingsStatusHashMap = this.savingsAccountHelper.unblockCredit(savingsId); SavingsStatusChecker.verifySavingsSubStatusIsNone(savingsStatusHashMap); depositTransactionId = (Integer) this.savingsAccountHelper.depositToSavingsAccount(savingsId, DEPOSIT_AMOUNT, SavingsAccountHelper.TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID); depositTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, depositTransactionId); - balance += new Float(DEPOSIT_AMOUNT); - assertEquals("Verifying Deposit Amount", new Float(DEPOSIT_AMOUNT), depositTransaction.get("amount")); + balance += Float.valueOf(DEPOSIT_AMOUNT); + assertEquals("Verifying Deposit Amount", Float.valueOf(DEPOSIT_AMOUNT), depositTransaction.get("amount")); Integer holdTransactionId = (Integer) this.savingsAccountHelper.holdAmountInSavingsAccount(savingsId, String.valueOf(balance - 100), SavingsAccountHelper.TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID); @@ -2222,8 +2222,8 @@ public class ClientSavingsIntegrationTest { withdrawTransactionId = (Integer) this.savingsAccountHelper.withdrawalFromSavingsAccount(savingsId, "300", todayDate, CommonConstants.RESPONSE_RESOURCE_ID); withdrawTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, withdrawTransactionId); - balance -= new Float("300"); - assertEquals("Verifying Withdrawal Amount", new Float("300"), withdrawTransaction.get("amount")); + balance -= Float.valueOf("300"); + assertEquals("Verifying Withdrawal Amount", Float.valueOf("300"), withdrawTransaction.get("amount")); } @@ -2290,10 +2290,9 @@ public class ClientSavingsIntegrationTest { HashMap summary = this.savingsAccountHelper.getSavingsSummary(savingsId); - Float balance = new Float("-300"); + Float balance = Float.valueOf("-300"); assertEquals("Verifying opening Balance is -300", balance, summary.get("accountBalance")); } - -} \ No newline at end of file +} 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 8a0310cc2..7274538e9 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 @@ -101,10 +101,10 @@ public class ClientUndoRejectAndWithdrawalIntegrationTest { status = this.clientHelper.rejectClient(clientId); ClientStatusChecker.verifyClientRejected(status); - ArrayList clientErrorData = (ArrayList) validationErrorHelper.undoRejectedclient(clientId, + ArrayList> clientErrorData = validationErrorHelper.undoRejectedclient(clientId, CommonConstants.RESPONSE_ERROR, ClientHelper.CREATED_DATE); assertEquals("error.msg.client.reopened.date.cannot.before.client.rejected.date", - ((HashMap) clientErrorData.get(0)).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE)); + clientErrorData.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE)); status = this.clientHelper.undoReject(clientId); ClientStatusChecker.verifyClientPending(status); @@ -130,10 +130,10 @@ public class ClientUndoRejectAndWithdrawalIntegrationTest { Calendar todaysDate = Calendar.getInstance(); final String undoRejectDate = dateFormat.format(todaysDate.getTime()); - ArrayList clientErrorData = (ArrayList) validationErrorHelper.undoRejectedclient(clientId, + ArrayList> clientErrorData = validationErrorHelper.undoRejectedclient(clientId, CommonConstants.RESPONSE_ERROR, undoRejectDate); assertEquals("error.msg.client.undorejection.on.nonrejected.account", - ((HashMap) clientErrorData.get(0)).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE)); + clientErrorData.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE)); status = this.clientHelper.getClientStatus(requestSpec, responseSpec, String.valueOf(clientId)); ClientStatusChecker.verifyClientPending(status); @@ -163,10 +163,10 @@ public class ClientUndoRejectAndWithdrawalIntegrationTest { Calendar todaysDate = Calendar.getInstance(); todaysDate.add(Calendar.DATE, 1); final String undoRejectDate = dateFormat.format(todaysDate.getTime()); - ArrayList clientErrorData = (ArrayList) validationErrorHelper.undoWithdrawclient(clientId, + ArrayList> clientErrorData = validationErrorHelper.undoWithdrawclient(clientId, CommonConstants.RESPONSE_ERROR, undoRejectDate); assertEquals("validation.msg.client.reopenedDate.is.greater.than.date", - ((HashMap) clientErrorData.get(0)).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE)); + clientErrorData.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE)); status = this.clientHelper.undoReject(clientId); ClientStatusChecker.verifyClientPending(status); @@ -215,10 +215,10 @@ public class ClientUndoRejectAndWithdrawalIntegrationTest { status = this.clientHelper.withdrawClient(clientId); ClientStatusChecker.verifyClientWithdrawn(status); - ArrayList clientErrorData = (ArrayList) validationErrorHelper.undoWithdrawclient(clientId, + ArrayList> clientErrorData = validationErrorHelper.undoWithdrawclient(clientId, CommonConstants.RESPONSE_ERROR, ClientHelper.CREATED_DATE); assertEquals("error.msg.client.reopened.date.cannot.before.client.withdrawal.date", - ((HashMap) clientErrorData.get(0)).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE)); + clientErrorData.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE)); status = this.clientHelper.undoWithdrawn(clientId); ClientStatusChecker.verifyClientPending(status); @@ -243,10 +243,10 @@ public class ClientUndoRejectAndWithdrawalIntegrationTest { Calendar todaysDate = Calendar.getInstance(); final String undoWithdrawDate = dateFormat.format(todaysDate.getTime()); - ArrayList clientErrorData = (ArrayList) validationErrorHelper.undoWithdrawclient(clientId, + ArrayList> clientErrorData = validationErrorHelper.undoWithdrawclient(clientId, CommonConstants.RESPONSE_ERROR, undoWithdrawDate); assertEquals("error.msg.client.undoWithdrawal.on.nonwithdrawal.account", - ((HashMap) clientErrorData.get(0)).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE)); + clientErrorData.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE)); status = this.clientHelper.getClientStatus(requestSpec, responseSpec, String.valueOf(clientId)); ClientStatusChecker.verifyClientPending(status); @@ -276,10 +276,10 @@ public class ClientUndoRejectAndWithdrawalIntegrationTest { Calendar todaysDate = Calendar.getInstance(); todaysDate.add(Calendar.DATE, 1); final String undoWithdrawDate = dateFormat.format(todaysDate.getTime()); - ArrayList clientErrorData = (ArrayList) validationErrorHelper.undoWithdrawclient(clientId, + ArrayList> clientErrorData = validationErrorHelper.undoWithdrawclient(clientId, CommonConstants.RESPONSE_ERROR, undoWithdrawDate); assertEquals("validation.msg.client.reopenedDate.is.greater.than.date", - ((HashMap) clientErrorData.get(0)).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE)); + clientErrorData.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE)); status = this.clientHelper.undoWithdrawn(clientId); ClientStatusChecker.verifyClientPending(status); @@ -305,10 +305,10 @@ public class ClientUndoRejectAndWithdrawalIntegrationTest { ClientStatusChecker.verifyClientWithdrawn(status); status = this.clientHelper.undoWithdrawn(clientId); ClientStatusChecker.verifyClientPending(status); - ArrayList clientErrorData = (ArrayList) validationErrorHelper.activateClient(clientId, + ArrayList> clientErrorData = validationErrorHelper.activateClient(clientId, CommonConstants.RESPONSE_ERROR); assertEquals("error.msg.clients.submittedOnDate.after.reopened.date", - ((HashMap) clientErrorData.get(0)).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE)); + clientErrorData.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE)); } 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 fac570714..cf41669b6 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 @@ -26,6 +26,7 @@ import io.restassured.http.ContentType; import io.restassured.specification.RequestSpecification; import io.restassured.specification.ResponseSpecification; import java.math.BigDecimal; +import java.math.RoundingMode; import java.text.DateFormat; import java.text.DecimalFormat; import java.text.DecimalFormatSymbols; @@ -535,7 +536,7 @@ public class FixedDepositTest { final String chartToUse = "period"; final String depositAmount = "10000"; final String depositPeriod = "12"; - final Float interestRate = new Float(6.0); + final Float interestRate = Float.valueOf((float)6.0); testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate); } @@ -544,7 +545,7 @@ public class FixedDepositTest { final String chartToUse = "period"; final String depositAmount = "2000"; final String depositPeriod = "12"; - final Float interestRate = new Float(6.0); + final Float interestRate = Float.valueOf((float)6.0); testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate); } @@ -553,7 +554,7 @@ public class FixedDepositTest { final String chartToUse = "period"; final String depositAmount = "10000"; final String depositPeriod = "18"; - final Float interestRate = new Float(7.0); + final Float interestRate = Float.valueOf((float)7.0); testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate); } @@ -562,7 +563,7 @@ public class FixedDepositTest { final String chartToUse = "amount"; final String depositAmount = "10000"; final String depositPeriod = "12"; - final Float interestRate = new Float(7.0); + final Float interestRate = Float.valueOf((float)7.0); testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate); } @@ -571,7 +572,7 @@ public class FixedDepositTest { final String chartToUse = "amount"; final String depositAmount = "5000"; final String depositPeriod = "12"; - final Float interestRate = new Float(5.0); + final Float interestRate = Float.valueOf((float)5.0); testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate); } @@ -580,7 +581,7 @@ public class FixedDepositTest { final String chartToUse = "amount"; final String depositAmount = "10000"; final String depositPeriod = "26"; - final Float interestRate = new Float(7.0); + final Float interestRate = Float.valueOf((float)7.0); testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate); } @@ -589,7 +590,7 @@ public class FixedDepositTest { final String chartToUse = "period_amount"; final String depositAmount = "10000"; final String depositPeriod = "12"; - final Float interestRate = new Float(7.0); + final Float interestRate = Float.valueOf((float)7.0); testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate); } @@ -598,7 +599,7 @@ public class FixedDepositTest { final String chartToUse = "period_amount"; final String depositAmount = "5000"; final String depositPeriod = "12"; - final Float interestRate = new Float(6.0); + final Float interestRate = Float.valueOf((float)6.0); testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate); } @@ -607,7 +608,7 @@ public class FixedDepositTest { final String chartToUse = "period_amount"; final String depositAmount = "10000"; final String depositPeriod = "20"; - final Float interestRate = new Float(9.0); + final Float interestRate = Float.valueOf((float)9.0); testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate); } @@ -616,7 +617,7 @@ public class FixedDepositTest { final String chartToUse = "amount_period"; final String depositAmount = "10000"; final String depositPeriod = "12"; - final Float interestRate = new Float(8.0); + final Float interestRate = Float.valueOf((float)8.0); testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate); } @@ -625,7 +626,7 @@ public class FixedDepositTest { final String chartToUse = "amount_period"; final String depositAmount = "5000"; final String depositPeriod = "12"; - final Float interestRate = new Float(6.0); + final Float interestRate = Float.valueOf((float)6.0); testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate); } @@ -634,7 +635,7 @@ public class FixedDepositTest { final String chartToUse = "amount_period"; final String depositAmount = "10000"; final String depositPeriod = "6"; - final Float interestRate = new Float(7.0); + final Float interestRate = Float.valueOf((float)7.0); testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate); } @@ -1238,8 +1239,8 @@ public class FixedDepositTest { DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US)); decimalFormat.applyPattern("."); - principal = new Float(decimalFormat.format(principal)); - maturityAmount = new Float(decimalFormat.format(maturityAmount)); + principal = Float.valueOf(decimalFormat.format(principal)); + maturityAmount = Float.valueOf(decimalFormat.format(maturityAmount)); System.out.println(principal); Assert.assertEquals("Verifying Maturity amount for Fixed Deposit Account", principal, maturityAmount); } @@ -1311,8 +1312,8 @@ public class FixedDepositTest { interestPerDay, MONTHLY_INTERVAL, MONTHLY_INTERVAL); DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US)); decimalFormat.applyPattern("."); - principal = new Float(decimalFormat.format(principal)); - maturityAmount = new Float(decimalFormat.format(maturityAmount)); + principal = Float.valueOf(decimalFormat.format(principal)); + maturityAmount = Float.valueOf(decimalFormat.format(maturityAmount)); System.out.println(principal); Assert.assertEquals("Verifying Maturity amount for Fixed Deposit Account", principal, maturityAmount); } @@ -1414,8 +1415,8 @@ public class FixedDepositTest { DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US)); decimalFormat.applyPattern("."); - principal = new Float(decimalFormat.format(principal)); - Float maturityAmount = new Float(decimalFormat.format(fixedDepositAccountData.get("maturityAmount"))); + principal = Float.valueOf(decimalFormat.format(principal)); + Float maturityAmount = Float.valueOf(decimalFormat.format(fixedDepositAccountData.get("maturityAmount"))); Assert.assertEquals("Verifying Pre-Closure maturity amount", principal, maturityAmount); @@ -1522,8 +1523,8 @@ public class FixedDepositTest { DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US)); decimalFormat.applyPattern("."); - principal = new Float(decimalFormat.format(principal)); - Float maturityAmount = new Float(decimalFormat.format(fixedDepositAccountData.get("maturityAmount"))); + principal = Float.valueOf(decimalFormat.format(principal)); + Float maturityAmount = Float.valueOf(decimalFormat.format(fixedDepositAccountData.get("maturityAmount"))); Assert.assertEquals("Verifying Pre-Closure maturity amount", principal, maturityAmount); @@ -1634,8 +1635,8 @@ public class FixedDepositTest { fixedDepositAccountId); DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US)); decimalFormat.applyPattern("."); - Float expectedPrematureAmount = new Float(decimalFormat.format(principal)); - Float maturityAmount = new Float(decimalFormat.format(fixedDepositAccountData.get("maturityAmount"))); + Float expectedPrematureAmount = Float.valueOf(decimalFormat.format(principal)); + Float maturityAmount = Float.valueOf(decimalFormat.format(fixedDepositAccountData.get("maturityAmount"))); Assert.assertEquals("Verifying Pre-Closure maturity amount", expectedPrematureAmount, maturityAmount); @@ -1750,8 +1751,8 @@ public class FixedDepositTest { fixedDepositAccountId); DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US)); decimalFormat.applyPattern("."); - Float expectedPrematureAmount = new Float(decimalFormat.format(principal)); - Float maturityAmount = new Float(decimalFormat.format(fixedDepositAccountData.get("maturityAmount"))); + Float expectedPrematureAmount = Float.valueOf(decimalFormat.format(principal)); + Float maturityAmount = Float.valueOf(decimalFormat.format(fixedDepositAccountData.get("maturityAmount"))); Assert.assertEquals("Verifying Pre-Closure maturity amount", expectedPrematureAmount, maturityAmount); @@ -1826,8 +1827,8 @@ public class FixedDepositTest { DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US)); decimalFormat.applyPattern("."); - principal = new Float(decimalFormat.format(principal)); - maturityAmount = new Float(decimalFormat.format(maturityAmount)); + principal = Float.valueOf(decimalFormat.format(principal)); + maturityAmount = Float.valueOf(decimalFormat.format(maturityAmount)); System.out.println(principal); Assert.assertEquals("Verifying Maturity amount for Fixed Deposit Account", principal, maturityAmount); @@ -1901,8 +1902,8 @@ public class FixedDepositTest { principal = this.fixedDepositAccountHelper.getPrincipalAfterCompoundingInterest(todaysDate, principal, depositPeriod, interestPerDay, DAILY_COMPOUNDING_INTERVAL, MONTHLY_INTERVAL); - principal = new BigDecimal(principal).setScale(0, BigDecimal.ROUND_FLOOR).floatValue(); - maturityAmount = new BigDecimal(maturityAmount).setScale(0, BigDecimal.ROUND_FLOOR).floatValue(); + principal = new BigDecimal(principal).setScale(0, RoundingMode.FLOOR).floatValue(); + maturityAmount = new BigDecimal(maturityAmount).setScale(0, RoundingMode.FLOOR).floatValue(); System.out.println(principal); Assert.assertEquals("Verifying Maturity amount for Fixed Deposit Account", principal, maturityAmount); @@ -1985,8 +1986,8 @@ public class FixedDepositTest { fixedDepositAccountId); DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US)); decimalFormat.applyPattern("."); - Float expectedPrematureAmount = new Float(decimalFormat.format(principal)); - Float maturityAmount = new Float(decimalFormat.format(fixedDepositAccountData.get("maturityAmount"))); + Float expectedPrematureAmount = Float.valueOf(decimalFormat.format(principal)); + Float maturityAmount = Float.valueOf(decimalFormat.format(fixedDepositAccountData.get("maturityAmount"))); Assert.assertEquals("Verifying Maturity amount", expectedPrematureAmount, maturityAmount); @@ -2069,8 +2070,8 @@ public class FixedDepositTest { fixedDepositAccountId); DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US)); decimalFormat.applyPattern("."); - Float expectedPrematureAmount = new Float(decimalFormat.format(principal)); - Float maturityAmount = new Float(decimalFormat.format(fixedDepositAccountData.get("maturityAmount"))); + Float expectedPrematureAmount = Float.valueOf(decimalFormat.format(principal)); + Float maturityAmount = Float.valueOf(decimalFormat.format(fixedDepositAccountData.get("maturityAmount"))); Assert.assertEquals("Verifying Maturity amount", expectedPrematureAmount, maturityAmount); @@ -2151,8 +2152,8 @@ public class FixedDepositTest { fixedDepositAccountId); DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US)); decimalFormat.applyPattern("."); - Float expectedPrematureAmount = new Float(decimalFormat.format(principal)); - Float maturityAmount = new Float(decimalFormat.format(fixedDepositAccountData.get("maturityAmount"))); + Float expectedPrematureAmount = Float.valueOf(decimalFormat.format(principal)); + Float maturityAmount = Float.valueOf(decimalFormat.format(fixedDepositAccountData.get("maturityAmount"))); Assert.assertEquals("Verifying Pre-Closure maturity amount", expectedPrematureAmount, maturityAmount); @@ -2233,8 +2234,8 @@ public class FixedDepositTest { fixedDepositAccountId); DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US)); decimalFormat.applyPattern("."); - Float expectedPrematureAmount = new Float(decimalFormat.format(principal)); - Float maturityAmount = new Float(decimalFormat.format(fixedDepositAccountData.get("maturityAmount"))); + Float expectedPrematureAmount = Float.valueOf(decimalFormat.format(principal)); + Float maturityAmount = Float.valueOf(decimalFormat.format(fixedDepositAccountData.get("maturityAmount"))); Assert.assertEquals("Verifying Pre-Closure maturity amount", expectedPrematureAmount, maturityAmount); @@ -2315,8 +2316,8 @@ public class FixedDepositTest { fixedDepositAccountId); DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US)); decimalFormat.applyPattern("."); - Float expectedPrematureAmount = new Float(decimalFormat.format(principal)); - Float maturityAmount = new Float(decimalFormat.format(fixedDepositAccountData.get("maturityAmount"))); + Float expectedPrematureAmount = Float.valueOf(decimalFormat.format(principal)); + Float maturityAmount = Float.valueOf(decimalFormat.format(fixedDepositAccountData.get("maturityAmount"))); Assert.assertEquals("Verifying Pre-Closure maturity amount", expectedPrematureAmount, maturityAmount); } @@ -2396,8 +2397,8 @@ public class FixedDepositTest { fixedDepositAccountId); DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US)); decimalFormat.applyPattern("."); - Float expectedPrematureAmount = new Float(decimalFormat.format(principal)); - Float maturityAmount = new Float(decimalFormat.format(fixedDepositAccountData.get("maturityAmount"))); + Float expectedPrematureAmount = Float.valueOf(decimalFormat.format(principal)); + Float maturityAmount = Float.valueOf(decimalFormat.format(fixedDepositAccountData.get("maturityAmount"))); Assert.assertEquals("Verifying Pre-Closure maturity amount", expectedPrematureAmount, maturityAmount); } 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 aea43dd7f..7281b2d59 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 @@ -18,11 +18,13 @@ */ 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 com.google.gson.Gson; +import com.google.gson.reflect.TypeToken; import io.restassured.builder.RequestSpecBuilder; import io.restassured.builder.ResponseSpecBuilder; import io.restassured.http.ContentType; @@ -191,15 +193,15 @@ public class FundsIntegrationTest { List fhList = FundsResourceHandler.retrieveAllFunds(this.requestSpec, this.statusOkResponseSpec); Assert.assertNotNull(fhList); - Assert.assertThat(fhList.size(), greaterThanOrEqualTo(1)); - Assert.assertThat(fhList, hasItem(fh)); + assertThat(fhList.size(), greaterThanOrEqualTo(1)); + assertThat(fhList, hasItem(fh)); } @Test public void testRetrieveUnknownFund() { ResponseSpecification responseSpec = new ResponseSpecBuilder().expectStatusCode(404).build(); String jsonData = FundsResourceHandler.retrieveFund(Long.MAX_VALUE, this.requestSpec, responseSpec); - HashMap map = new Gson().fromJson(jsonData, HashMap.class); + HashMap map = new Gson().fromJson(jsonData, new TypeToken>(){}.getType()); assertEquals(map.get("userMessageGlobalisationCode"), "error.msg.resource.not.found"); } 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 9bab83f9a..3a829a7eb 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 @@ -249,22 +249,22 @@ public class GroupLoanIntegrationTest { 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", new Float("2911.49"), loanSchedule.get(1).get("principalOriginalDue")); - assertEquals("Checking for Interest Due for 1st Month", new Float("240.00"), loanSchedule.get(1).get("interestOriginalDue")); + 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("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", new Float("2969.72"), loanSchedule.get(2).get("principalDue")); - assertEquals("Checking for Interest Due for 2nd Month", new Float("181.77"), loanSchedule.get(2).get("interestOriginalDue")); + 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("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", new Float("3029.11"), loanSchedule.get(3).get("principalDue")); - assertEquals("Checking for Interest Due for 3rd Month", new Float("122.38"), loanSchedule.get(3).get("interestOriginalDue")); + 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("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", new Float("3089.68"), loanSchedule.get(4).get("principalDue")); - assertEquals("Checking for Interest Due for 4th Month", new Float("61.79"), loanSchedule.get(4).get("interestOriginalDue")); + 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")); } -} \ No newline at end of file +} 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 7905bad81..1f7167dba 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 @@ -574,28 +574,28 @@ public class GroupSavingsIntegrationTest { SavingsStatusChecker.verifySavingsIsActive(savingsStatusHashMap); HashMap summary = this.savingsAccountHelper.getSavingsSummary(savingsId); - Float balance = new Float(MINIMUM_OPENING_BALANCE); + Float balance = Float.valueOf(MINIMUM_OPENING_BALANCE); assertEquals("Verifying opening Balance", balance, summary.get("accountBalance")); Integer depositTransactionId = (Integer) this.savingsAccountHelper.depositToSavingsAccount(savingsId, DEPOSIT_AMOUNT, SavingsAccountHelper.TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID); HashMap depositTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, depositTransactionId); - balance += new Float(DEPOSIT_AMOUNT); - assertEquals("Verifying Deposit Amount", new Float(DEPOSIT_AMOUNT), depositTransaction.get("amount")); + 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")); Integer withdrawTransactionId = (Integer) this.savingsAccountHelper.withdrawalFromSavingsAccount(savingsId, WITHDRAW_AMOUNT, SavingsAccountHelper.TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID); HashMap withdrawTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, withdrawTransactionId); - balance -= new Float(WITHDRAW_AMOUNT); - assertEquals("Verifying Withdrawal Amount", new Float(WITHDRAW_AMOUNT), withdrawTransaction.get("amount")); + 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")); Integer newWithdrawTransactionId = this.savingsAccountHelper.updateSavingsAccountTransaction(savingsId, withdrawTransactionId, WITHDRAW_AMOUNT_ADJUSTED); HashMap newWithdrawTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, newWithdrawTransactionId); - balance = balance + new Float(WITHDRAW_AMOUNT) - new Float(WITHDRAW_AMOUNT_ADJUSTED); - assertEquals("Verifying adjusted Amount", new Float(WITHDRAW_AMOUNT_ADJUSTED), newWithdrawTransaction.get("amount")); + 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")); summary = this.savingsAccountHelper.getSavingsSummary(savingsId); assertEquals("Verifying Adjusted Balance", balance, summary.get("accountBalance")); @@ -606,7 +606,7 @@ public class GroupSavingsIntegrationTest { newWithdrawTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, withdrawTransactionId); Assert.assertTrue((Boolean) newWithdrawTransaction.get("reversed")); summary = this.savingsAccountHelper.getSavingsSummary(savingsId); - balance += new Float(WITHDRAW_AMOUNT_ADJUSTED); + balance += Float.valueOf(WITHDRAW_AMOUNT_ADJUSTED); assertEquals("Verifying Balance After Undo Transaction", balance, summary.get("accountBalance")); error = (List) savingsAccountHelperValidationError.withdrawalFromSavingsAccount(savingsId, "5000", 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 090266938..c5b936bd4 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 @@ -210,20 +210,20 @@ public class LoanDisbursementDetailsIntegrationTest { assertEquals(period.get("dueDate").toString(), expectedRepaymentSchedule.getDueDate()); assertEquals(period.get("principalLoanBalanceOutstanding"), expectedRepaymentSchedule.getPrincipalLoanBalanceOutstanding()); System.out.println(period.get("totalOriginalDueForPeriod").toString()); - assertEquals(new Float(period.get("totalOriginalDueForPeriod").toString()), expectedRepaymentSchedule + assertEquals(Float.valueOf(period.get("totalOriginalDueForPeriod").toString()), expectedRepaymentSchedule .getTotalOriginalDueForPeriod().floatValue(), 0.0f); - assertEquals(new Float(period.get("totalOutstandingForPeriod").toString()).floatValue(), + assertEquals(Float.valueOf(period.get("totalOutstandingForPeriod").toString()).floatValue(), expectedRepaymentSchedule.getTotalOutstandingForPeriod(), 0.0f); if (position != 0 && position != 3) { - assertEquals(new Float(period.get("interestOutstanding").toString()).floatValue(), + assertEquals(Float.valueOf(period.get("interestOutstanding").toString()).floatValue(), expectedRepaymentSchedule.getInterestOutstanding(), 0.0f); - assertEquals(new Float(period.get("principalOutstanding").toString()).floatValue(), + assertEquals(Float.valueOf(period.get("principalOutstanding").toString()).floatValue(), expectedRepaymentSchedule.getPrincipalOutstanding(), 0.0f); - assertEquals(new Float(period.get("principalDue").toString()).floatValue(), expectedRepaymentSchedule.getPrincipalDue(), 0.0f); - assertEquals(new Float(period.get("principalOriginalDue").toString()).floatValue(), + assertEquals(Float.valueOf(period.get("principalDue").toString()).floatValue(), expectedRepaymentSchedule.getPrincipalDue(), 0.0f); + assertEquals(Float.valueOf(period.get("principalOriginalDue").toString()).floatValue(), expectedRepaymentSchedule.getPrincipalOriginalDue(), 0.0f); assertEquals(period.get("fromDate").toString(), expectedRepaymentSchedule.getFromDate()); } 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 3c8cfa100..dd9447751 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 @@ -160,21 +160,21 @@ public class LoanWithWaiveInterestAndWriteOffIntegrationTest { HashMap toLoanSummaryAfter = this.loanTransactionHelper.getLoanSummary(requestSpec, responseSpec, loanID); Assert.assertTrue("Checking for Principal paid ", - new Float("500.0").compareTo(new Float(String.valueOf(toLoanSummaryAfter.get("principalPaid")))) == 0); + Float.valueOf("500.0").compareTo(Float.valueOf(String.valueOf(toLoanSummaryAfter.get("principalPaid")))) == 0); Assert.assertTrue("Checking for interestPaid paid ", - new Float("180.0").compareTo(new Float(String.valueOf(toLoanSummaryAfter.get("interestPaid")))) == 0); + Float.valueOf("180.0").compareTo(Float.valueOf(String.valueOf(toLoanSummaryAfter.get("interestPaid")))) == 0); Assert.assertTrue("Checking for total paid ", - new Float("680.0").compareTo(new Float(String.valueOf(toLoanSummaryAfter.get("totalRepayment")))) == 0); + Float.valueOf("680.0").compareTo(Float.valueOf(String.valueOf(toLoanSummaryAfter.get("totalRepayment")))) == 0); // 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 ", - new Float("4000.0").compareTo(new Float(String.valueOf(toLoanSummaryAfter.get("principalWrittenOff")))) == 0); + Float.valueOf("4000.0").compareTo(Float.valueOf(String.valueOf(toLoanSummaryAfter.get("principalWrittenOff")))) == 0); Assert.assertTrue("Checking for interestPaid written off ", - new Float("1440.0").compareTo(new Float(String.valueOf(toLoanSummaryAfter.get("interestWrittenOff")))) == 0); + Float.valueOf("1440.0").compareTo(Float.valueOf(String.valueOf(toLoanSummaryAfter.get("interestWrittenOff")))) == 0); Assert.assertTrue("Checking for total written off ", - new Float("5440.0").compareTo(new Float(String.valueOf(toLoanSummaryAfter.get("totalWrittenOff")))) == 0); + Float.valueOf("5440.0").compareTo(Float.valueOf(String.valueOf(toLoanSummaryAfter.get("totalWrittenOff")))) == 0); } 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 22096e552..1162040ec 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 @@ -1429,8 +1429,8 @@ public class RecurringDepositTest { DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US)); decimalFormat.applyPattern("."); - principal = new Float(decimalFormat.format(principal)); - maturityAmount = new Float(decimalFormat.format(maturityAmount)); + principal = Float.valueOf(decimalFormat.format(principal)); + maturityAmount = Float.valueOf(decimalFormat.format(maturityAmount)); System.out.println(principal); Assert.assertEquals("Verifying Maturity amount for Recurring Deposit Account", principal, maturityAmount); } @@ -1514,8 +1514,8 @@ public class RecurringDepositTest { DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US)); decimalFormat.applyPattern("."); - principal = new Float(decimalFormat.format(principal)); - maturityAmount = new Float(decimalFormat.format(maturityAmount)); + principal = Float.valueOf(decimalFormat.format(principal)); + maturityAmount = Float.valueOf(decimalFormat.format(maturityAmount)); System.out.println(principal); Assert.assertEquals("Verifying Maturity amount for Recurring Deposit Account", principal, maturityAmount); } @@ -1596,10 +1596,10 @@ public class RecurringDepositTest { Integer currentDate = Integer.valueOf(currentDateFormat.format(todaysDate.getTime())); Integer daysInMonth = todaysDate.getActualMaximum(Calendar.DATE); daysInMonth = (daysInMonth - currentDate) + 1; - Float interestToBePosted = new Float(decimalFormat.format(interestPerDay * principal * daysInMonth)); + Float interestToBePosted = Float.valueOf(decimalFormat.format(interestPerDay * principal * daysInMonth)); principal += interestToBePosted; - Float expectedBalanceAfter = new Float(decimalFormat.format(principal)); + Float expectedBalanceAfter = Float.valueOf(decimalFormat.format(principal)); System.out.println(expectedBalanceAfter); Integer transactionIdForPostInterest = this.recurringDepositAccountHelper @@ -1607,8 +1607,8 @@ public class RecurringDepositTest { Assert.assertNotNull(transactionIdForPostInterest); HashMap recurringDepositAccountSummary = this.recurringDepositAccountHelper.getRecurringDepositSummary(recurringDepositAccountId); - Float interestAmountPosted = new Float(decimalFormat.format(recurringDepositAccountSummary.get("totalInterestPosted"))); - Float principalAfter = new Float(decimalFormat.format(recurringDepositAccountSummary.get("accountBalance"))); + Float interestAmountPosted = Float.valueOf(decimalFormat.format(recurringDepositAccountSummary.get("totalInterestPosted"))); + Float principalAfter = Float.valueOf(decimalFormat.format(recurringDepositAccountSummary.get("accountBalance"))); Assert.assertEquals("Verifying Amount of Interest Posted to Recurring Deposit Account", interestToBePosted, interestAmountPosted); Assert.assertEquals("Verifying Principal Amount after Interest Posting", expectedBalanceAfter, principalAfter); @@ -1735,8 +1735,8 @@ public class RecurringDepositTest { DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US)); decimalFormat.applyPattern("."); - principal = new Float(decimalFormat.format(principal)); - Float maturityAmount = new Float(decimalFormat.format(recurringDepositAccountData.get("maturityAmount"))); + principal = Float.valueOf(decimalFormat.format(principal)); + Float maturityAmount = Float.valueOf(decimalFormat.format(recurringDepositAccountData.get("maturityAmount"))); Assert.assertEquals("Verifying Pre-Closure maturity amount", principal, maturityAmount); @@ -1867,8 +1867,8 @@ public class RecurringDepositTest { DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US)); decimalFormat.applyPattern("."); - principal = new Float(decimalFormat.format(principal)); - Float maturityAmount = new Float(decimalFormat.format(recurringDepositAccountData.get("maturityAmount"))); + principal = Float.valueOf(decimalFormat.format(principal)); + Float maturityAmount = Float.valueOf(decimalFormat.format(recurringDepositAccountData.get("maturityAmount"))); Assert.assertEquals("Verifying Pre-Closure maturity amount", principal, maturityAmount); @@ -2007,8 +2007,8 @@ public class RecurringDepositTest { DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US)); decimalFormat.applyPattern("."); - principal = new Float(decimalFormat.format(principal)); - Float maturityAmount = new Float(decimalFormat.format(recurringDepositAccountData.get("maturityAmount"))); + principal = Float.valueOf(decimalFormat.format(principal)); + Float maturityAmount = Float.valueOf(decimalFormat.format(recurringDepositAccountData.get("maturityAmount"))); Assert.assertEquals("Verifying Pre-Closure maturity amount", principal, maturityAmount); @@ -2152,8 +2152,8 @@ public class RecurringDepositTest { DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US)); decimalFormat.applyPattern("."); - principal = new Float(decimalFormat.format(principal)); - Float maturityAmount = new Float(decimalFormat.format(recurringDepositAccountData.get("maturityAmount"))); + principal = Float.valueOf(decimalFormat.format(principal)); + Float maturityAmount = Float.valueOf(decimalFormat.format(recurringDepositAccountData.get("maturityAmount"))); Assert.assertEquals("Verifying Pre-Closure maturity amount", principal, maturityAmount); @@ -2236,8 +2236,8 @@ public class RecurringDepositTest { DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US)); decimalFormat.applyPattern("."); - principal = new Float(decimalFormat.format(principal)); - maturityAmount = new Float(decimalFormat.format(maturityAmount)); + principal = Float.valueOf(decimalFormat.format(principal)); + maturityAmount = Float.valueOf(decimalFormat.format(maturityAmount)); System.out.println(principal); Assert.assertEquals("Verifying Maturity amount for Recurring Deposit Account", principal, maturityAmount); @@ -2321,8 +2321,8 @@ public class RecurringDepositTest { DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US)); decimalFormat.applyPattern("."); - principal = new Float(decimalFormat.format(principal)); - maturityAmount = new Float(decimalFormat.format(maturityAmount)); + principal = Float.valueOf(decimalFormat.format(principal)); + maturityAmount = Float.valueOf(decimalFormat.format(maturityAmount)); System.out.println(principal); Assert.assertEquals("Verifying Maturity amount for Recurring Deposit Account", principal, maturityAmount); @@ -2412,8 +2412,8 @@ public class RecurringDepositTest { this.responseSpec, recurringDepositAccountId); DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US)); decimalFormat.applyPattern("."); - Float expectedPrematureAmount = new Float(decimalFormat.format(principal)); - Float maturityAmount = new Float(decimalFormat.format(recurringDepositAccountData.get("maturityAmount"))); + Float expectedPrematureAmount = Float.valueOf(decimalFormat.format(principal)); + Float maturityAmount = Float.valueOf(decimalFormat.format(recurringDepositAccountData.get("maturityAmount"))); Assert.assertEquals("Verifying Pre-Closure maturity amount", expectedPrematureAmount, maturityAmount); @@ -2503,8 +2503,8 @@ public class RecurringDepositTest { this.responseSpec, recurringDepositAccountId); DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US)); decimalFormat.applyPattern("."); - Float expectedPrematureAmount = new Float(decimalFormat.format(principal)); - Float maturityAmount = new Float(decimalFormat.format(recurringDepositAccountData.get("maturityAmount"))); + Float expectedPrematureAmount = Float.valueOf(decimalFormat.format(principal)); + Float maturityAmount = Float.valueOf(decimalFormat.format(recurringDepositAccountData.get("maturityAmount"))); Assert.assertEquals("Verifying Pre-Closure maturity amount", expectedPrematureAmount, maturityAmount); @@ -2594,8 +2594,8 @@ public class RecurringDepositTest { this.responseSpec, recurringDepositAccountId); DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US)); decimalFormat.applyPattern("."); - Float expectedPrematureAmount = new Float(decimalFormat.format(principal)); - Float maturityAmount = new Float(decimalFormat.format(recurringDepositAccountData.get("maturityAmount"))); + Float expectedPrematureAmount = Float.valueOf(decimalFormat.format(principal)); + Float maturityAmount = Float.valueOf(decimalFormat.format(recurringDepositAccountData.get("maturityAmount"))); Assert.assertEquals("Verifying Maturity amount", expectedPrematureAmount, maturityAmount); @@ -2685,8 +2685,8 @@ public class RecurringDepositTest { this.responseSpec, recurringDepositAccountId); DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US)); decimalFormat.applyPattern("."); - Float expectedPrematureAmount = new Float(decimalFormat.format(principal)); - Float maturityAmount = new Float(decimalFormat.format(recurringDepositAccountData.get("maturityAmount"))); + Float expectedPrematureAmount = Float.valueOf(decimalFormat.format(principal)); + Float maturityAmount = Float.valueOf(decimalFormat.format(recurringDepositAccountData.get("maturityAmount"))); Assert.assertEquals("Verifying Maturity amount", expectedPrematureAmount, maturityAmount); @@ -2776,8 +2776,8 @@ public class RecurringDepositTest { this.responseSpec, recurringDepositAccountId); DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US)); decimalFormat.applyPattern("."); - Float expectedPrematureAmount = new Float(decimalFormat.format(principal)); - Float maturityAmount = new Float(decimalFormat.format(recurringDepositAccountData.get("maturityAmount"))); + Float expectedPrematureAmount = Float.valueOf(decimalFormat.format(principal)); + Float maturityAmount = Float.valueOf(decimalFormat.format(recurringDepositAccountData.get("maturityAmount"))); Assert.assertEquals("Verifying Pre-Closure maturity amount", expectedPrematureAmount, maturityAmount); @@ -2867,8 +2867,8 @@ public class RecurringDepositTest { this.responseSpec, recurringDepositAccountId); DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US)); decimalFormat.applyPattern("."); - Float expectedPrematureAmount = new Float(decimalFormat.format(principal)); - Float maturityAmount = new Float(decimalFormat.format(recurringDepositAccountData.get("maturityAmount"))); + Float expectedPrematureAmount = Float.valueOf(decimalFormat.format(principal)); + Float maturityAmount = Float.valueOf(decimalFormat.format(recurringDepositAccountData.get("maturityAmount"))); Assert.assertEquals("Verifying Pre-Closure maturity amount", expectedPrematureAmount, maturityAmount); @@ -2879,7 +2879,7 @@ public class RecurringDepositTest { final String chartToUse = "period"; final String depositAmount = "1000"; final String depositPeriod = "12"; - final Float interestRate = new Float(6.0); + final Float interestRate = Float.valueOf((float)6.0); testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate); } @@ -2888,7 +2888,7 @@ public class RecurringDepositTest { final String chartToUse = "period"; final String depositAmount = "10000"; final String depositPeriod = "12"; - final Float interestRate = new Float(6.0); + final Float interestRate = Float.valueOf((float)6.0); testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate); } @@ -2897,7 +2897,7 @@ public class RecurringDepositTest { final String chartToUse = "period"; final String depositAmount = "1000"; final String depositPeriod = "18"; - final Float interestRate = new Float(7.0); + final Float interestRate = Float.valueOf((float)7.0); testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate); } @@ -2906,7 +2906,7 @@ public class RecurringDepositTest { final String chartToUse = "amount"; final String depositAmount = "1000"; final String depositPeriod = "12"; - final Float interestRate = new Float(8.0); + final Float interestRate = Float.valueOf((float)8.0); testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate); } @@ -2915,7 +2915,7 @@ public class RecurringDepositTest { final String chartToUse = "amount"; final String depositAmount = "500"; final String depositPeriod = "12"; - final Float interestRate = new Float(7.0); + final Float interestRate = Float.valueOf((float)7.0); testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate); } @@ -2924,7 +2924,7 @@ public class RecurringDepositTest { final String chartToUse = "amount"; final String depositAmount = "500"; final String depositPeriod = "10"; - final Float interestRate = new Float(5.0); + final Float interestRate = Float.valueOf((float)5.0); testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate); } @@ -2933,7 +2933,7 @@ public class RecurringDepositTest { final String chartToUse = "period_amount"; final String depositAmount = "1000"; final String depositPeriod = "12"; - final Float interestRate = new Float(7.0); + final Float interestRate = Float.valueOf((float)7.0); testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate); } @@ -2942,7 +2942,7 @@ public class RecurringDepositTest { final String chartToUse = "period_amount"; final String depositAmount = "400"; final String depositPeriod = "12"; - final Float interestRate = new Float(6.0); + final Float interestRate = Float.valueOf((float)6.0); testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate); } @@ -2951,7 +2951,7 @@ public class RecurringDepositTest { final String chartToUse = "period_amount"; final String depositAmount = "1000"; final String depositPeriod = "14"; - final Float interestRate = new Float(8.0); + final Float interestRate = Float.valueOf((float)8.0); testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate); } @@ -2960,7 +2960,7 @@ public class RecurringDepositTest { final String chartToUse = "amount_period"; final String depositAmount = "1000"; final String depositPeriod = "12"; - final Float interestRate = new Float(8.0); + final Float interestRate = Float.valueOf((float)8.0); testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate); } @@ -2969,7 +2969,7 @@ public class RecurringDepositTest { final String chartToUse = "amount_period"; final String depositAmount = "100"; final String depositPeriod = "12"; - final Float interestRate = new Float(6.0); + final Float interestRate = Float.valueOf((float)6.0); testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate); } @@ -2978,7 +2978,7 @@ public class RecurringDepositTest { final String chartToUse = "amount_period"; final String depositAmount = "1000"; final String depositPeriod = "6"; - final Float interestRate = new Float(7.0); + final Float interestRate = Float.valueOf((float)7.0); testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate); } 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 231fea693..8129bff1e 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 @@ -79,7 +79,7 @@ public class SchedulerJobsTestResults { public static final String ACCOUNT_TYPE_INDIVIDUAL = "INDIVIDUAL"; public static final String MINIMUM_OPENING_BALANCE = "1000"; - Float SP_BALANCE = new Float(MINIMUM_OPENING_BALANCE); + Float SP_BALANCE = Float.valueOf(MINIMUM_OPENING_BALANCE); private static ResponseSpecification responseSpec; private static RequestSpecification requestSpec; @@ -864,7 +864,7 @@ public class SchedulerJobsTestResults { Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec); Assert.assertNotNull(clientId); - Float balance = new Float(MINIMUM_OPENING_BALANCE) + new Float(FixedDepositAccountHelper.depositAmount); + Float balance = Float.valueOf(MINIMUM_OPENING_BALANCE) + Float.valueOf(FixedDepositAccountHelper.depositAmount); final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, String.valueOf(balance)); Assert.assertNotNull(savingsProductID); @@ -900,22 +900,22 @@ public class SchedulerJobsTestResults { fixedDepositAccountStatusHashMap = fixedDepositAccountHelper.activateFixedDeposit(fixedDepositAccountId, ACTIVATION_DATE); FixedDepositAccountStatusChecker.verifyFixedDepositIsActive(fixedDepositAccountStatusHashMap); summary = savingsAccountHelper.getSavingsSummary(savingsId); - balance = new Float(MINIMUM_OPENING_BALANCE); + balance = Float.valueOf(MINIMUM_OPENING_BALANCE); assertEquals("Verifying Balance", balance, summary.get("accountBalance")); fixedDepositAccountHelper.postInterestForFixedDeposit(fixedDepositAccountId); HashMap fixedDepositSummary = savingsAccountHelper.getSavingsSummary(fixedDepositAccountId); - Float interestPosted = (Float) fixedDepositSummary.get("accountBalance") - new Float(FixedDepositAccountHelper.depositAmount); + Float interestPosted = (Float) fixedDepositSummary.get("accountBalance") - Float.valueOf(FixedDepositAccountHelper.depositAmount); String JobName = "Transfer Interest To Savings"; this.schedulerJobHelper.executeJob(JobName); fixedDepositSummary = savingsAccountHelper.getSavingsSummary(fixedDepositAccountId); - assertEquals("Verifying opening Balance", new Float(FixedDepositAccountHelper.depositAmount), + assertEquals("Verifying opening Balance", Float.valueOf(FixedDepositAccountHelper.depositAmount), fixedDepositSummary.get("accountBalance")); summary = savingsAccountHelper.getSavingsSummary(savingsId); - balance = new Float(MINIMUM_OPENING_BALANCE) + interestPosted; + balance = Float.valueOf(MINIMUM_OPENING_BALANCE) + interestPosted; validateNumberForEqualExcludePrecission(String.valueOf(balance), String.valueOf(summary.get("accountBalance"))); } @@ -998,6 +998,6 @@ public class SchedulerJobsTestResults { private void validateNumberForEqualExcludePrecission(String val, String val2) { DecimalFormat twoDForm = new DecimalFormat("#", new DecimalFormatSymbols(Locale.US)); - Assert.assertTrue(new Float(twoDForm.format(new Float(val))).compareTo(new Float(twoDForm.format(new Float(val2)))) == 0); + Assert.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/StaffTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/StaffTest.java index ced08f806..134e32fb7 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 @@ -132,7 +132,7 @@ public class StaffTest { @Test public void testStaffListStatusActive() { - final List responseActive = (List) StaffHelper.getStaffListWithState(requestSpec, responseSpec, "active"); + final List responseActive = (List)StaffHelper.getStaffListWithState(requestSpec, responseSpec, "active"); for(final HashMap staff : responseActive) { Assert.assertNotNull(staff.get("id")); Assert.assertEquals(staff.get("isActive"), true); @@ -141,7 +141,7 @@ public class StaffTest { @Test public void testStaffListStatusInactive() { - final List responseInactive = (List) StaffHelper.getStaffListWithState(requestSpec, responseSpec, "inactive"); + final List responseInactive = (List)StaffHelper.getStaffListWithState(requestSpec, responseSpec, "inactive"); for(final HashMap staff : responseInactive) { Assert.assertNotNull(staff.get("id")); diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/CenterDomain.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/CenterDomain.java index 06d48dc29..f5c4f3c66 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/CenterDomain.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/CenterDomain.java @@ -29,7 +29,7 @@ public class CenterDomain implements Comparable { private Integer id; private String accountNo; - private HashMap status; + private HashMap status; private boolean active; private String name; private String externalId; @@ -43,7 +43,7 @@ public class CenterDomain implements Comparable { final String name, final String externalId, final Integer staffId, final int officeID, final String officeName, final String hierarchy, final ArrayList groupMembers) { this.id = id; - this.status = new HashMap(); + this.status = new HashMap(); this.status.put("id", statusid); this.status.put("code", statuscode); this.status.put("value", statusvalue); @@ -67,7 +67,7 @@ public class CenterDomain implements Comparable { private Integer id; private String accountNo; - private HashMap status; + private HashMap status; private boolean active; private String name; private String externalId; @@ -86,7 +86,7 @@ public class CenterDomain implements Comparable { final String hierarchy, final ArrayList groupMembers) { this.id = id; this.accountNo = accountNo; - this.status = new HashMap(); + this.status = new HashMap(); this.status.put("id", statusid); this.status.put("code", statuscode); this.status.put("value", statusvalue); 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 d11b091ae..357005d0c 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 @@ -503,14 +503,14 @@ public class ClientHelper { getUndoWithdrawnClientAsJSON(CREATED_DATE_PLUS_TWO), clientId); } - public Object undoRejectedclient(final Integer clientId, final String jsonAttributeToGetBack, + public ArrayList> undoRejectedclient(final Integer clientId, final String jsonAttributeToGetBack, final String rejectedDate) { System.out.println("----------------------------------UNDO REJECT CLIENT ----------------------------------"); return performClientActionsWithValidationErrors(createClientOperationURL(UNDOREJECT_CLIENT_COMMAND, clientId), getUndoRejectClientAsJSON(rejectedDate), jsonAttributeToGetBack); } - public Object undoWithdrawclient(final Integer clientId, final String jsonAttributeToGetBack, + public ArrayList> undoWithdrawclient(final Integer clientId, final String jsonAttributeToGetBack, final String rejectedDate) { System.out.println("----------------------------------UNDO WITHDRAW CLIENT ----------------------------------"); return performClientActionsWithValidationErrors( @@ -518,7 +518,7 @@ public class ClientHelper { getUndoWithdrawnClientAsJSON(rejectedDate), jsonAttributeToGetBack); } - public Object activateClient(final Integer clientId, final String jsonAttributeToGetBack) { + public ArrayList> activateClient(final Integer clientId, final String jsonAttributeToGetBack) { System.out.println("--------------------------------- ACTIVATE CLIENT -------------------------------"); return performClientActionsWithValidationErrors(createClientOperationURL(ACTIVATE_CLIENT_COMMAND, clientId), getActivateClientAsJSON(CREATED_DATE_PLUS_ONE), jsonAttributeToGetBack); @@ -531,7 +531,7 @@ public class ClientHelper { getActivateClientAsJSON(activationDate), clientId); } - private ArrayList performClientActionsWithValidationErrors(final String postURLForClient, + private ArrayList> performClientActionsWithValidationErrors(final String postURLForClient, final String jsonToBeSent, final String jsonAttributeToGetBack) { return Utils.performServerPost(this.requestSpec, this.responseSpec, postURLForClient, jsonToBeSent, jsonAttributeToGetBack); @@ -621,4 +621,4 @@ public class ClientHelper { return Utils.performServerTemplatePost(requestSpec,responseSpec,CLIENT_URL+"/uploadtemplate"+"?"+Utils.TENANT_IDENTIFIER, legalFormType,file,locale,dateFormat); } -} \ No newline at end of file +} 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 1fa1453c0..f116aad86 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 @@ -39,8 +39,8 @@ public class GlobalConfigurationHelper { public static ArrayList getAllGlobalConfigurations(final RequestSpecification requestSpec, final ResponseSpecification responseSpec) { final String GET_ALL_GLOBAL_CONFIG_URL = "/fineract-provider/api/v1/configurations?" + Utils.TENANT_IDENTIFIER; System.out.println("------------------------ RETRIEVING ALL GLOBAL CONFIGURATIONS -------------------------"); - final HashMap response = Utils.performServerGet(requestSpec, responseSpec, GET_ALL_GLOBAL_CONFIG_URL, ""); - return (ArrayList) response.get("globalConfiguration"); + final HashMap> response = Utils.performServerGet(requestSpec, responseSpec, GET_ALL_GLOBAL_CONFIG_URL, ""); + return (ArrayList) response.get("globalConfiguration"); } public static HashMap getGlobalConfigurationById(final RequestSpecification requestSpec, final ResponseSpecification responseSpec, @@ -407,4 +407,4 @@ public class GlobalConfigurationHelper { return new Gson().toJson(map); } -} \ No newline at end of file +} 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 56925808c..89cbbc585 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 @@ -86,7 +86,7 @@ public class HookHelper { public void verifyUpdateHook(final String updateURL, final Long hookId) { System.out.println("------------------------------CHECK UPDATE HOOK DETAILS------------------------------------\n"); final String GET_URL = "/fineract-provider/api/v1/hooks/" + hookId + "?" + Utils.TENANT_IDENTIFIER; - ArrayList map = Utils.performServerGet(this.requestSpec, this.responseSpec, GET_URL, "config"); + ArrayList> map = Utils.>>performServerGet(this.requestSpec, this.responseSpec, GET_URL, "config"); HashMap hash = (HashMap) map.get(1); assertEquals(updateURL, hash.get("fieldValue")); } @@ -95,7 +95,7 @@ public class HookHelper { System.out.println("------------------------------CHECK DELETE HOOK DETAILS------------------------------------\n"); final String GET_URL = "/fineract-provider/api/v1/hooks/" + hookId + "?" + Utils.TENANT_IDENTIFIER; ResponseSpecification responseSpec404 = new ResponseSpecBuilder().expectStatusCode(404).build(); - ArrayList array = Utils.performServerGet(this.requestSpec, responseSpec404, GET_URL, "errors"); + ArrayList> array = Utils.>>performServerGet(this.requestSpec, responseSpec404, GET_URL, "errors"); HashMap map = (HashMap)array.get(0); assertEquals("error.msg.hook.identifier.not.found",map.get("userMessageGlobalisationCode")); } diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/OfficeHelper.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/OfficeHelper.java index 9b42c5696..0707f486b 100755 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/OfficeHelper.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/OfficeHelper.java @@ -61,7 +61,7 @@ public class OfficeHelper { } public Integer updateOffice(int id, String name, String openingDate) { - final HashMap map = new HashMap<>(); + final HashMap map = new HashMap(); map.put("name", name); map.put("dateFormat", "dd MMMM yyyy"); map.put("locale", "en"); 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 82a44655c..8d8bf359a 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 @@ -106,7 +106,7 @@ public class ProvisioningIntegrationTest { ArrayList definitions = (ArrayList)newCriteria.get("definitions") ; for(int i = 0 ; i < definitions.size(); i++) { Map criteriadefinition = (Map) definitions.get(i) ; - criteriadefinition.put("provisioningPercentage", new Float(20.0)) ; + criteriadefinition.put("provisioningPercentage", Float.valueOf((float)20.0)) ; } newCriteria.put("locale", "en"); String updateCriteriaString = new Gson().toJson(newCriteria) ; 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 9fdaebdf2..04fa83770 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 @@ -20,8 +20,8 @@ package org.apache.fineract.integrationtests.common; 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.assertThat; import static org.junit.Assert.fail; import io.restassured.RestAssured; 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 40f023288..90d798b22 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 @@ -168,14 +168,14 @@ public class CampaignsHelper { private ArrayList getReports(String jsonAttributeToGetBack) { System.out.println("--------------------------------- GET REPORTS OPTIONS -------------------------------"); - Assert.notNull(jsonAttributeToGetBack); + Assert.notNull(jsonAttributeToGetBack, "jsonAttributeToGetBack may not be null"); final String templateUrl = SMS_CAMPAIGNS_URL + "/template?" + Utils.TENANT_IDENTIFIER; final String json = given().spec(requestSpec).expect().spec(responseSpec).log().ifError().when().get(templateUrl).andReturn() .asString(); - Assert.notNull(json); + Assert.notNull(json, "json"); ArrayList reportsList = new ArrayList<>(); String reportsString = new Gson().toJson(from(json).get(jsonAttributeToGetBack)); - Assert.notNull(reportsString); + Assert.notNull(reportsString, "reportsString"); final Gson gson = new Gson(); final Type typeOfHashMap = new TypeToken>() {}.getType(); reportsList = gson.fromJson(reportsString, typeOfHashMap); @@ -190,7 +190,7 @@ public class CampaignsHelper { if (reportName.equals(reportData.getReportName())) { return reportData.getReportId(); } } } - Assert.notNull(null); + Assert.notNull(null, "null"); return null; } } diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/organisation/CurrencyHelper.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/organisation/CurrencyHelper.java index 97d32c710..072fba2c3 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/organisation/CurrencyHelper.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/organisation/CurrencyHelper.java @@ -65,12 +65,12 @@ public class CurrencyHelper { final String json = given().spec(requestSpec).expect().spec(responseSpec).log().ifError().when() .get(getUrl).andReturn().asString(); final Gson gson = new Gson(); - Assert.notNull(json); + Assert.notNull(json, "json"); final ArrayList currencyList = new ArrayList(); final Type typeOfHashMap = new TypeToken>>() { }.getType(); final Map> responseMap = gson.fromJson(json, typeOfHashMap); for(Map.Entry> entry : responseMap.entrySet()) { - Assert.isTrue(permittedCurrencyArrays.contains(entry.getKey())); + Assert.isTrue(permittedCurrencyArrays.contains(entry.getKey()), "permittedCurrencyArrays"); for(Currency currency : entry.getValue()) { currencyList.add(currency); } @@ -83,7 +83,7 @@ public class CurrencyHelper { final String json = given().spec(requestSpec).body(getUpdateJSON(currencies)).expect().spec(responseSpec).log().ifError().when() .put(CURRENCY_URL).andReturn().asString(); final Gson gson = new Gson(); - Assert.notNull(json); + Assert.notNull(json, "json"); final Type typeOfHashMap = new TypeToken>>>() { }.getType(); final Map>> responseMap = gson.fromJson(json, typeOfHashMap); return responseMap.get("changes").get("currencies"); diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/provisioning/ProvisioningHelper.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/provisioning/ProvisioningHelper.java index 69f0d5f49..6a50a2ca5 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/provisioning/ProvisioningHelper.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/provisioning/ProvisioningHelper.java @@ -66,23 +66,23 @@ public class ProvisioningHelper { return provisioningEntryCreateJson; } - private static ArrayList addLoanProducts(ArrayList loanProducts) { - ArrayList list = new ArrayList<>(); + private static ArrayList> addLoanProducts(ArrayList loanProducts) { + ArrayList> list = new ArrayList<>(); for (int i = 0; i < loanProducts.size(); i++) { - HashMap map = new HashMap(); + HashMap map = new HashMap<>(); map.put("id", loanProducts.get(i)); list.add(map); } return list; } - public static ArrayList addProvisioningCategories(ArrayList categories, Account liability, Account expense) { - ArrayList list = new ArrayList(); + public static ArrayList> addProvisioningCategories(ArrayList categories, Account liability, Account expense) { + ArrayList> list = new ArrayList<>(); int minStart = 0; int maxStart = 30; for (int i = 0; i < categories.size(); i++) { - HashMap map = new HashMap(); + HashMap map = new HashMap<>(); HashMap category = (HashMap) categories.get(i); map.put("categoryId", category.get("id")); map.put("categoryName", category.get("categoryName")); @@ -92,7 +92,7 @@ public class ProvisioningHelper { } else { map.put("maxAge", (i+1) * 30); } - map.put("provisioningPercentage", new Float((i + 1) * 5.5)); + map.put("provisioningPercentage", Float.valueOf((float)((i + 1) * 5.5))); map.put("liabilityAccount", liability.getAccountID()); map.put("expenseAccount", expense.getAccountID()); list.add(map); 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 f50003039..f57627d4f 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 @@ -24,7 +24,7 @@ import static org.apache.fineract.integrationtests.interoperation.InteropHelper. import io.restassured.builder.RequestSpecBuilder; import io.restassured.builder.ResponseSpecBuilder; import io.restassured.http.ContentType; -import io.restassured.internal.path.ObjectConverter; +import io.restassured.internal.common.path.ObjectConverter; import io.restassured.path.json.JsonPath; import io.restassured.specification.RequestSpecification; import io.restassured.specification.ResponseSpecification; 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 74ab9afc3..caefa6d29 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 @@ -53,12 +53,12 @@ public class GuarantorTest { private LoanTransactionHelper loanTransactionHelper; private GuarantorHelper guarantorHelper; private SavingsAccountHelper savingsAccountHelper; - private final Float self1_balance = new Float(5000); - private final Float external1_balance = new Float(5000); - private final Float external2_balance = new Float(5000); - private final Float self1_guarantee = new Float(2000); - private final Float external1_guarantee = new Float(2000); - private final Float external2_guarantee = new Float(1000); + private final Float self1_balance = Float.valueOf((float)5000); + private final Float external1_balance = Float.valueOf((float)5000); + private final Float external2_balance = Float.valueOf((float)5000); + private final Float self1_guarantee = Float.valueOf((float)2000); + private final Float external1_guarantee = Float.valueOf((float)2000); + private final Float external2_guarantee = Float.valueOf((float)1000); @Before public void setUp() throws Exception { @@ -75,9 +75,9 @@ public class GuarantorTest { @Test public void testGuarantor() { - Float self1_hold_funds = new Float(0); - Float external1_hold_funds = new Float(0); - Float external2_hold_funds = new Float(0); + Float self1_hold_funds = Float.valueOf((float)0); + Float external1_hold_funds = Float.valueOf((float)0); + Float external2_hold_funds = Float.valueOf((float)0); final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec); ClientHelper.verifyClientCreatedOnServer(this.requestSpec, this.responseSpec, clientID); final Integer clientID_external = ClientHelper.createClient(this.requestSpec, this.responseSpec); @@ -160,9 +160,9 @@ public class GuarantorTest { System.out.println("-----------------------------------UNDO APPROVE LOAN-----------------------------------------"); loanStatusHashMap = this.loanTransactionHelper.undoApproval(loanID); LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap); - verifySavingsOnHoldBalance(selfSavigsId, new Float(0)); - verifySavingsOnHoldBalance(externalSavigsId_1, new Float(0)); - verifySavingsOnHoldBalance(externalSavigsId_2, new Float(0)); + verifySavingsOnHoldBalance(selfSavigsId, Float.valueOf((float)0)); + verifySavingsOnHoldBalance(externalSavigsId_1, Float.valueOf((float)0)); + verifySavingsOnHoldBalance(externalSavigsId_2, Float.valueOf((float)0)); System.out.println("-----------------------------------APPROVE LOAN-----------------------------------------"); loanStatusHashMap = this.loanTransactionHelper.approveLoan(LOAN_DISBURSEMENT_DATE, loanID); @@ -182,8 +182,8 @@ public class GuarantorTest { todaysDate.add(Calendar.DAY_OF_MONTH, -7 * 3); String LOAN_REPAYMENT_DATE = dateFormat.format(todaysDate.getTime()); Float totalDueForCurrentPeriod = (Float) loanSchedule.get(1).get("totalDueForPeriod"); - external1_hold_funds -= new Float(827.5867); - external2_hold_funds -= new Float(413.7933); + external1_hold_funds -= Float.valueOf((float)827.5867); + external2_hold_funds -= Float.valueOf((float)413.7933); this.loanTransactionHelper.makeRepayment(LOAN_REPAYMENT_DATE, totalDueForCurrentPeriod, loanID); verifySavingsOnHoldBalance(selfSavigsId, self1_hold_funds); verifySavingsOnHoldBalance(externalSavigsId_1, external1_hold_funds); @@ -194,8 +194,8 @@ public class GuarantorTest { todaysDate.add(Calendar.DAY_OF_MONTH, -7 * 2); LOAN_REPAYMENT_DATE = dateFormat.format(todaysDate.getTime()); totalDueForCurrentPeriod = (Float) loanSchedule.get(2).get("totalDueForPeriod"); - external1_hold_funds -= new Float(831.4067); - external2_hold_funds -= new Float(415.7033333); + external1_hold_funds -= Float.valueOf((float)831.4067); + external2_hold_funds -= Float.valueOf((float)415.7033333); this.loanTransactionHelper.makeRepayment(LOAN_REPAYMENT_DATE, totalDueForCurrentPeriod, loanID); verifySavingsOnHoldBalance(selfSavigsId, self1_hold_funds); verifySavingsOnHoldBalance(externalSavigsId_1, external1_hold_funds); @@ -206,20 +206,20 @@ public class GuarantorTest { todaysDate.add(Calendar.DAY_OF_MONTH, -7); LOAN_REPAYMENT_DATE = dateFormat.format(todaysDate.getTime()); totalDueForCurrentPeriod = (Float) loanSchedule.get(3).get("totalDueForPeriod"); - self1_hold_funds -= new Float(741.355); + self1_hold_funds -= Float.valueOf((float)741.355); this.loanTransactionHelper.makeRepayment(LOAN_REPAYMENT_DATE, totalDueForCurrentPeriod, loanID); verifySavingsOnHoldBalance(selfSavigsId, self1_hold_funds); - verifySavingsOnHoldBalance(externalSavigsId_1, new Float(0)); - verifySavingsOnHoldBalance(externalSavigsId_2, new Float(0)); + verifySavingsOnHoldBalance(externalSavigsId_1, Float.valueOf((float)0)); + verifySavingsOnHoldBalance(externalSavigsId_2, Float.valueOf((float)0)); // forth repayment todaysDate = Calendar.getInstance(); LOAN_REPAYMENT_DATE = dateFormat.format(todaysDate.getTime()); totalDueForCurrentPeriod = (Float) loanSchedule.get(3).get("totalDueForPeriod"); this.loanTransactionHelper.makeRepayment(LOAN_REPAYMENT_DATE, totalDueForCurrentPeriod, loanID); - verifySavingsOnHoldBalance(selfSavigsId, new Float(0)); - verifySavingsOnHoldBalance(externalSavigsId_1, new Float(0)); - verifySavingsOnHoldBalance(externalSavigsId_2, new Float(0)); + verifySavingsOnHoldBalance(selfSavigsId, Float.valueOf((float)0)); + verifySavingsOnHoldBalance(externalSavigsId_1, Float.valueOf((float)0)); + verifySavingsOnHoldBalance(externalSavigsId_2, Float.valueOf((float)0)); loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID); LoanStatusChecker.verifyLoanAccountIsClosed(loanStatusHashMap); @@ -230,9 +230,9 @@ public class GuarantorTest { @Test public void testGuarantor_UNDO_DISBURSAL() { - Float self1_hold_funds = new Float(0); - Float external1_hold_funds = new Float(0); - Float external2_hold_funds = new Float(0); + Float self1_hold_funds = Float.valueOf((float)0); + Float external1_hold_funds = Float.valueOf((float)0); + Float external2_hold_funds = Float.valueOf((float)0); final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec); ClientHelper.verifyClientCreatedOnServer(this.requestSpec, this.responseSpec, clientID); final Integer clientID_external = ClientHelper.createClient(this.requestSpec, this.responseSpec); @@ -317,9 +317,9 @@ public class GuarantorTest { System.out.println("-----------------------------------UNDO APPROVE LOAN-----------------------------------------"); loanStatusHashMap = this.loanTransactionHelper.undoApproval(loanID); LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap); - verifySavingsOnHoldBalance(selfSavigsId, new Float(0)); - verifySavingsOnHoldBalance(externalSavigsId_1, new Float(0)); - verifySavingsOnHoldBalance(externalSavigsId_2, new Float(0)); + verifySavingsOnHoldBalance(selfSavigsId, Float.valueOf((float)0)); + verifySavingsOnHoldBalance(externalSavigsId_1, Float.valueOf((float)0)); + verifySavingsOnHoldBalance(externalSavigsId_2, Float.valueOf((float)0)); System.out.println("-----------------------------------APPROVE LOAN-----------------------------------------"); loanStatusHashMap = this.loanTransactionHelper.approveLoan(LOAN_DISBURSEMENT_DATE, loanID); @@ -373,8 +373,8 @@ public class GuarantorTest { todaysDate.add(Calendar.DAY_OF_MONTH, -7 * 3); String LOAN_REPAYMENT_DATE = dateFormat.format(todaysDate.getTime()); Float totalDueForCurrentPeriod = (Float) loanSchedule.get(1).get("totalDueForPeriod"); - external1_hold_funds -= new Float(827.5867); - external2_hold_funds -= new Float(413.7933); + external1_hold_funds -= Float.valueOf((float)827.5867); + external2_hold_funds -= Float.valueOf((float)413.7933); this.loanTransactionHelper.makeRepayment(LOAN_REPAYMENT_DATE, totalDueForCurrentPeriod, loanID); verifySavingsOnHoldBalance(selfSavigsId, self1_hold_funds); verifySavingsOnHoldBalance(externalSavigsId_3, external1_hold_funds); @@ -385,8 +385,8 @@ public class GuarantorTest { todaysDate.add(Calendar.DAY_OF_MONTH, -7 * 2); LOAN_REPAYMENT_DATE = dateFormat.format(todaysDate.getTime()); totalDueForCurrentPeriod = (Float) loanSchedule.get(2).get("totalDueForPeriod"); - external1_hold_funds -= new Float(831.4067); - external2_hold_funds -= new Float(415.7033333); + external1_hold_funds -= Float.valueOf((float)831.4067); + external2_hold_funds -= Float.valueOf((float)415.7033333); this.loanTransactionHelper.makeRepayment(LOAN_REPAYMENT_DATE, totalDueForCurrentPeriod, loanID); verifySavingsOnHoldBalance(selfSavigsId, self1_hold_funds); verifySavingsOnHoldBalance(externalSavigsId_3, external1_hold_funds); @@ -397,11 +397,11 @@ public class GuarantorTest { todaysDate.add(Calendar.DAY_OF_MONTH, -7); LOAN_REPAYMENT_DATE = dateFormat.format(todaysDate.getTime()); totalDueForCurrentPeriod = (Float) loanSchedule.get(3).get("totalDueForPeriod"); - Float self1_hold_funds_temp = self1_hold_funds - new Float(741.355); + Float self1_hold_funds_temp = self1_hold_funds - Float.valueOf((float)741.355); HashMap transactionDetail = this.loanTransactionHelper.makeRepayment(LOAN_REPAYMENT_DATE, totalDueForCurrentPeriod, loanID); verifySavingsOnHoldBalance(selfSavigsId, self1_hold_funds_temp); - verifySavingsOnHoldBalance(externalSavigsId_3, new Float(0)); - verifySavingsOnHoldBalance(externalSavigsId_2, new Float(0)); + verifySavingsOnHoldBalance(externalSavigsId_3, Float.valueOf((float)0)); + verifySavingsOnHoldBalance(externalSavigsId_2, Float.valueOf((float)0)); // undo repayment this.loanTransactionHelper.adjustLoanTransaction(loanID, (Integer) transactionDetail.get(CommonConstants.RESPONSE_RESOURCE_ID), @@ -414,17 +414,17 @@ public class GuarantorTest { loanStatusHashMap = this.loanTransactionHelper.undoDisbursal(loanID); LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap); LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap); - verifySavingsOnHoldBalance(selfSavigsId, new Float(self1_guarantee)); - verifySavingsOnHoldBalance(externalSavigsId_3, new Float(external1_guarantee)); - verifySavingsOnHoldBalance(externalSavigsId_2, new Float(external2_guarantee)); + verifySavingsOnHoldBalance(selfSavigsId, Float.valueOf((float)self1_guarantee)); + verifySavingsOnHoldBalance(externalSavigsId_3, Float.valueOf((float)external1_guarantee)); + verifySavingsOnHoldBalance(externalSavigsId_2, Float.valueOf((float)external2_guarantee)); } @SuppressWarnings({ "rawtypes", "unchecked" }) @Test public void testGuarantor_RECOVER_GUARANTEES() { - Float self1_hold_funds = new Float(0); - Float external1_hold_funds = new Float(0); + Float self1_hold_funds = Float.valueOf((float)0); + Float external1_hold_funds = Float.valueOf((float)0); final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec); ClientHelper.verifyClientCreatedOnServer(this.requestSpec, this.responseSpec, clientID); final Integer clientID_external = ClientHelper.createClient(this.requestSpec, this.responseSpec); @@ -476,14 +476,14 @@ public class GuarantorTest { todaysDate.add(Calendar.DAY_OF_MONTH, -14); String LOAN_REPAYMENT_DATE = dateFormat.format(todaysDate.getTime()); Float totalDueForCurrentPeriod = (Float) loanSchedule.get(1).get("totalDueForPeriod"); - external1_hold_funds -= new Float(993.104); + external1_hold_funds -= Float.valueOf((float)993.104); this.loanTransactionHelper.makeRepayment(LOAN_REPAYMENT_DATE, totalDueForCurrentPeriod, loanID); verifySavingsOnHoldBalance(selfSavigsId, self1_hold_funds); verifySavingsOnHoldBalance(externalSavigsId_1, external1_hold_funds); this.loanTransactionHelper.recoverFromGuarantor(loanID); - verifySavingsBalanceAndOnHoldBalance(selfSavigsId, new Float(0), self1_balance - self1_hold_funds); - verifySavingsBalanceAndOnHoldBalance(externalSavigsId_1, new Float(0), external1_balance - external1_hold_funds); + verifySavingsBalanceAndOnHoldBalance(selfSavigsId, Float.valueOf((float)0), self1_balance - self1_hold_funds); + verifySavingsBalanceAndOnHoldBalance(externalSavigsId_1, Float.valueOf((float)0), external1_balance - external1_hold_funds); } @@ -491,17 +491,17 @@ public class GuarantorTest { @Test public void testGuarantor_RECOVER_GUARANTEES_WITH_MORE_GUARANTEE() { - Float self1_hold_funds = new Float(0); - Float external1_hold_funds = new Float(0); + Float self1_hold_funds = Float.valueOf((float)0); + Float external1_hold_funds = Float.valueOf((float)0); final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec); ClientHelper.verifyClientCreatedOnServer(this.requestSpec, this.responseSpec, clientID); final Integer clientID_external = ClientHelper.createClient(this.requestSpec, this.responseSpec); ClientHelper.verifyClientCreatedOnServer(this.requestSpec, this.responseSpec, clientID_external); - Float selfBalance = new Float(10000); - Float externalBalance = new Float(10000); - Float selfguarantee = new Float(6000); - Float externalguarantee = new Float(7000); + Float selfBalance = Float.valueOf((float)10000); + Float externalBalance = Float.valueOf((float)10000); + Float selfguarantee = Float.valueOf((float)6000); + Float externalguarantee = Float.valueOf((float)7000); final Integer selfSavigsId = SavingsAccountHelper.openSavingsAccount(this.requestSpec, this.responseSpec, clientID, String.valueOf(selfBalance)); @@ -549,14 +549,14 @@ public class GuarantorTest { todaysDate.add(Calendar.DAY_OF_MONTH, -14); String LOAN_REPAYMENT_DATE = dateFormat.format(todaysDate.getTime()); Float totalDueForCurrentPeriod = (Float) loanSchedule.get(1).get("totalDueForPeriod"); - external1_hold_funds -= new Float(3227.588); + external1_hold_funds -= Float.valueOf((float)3227.588); this.loanTransactionHelper.makeRepayment(LOAN_REPAYMENT_DATE, totalDueForCurrentPeriod, loanID); verifySavingsOnHoldBalance(selfSavigsId, self1_hold_funds); verifySavingsOnHoldBalance(externalSavigsId_1, external1_hold_funds); this.loanTransactionHelper.recoverFromGuarantor(loanID); - verifySavingsBalanceAndOnHoldBalance(selfSavigsId, new Float(0), selfBalance - new Float(4615.385)); - verifySavingsBalanceAndOnHoldBalance(externalSavigsId_1, new Float(0), externalBalance - new Float(2901.8553)); + verifySavingsBalanceAndOnHoldBalance(selfSavigsId, Float.valueOf((float)0), selfBalance - Float.valueOf((float)4615.385)); + verifySavingsBalanceAndOnHoldBalance(externalSavigsId_1, Float.valueOf((float)0), externalBalance - Float.valueOf((float)2901.8553)); } @@ -565,8 +565,8 @@ public class GuarantorTest { @Test public void testGuarantor_WRITE_OFF_LOAN() { - Float self1_hold_funds = new Float(0); - Float external1_hold_funds = new Float(0); + Float self1_hold_funds = Float.valueOf((float)0); + Float external1_hold_funds = Float.valueOf((float)0); final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec); ClientHelper.verifyClientCreatedOnServer(this.requestSpec, this.responseSpec, clientID); final Integer clientID_external = ClientHelper.createClient(this.requestSpec, this.responseSpec); @@ -618,7 +618,7 @@ public class GuarantorTest { todaysDate.add(Calendar.DAY_OF_MONTH, -14); String LOAN_REPAYMENT_DATE = dateFormat.format(todaysDate.getTime()); Float totalDueForCurrentPeriod = (Float) loanSchedule.get(1).get("totalDueForPeriod"); - external1_hold_funds -= new Float(993.104); + external1_hold_funds -= Float.valueOf((float)993.104); this.loanTransactionHelper.makeRepayment(LOAN_REPAYMENT_DATE, totalDueForCurrentPeriod, loanID); verifySavingsOnHoldBalance(selfSavigsId, self1_hold_funds); verifySavingsOnHoldBalance(externalSavigsId_1, external1_hold_funds); @@ -626,8 +626,8 @@ public class GuarantorTest { todaysDate = Calendar.getInstance(); String LOAN_WRITEOFF_DATE = dateFormat.format(todaysDate.getTime()); this.loanTransactionHelper.writeOffLoan(LOAN_WRITEOFF_DATE, loanID); - verifySavingsBalanceAndOnHoldBalance(selfSavigsId, new Float(0), self1_balance); - verifySavingsBalanceAndOnHoldBalance(externalSavigsId_1, new Float(0), external1_balance); + verifySavingsBalanceAndOnHoldBalance(selfSavigsId, Float.valueOf((float)0), self1_balance); + verifySavingsBalanceAndOnHoldBalance(externalSavigsId_1, Float.valueOf((float)0), external1_balance); } diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/importhandler/ImportHandlerUtils.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/importhandler/ImportHandlerUtils.java index b714e44bd..f1bd553be 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/importhandler/ImportHandlerUtils.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/importhandler/ImportHandlerUtils.java @@ -27,16 +27,18 @@ import org.apache.fineract.infrastructure.core.exception.AbstractPlatformService import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException; import org.apache.fineract.infrastructure.core.exception.PlatformDataIntegrityException; import org.apache.fineract.infrastructure.core.exception.UnsupportedParameterException; -import org.apache.poi.hssf.usermodel.HSSFWorkbook; -import org.apache.poi.hssf.util.CellReference; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.CellStyle; +import org.apache.poi.ss.usermodel.CellType; import org.apache.poi.ss.usermodel.CellValue; +import org.apache.poi.ss.usermodel.FillPatternType; import org.apache.poi.ss.usermodel.FormulaEvaluator; import org.apache.poi.ss.usermodel.IndexedColors; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Sheet; +import org.apache.poi.ss.usermodel.SheetVisibility; import org.apache.poi.ss.usermodel.Workbook; +import org.apache.poi.ss.util.CellReference; import org.joda.time.LocalDate; public class ImportHandlerUtils { @@ -62,10 +64,10 @@ public class ImportHandlerUtils { public static Long readAsLong(int colIndex, Row row) { Cell c = row.getCell(colIndex); - if (c == null || c.getCellType() == Cell.CELL_TYPE_BLANK) + if (c == null || c.getCellType() == CellType.BLANK) return null; FormulaEvaluator eval = row.getSheet().getWorkbook().getCreationHelper().createFormulaEvaluator(); - if(c.getCellType() == Cell.CELL_TYPE_FORMULA) { + if(c.getCellType() == CellType.FORMULA) { if(eval!=null) { CellValue val = null; try { @@ -76,7 +78,7 @@ public class ImportHandlerUtils { return ((Double)val.getNumberValue()).longValue(); } } - else if (c.getCellType()==Cell.CELL_TYPE_NUMERIC){ + else if (c.getCellType()==CellType.NUMERIC){ return ((Double) c.getNumericCellValue()).longValue(); } else { @@ -89,10 +91,10 @@ public class ImportHandlerUtils { public static String readAsString(int colIndex, Row row) { Cell c = row.getCell(colIndex); - if (c == null || c.getCellType() == Cell.CELL_TYPE_BLANK) + if (c == null || c.getCellType() == CellType.BLANK) return null; FormulaEvaluator eval = row.getSheet().getWorkbook().getCreationHelper().createFormulaEvaluator(); - if(c.getCellType() == Cell.CELL_TYPE_FORMULA) { + if(c.getCellType() == CellType.FORMULA) { if (eval!=null) { CellValue val = null; try { @@ -114,13 +116,13 @@ public class ImportHandlerUtils { }else { return null; } - }else if(c.getCellType()==Cell.CELL_TYPE_STRING) { + }else if(c.getCellType()==CellType.STRING) { String res = trimEmptyDecimalPortion(c.getStringCellValue().trim()); return res.trim(); - }else if(c.getCellType()==Cell.CELL_TYPE_NUMERIC) { + }else if(c.getCellType()==CellType.NUMERIC) { return ((Double) row.getCell(colIndex).getNumericCellValue()).intValue() + ""; - }else if (c.getCellType()==Cell.CELL_TYPE_BOOLEAN){ + }else if (c.getCellType()==CellType.BOOLEAN){ return c.getBooleanCellValue()+""; }else { return null; @@ -137,7 +139,7 @@ public class ImportHandlerUtils { public static LocalDate readAsDate(int colIndex, Row row) { Cell c = row.getCell(colIndex); - if(c == null || c.getCellType() == Cell.CELL_TYPE_BLANK) + if(c == null || c.getCellType() == CellType.BLANK) return null; LocalDate localDate=new LocalDate(c.getDateCellValue()); @@ -146,10 +148,10 @@ public class ImportHandlerUtils { public static Boolean readAsBoolean(int colIndex, Row row) { Cell c = row.getCell(colIndex); - if(c == null || c.getCellType() == Cell.CELL_TYPE_BLANK) + if(c == null || c.getCellType() == CellType.BLANK) return false; FormulaEvaluator eval = row.getSheet().getWorkbook().getCreationHelper().createFormulaEvaluator(); - if(c.getCellType() == Cell.CELL_TYPE_FORMULA) { + if(c.getCellType() == CellType.FORMULA) { if(eval!=null) { CellValue val = null; try { @@ -160,7 +162,7 @@ public class ImportHandlerUtils { return val.getBooleanValue(); } return false; - }else if(c.getCellType()==Cell.CELL_TYPE_BOOLEAN) + }else if(c.getCellType()==CellType.BOOLEAN) return c.getBooleanCellValue(); else { String booleanString = row.getCell(colIndex).getStringCellValue().trim(); @@ -173,10 +175,10 @@ public class ImportHandlerUtils { public static Integer readAsInt(int colIndex, Row row) { Cell c = row.getCell(colIndex); - if (c == null || c.getCellType() == Cell.CELL_TYPE_BLANK) + if (c == null || c.getCellType() == CellType.BLANK) return null; FormulaEvaluator eval = row.getSheet().getWorkbook().getCreationHelper().createFormulaEvaluator(); - if(c.getCellType() == Cell.CELL_TYPE_FORMULA) { + if(c.getCellType() == CellType.FORMULA) { if(eval!=null) { CellValue val = null; try { @@ -187,7 +189,7 @@ public class ImportHandlerUtils { return ((Double)val.getNumberValue()).intValue(); } return null; - }else if (c.getCellType()==Cell.CELL_TYPE_NUMERIC) { + }else if (c.getCellType()==CellType.NUMERIC) { return ((Double) c.getNumericCellValue()).intValue(); }else { return Integer.parseInt(row.getCell(colIndex).getStringCellValue()); @@ -196,10 +198,10 @@ public class ImportHandlerUtils { public static Double readAsDouble(int colIndex, Row row) { Cell c = row.getCell(colIndex); - if (c == null || c.getCellType() == Cell.CELL_TYPE_BLANK) + if (c == null || c.getCellType() == CellType.BLANK) return 0.0; FormulaEvaluator eval = row.getSheet().getWorkbook().getCreationHelper().createFormulaEvaluator(); - if(c.getCellType() == Cell.CELL_TYPE_FORMULA) { + if(c.getCellType() == CellType.FORMULA) { if (eval!=null) { CellValue val = null; try { @@ -211,7 +213,7 @@ public class ImportHandlerUtils { }else { return 0.0; } - } else if (c.getCellType()==Cell.CELL_TYPE_NUMERIC) { + } else if (c.getCellType()==CellType.NUMERIC) { return row.getCell(colIndex).getNumericCellValue(); }else { return Double.parseDouble(row.getCell(colIndex).getStringCellValue()); @@ -234,16 +236,15 @@ public class ImportHandlerUtils { } CellStyle style = workbook.createCellStyle(); style.setFillForegroundColor(color.getIndex()); - style.setFillPattern(CellStyle.SOLID_FOREGROUND); + style.setFillPattern(FillPatternType.SOLID_FOREGROUND); Sheet cache = workbook.createSheet(color.toString()); - workbook.setSheetHidden(workbook.getSheetIndex(cache), HSSFWorkbook.SHEET_STATE_VERY_HIDDEN); + workbook.setSheetVisibility(workbook.getSheetIndex(cache), SheetVisibility.VERY_HIDDEN); Row row = cache.createRow(cellReference.getRow()); Cell cell = row.createCell(cellReference.getCol()); cell.setCellStyle(style); return style; - } public static String getDefaultUserMessages(List ApiParameterErrorList){ @@ -301,20 +302,20 @@ public class ImportHandlerUtils { for (Row row : sheet) { for (Cell cell : row) { if(name!=null) { - if (cell.getCellType() == Cell.CELL_TYPE_STRING && cell.getRichStringCellValue().getString().trim().equals(name)) { + if (cell.getCellType() == CellType.STRING && cell.getRichStringCellValue().getString().trim().equals(name)) { if (sheetName.equals(TemplatePopulateImportConstants.OFFICE_SHEET_NAME) || sheetName.equals(TemplatePopulateImportConstants.GL_ACCOUNTS_SHEET_NAME) || sheetName.equals(TemplatePopulateImportConstants.EXTRAS_SHEET_NAME) || sheetName.equals(TemplatePopulateImportConstants.SHARED_PRODUCTS_SHEET_NAME)|| sheetName.equals(TemplatePopulateImportConstants.ROLES_SHEET_NAME)) { - if (row.getCell(cell.getColumnIndex() - 1).getCellType() == Cell.CELL_TYPE_NUMERIC) + if (row.getCell(cell.getColumnIndex() - 1).getCellType() == CellType.NUMERIC) return ((Double) row.getCell(cell.getColumnIndex() - 1).getNumericCellValue()).longValue(); return 0L; } else if (sheetName.equals(TemplatePopulateImportConstants.CLIENT_SHEET_NAME) || sheetName.equals(TemplatePopulateImportConstants.CENTER_SHEET_NAME) || sheetName.equals(TemplatePopulateImportConstants.GROUP_SHEET_NAME) || sheetName.equals(TemplatePopulateImportConstants.STAFF_SHEET_NAME)) - if (row.getCell(cell.getColumnIndex() + 1).getCellType() == Cell.CELL_TYPE_NUMERIC) + if (row.getCell(cell.getColumnIndex() + 1).getCellType() == CellType.NUMERIC) return ((Double) row.getCell(cell.getColumnIndex() + 1).getNumericCellValue()).longValue(); return 0L; } @@ -328,7 +329,7 @@ public class ImportHandlerUtils { for(int i = 0; i < 2; i++) { if (name != null) { Cell cell = row.getCell(i); - if (cell.getCellType() == Cell.CELL_TYPE_STRING && cell.getRichStringCellValue().getString().trim().equals(name)) { + if (cell.getCellType() == CellType.STRING && cell.getRichStringCellValue().getString().trim().equals(name)) { return ((Double) row.getCell(cell.getColumnIndex() - 1).getNumericCellValue()).longValue(); } }else { @@ -346,7 +347,7 @@ public class ImportHandlerUtils { for (Row row : sheet) { for (Cell cell : row) { if (name!=null) { - if (cell.getCellType() == Cell.CELL_TYPE_STRING + if (cell.getCellType() == CellType.STRING && cell.getRichStringCellValue().getString().trim() .equals(name)) { return row.getCell(cell.getColumnIndex() - 1) diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/populator/AbstractWorkbookPopulator.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/populator/AbstractWorkbookPopulator.java index 38a1876cc..69fd34121 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/populator/AbstractWorkbookPopulator.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/populator/AbstractWorkbookPopulator.java @@ -27,7 +27,6 @@ import java.util.List; import org.apache.fineract.organisation.office.data.OfficeData; import org.apache.fineract.portfolio.client.data.ClientData; import org.apache.fineract.portfolio.group.data.GroupGeneralData; -import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.CellStyle; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Sheet; @@ -55,7 +54,6 @@ public abstract class AbstractWorkbookPopulator implements WorkbookPopulator { } protected void writeFormula(int colIndex, Row row, String formula) { - row.createCell(colIndex).setCellType(Cell.CELL_TYPE_FORMULA); row.createCell(colIndex).setCellFormula(formula); } @@ -160,4 +158,4 @@ public abstract class AbstractWorkbookPopulator implements WorkbookPopulator { } } -} \ No newline at end of file +} diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/populator/loan/LoanWorkbookPopulator.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/populator/loan/LoanWorkbookPopulator.java index 2c5515995..91f5fa9f7 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/populator/loan/LoanWorkbookPopulator.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/populator/loan/LoanWorkbookPopulator.java @@ -32,6 +32,7 @@ import org.apache.fineract.portfolio.loanproduct.data.LoanProductData; import org.apache.poi.hssf.usermodel.HSSFDataValidationHelper; import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.ss.SpreadsheetVersion; +import org.apache.poi.ss.usermodel.BorderStyle; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.CellStyle; import org.apache.poi.ss.usermodel.DataValidation; @@ -378,9 +379,9 @@ public class LoanWorkbookPopulator extends AbstractWorkbookPopulator { CellStyle borderStyle = worksheet.getWorkbook().createCellStyle(); CellStyle doubleBorderStyle = worksheet.getWorkbook().createCellStyle(); - borderStyle.setBorderBottom(CellStyle.BORDER_THIN); - doubleBorderStyle.setBorderBottom(CellStyle.BORDER_THIN); - doubleBorderStyle.setBorderRight(CellStyle.BORDER_THICK); + borderStyle.setBorderBottom(BorderStyle.THIN); + doubleBorderStyle.setBorderBottom(BorderStyle.THIN); + doubleBorderStyle.setBorderRight(BorderStyle.THICK); for (int colNo = 0; colNo < 35; colNo++) { Cell cell = rowHeader.getCell(colNo); if (cell == null) diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/service/BulkImportWorkbookPopulatorServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/service/BulkImportWorkbookPopulatorServiceImpl.java index 876052a52..356e8d848 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/service/BulkImportWorkbookPopulatorServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/service/BulkImportWorkbookPopulatorServiceImpl.java @@ -297,14 +297,14 @@ public class BulkImportWorkbookPopulatorServiceImpl implements BulkImportWorkboo private List fetchCodeValuesByCodeName(String codeName){ List codeValues=null; if (codeName!=null){ - codeValues=(List)codeValueReadPlatformService.retrieveCodeValuesByCode(codeName); + codeValues=(List)codeValueReadPlatformService.retrieveCodeValuesByCode(codeName); }else { throw new NullPointerException(); } return codeValues; } private ListfetchSavingsProducts(){ - List savingsProducts=(List)savingsProductReadPlatformService.retrieveAll(); + List savingsProducts=(List)savingsProductReadPlatformService.retrieveAll(); return savingsProducts; } @@ -686,4 +686,4 @@ private WorkbookPopulator populateCenterWorkbook(Long officeId,Long staffId){ new ExtrasSheetPopulator(funds, paymentTypes, currencies),savingsAccounts); } -} \ No newline at end of file +} diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/boot/WebFrontEndConfiguration.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/boot/WebFrontEndConfiguration.java index 1664b4bd0..35663236c 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/boot/WebFrontEndConfiguration.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/boot/WebFrontEndConfiguration.java @@ -21,11 +21,11 @@ package org.apache.fineract.infrastructure.core.boot; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.EnableWebMvc; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; @EnableWebMvc @Configuration -public class WebFrontEndConfiguration extends WebMvcConfigurerAdapter { +public class WebFrontEndConfiguration implements WebMvcConfigurer { @Override public void addResourceHandlers(ResourceHandlerRegistry registry) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/boot/WebTwoFactorXmlConfiguration.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/boot/WebTwoFactorXmlConfiguration.java index 1c91a4295..fe570bdbd 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/boot/WebTwoFactorXmlConfiguration.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/boot/WebTwoFactorXmlConfiguration.java @@ -29,7 +29,7 @@ public class WebTwoFactorXmlConfiguration { @Bean public FilterRegistrationBean twoFactorFilterBean(TwoFactorAuthenticationFilter filter) { - FilterRegistrationBean registrationBean = new FilterRegistrationBean(filter); + FilterRegistrationBean registrationBean = new FilterRegistrationBean(filter); registrationBean.setEnabled(false); return registrationBean; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/boot/WebXmlConfiguration.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/boot/WebXmlConfiguration.java index 91f322e14..50a2584fb 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/boot/WebXmlConfiguration.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/boot/WebXmlConfiguration.java @@ -19,7 +19,6 @@ package org.apache.fineract.infrastructure.core.boot; import com.sun.jersey.spi.spring.container.servlet.SpringServlet; -import javax.servlet.Servlet; import org.apache.fineract.infrastructure.core.filters.ResponseCorsFilter; import org.apache.fineract.infrastructure.security.filter.TenantAwareBasicAuthenticationFilter; import org.springframework.beans.factory.annotation.Autowired; @@ -44,9 +43,8 @@ public class WebXmlConfiguration { @Bean public ServletRegistrationBean jersey() { - Servlet jerseyServlet = new SpringServlet(); - ServletRegistrationBean jerseyServletRegistration = new ServletRegistrationBean(); - jerseyServletRegistration.setServlet(jerseyServlet); + ServletRegistrationBean jerseyServletRegistration = new ServletRegistrationBean(); + jerseyServletRegistration.setServlet(new SpringServlet()); jerseyServletRegistration.addUrlMappings("/api/v1/*"); jerseyServletRegistration.setName("jersey-servlet"); jerseyServletRegistration.setLoadOnStartup(1); @@ -62,7 +60,7 @@ public class WebXmlConfiguration { @Bean public FilterRegistrationBean filterRegistrationBean() { - FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean(); + FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean(); filterRegistrationBean.setFilter(basicAuthenticationProcessingFilter); filterRegistrationBean.setEnabled(false); return filterRegistrationBean; diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/boot/WebXmlOauthConfiguration.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/boot/WebXmlOauthConfiguration.java index 799c64f7f..792d8d2d4 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/boot/WebXmlOauthConfiguration.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/boot/WebXmlOauthConfiguration.java @@ -19,7 +19,6 @@ package org.apache.fineract.infrastructure.core.boot; import com.sun.jersey.spi.spring.container.servlet.SpringServlet; -import javax.servlet.Servlet; import org.springframework.boot.web.servlet.ServletRegistrationBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -38,9 +37,8 @@ public class WebXmlOauthConfiguration { @Bean public ServletRegistrationBean jersey() { - Servlet jerseyServlet = new SpringServlet(); - ServletRegistrationBean jerseyServletRegistration = new ServletRegistrationBean(); - jerseyServletRegistration.setServlet(jerseyServlet); + ServletRegistrationBean jerseyServletRegistration = new ServletRegistrationBean(); + jerseyServletRegistration.setServlet(new SpringServlet()); jerseyServletRegistration.addUrlMappings("/api/v1/*"); jerseyServletRegistration.setName("jersey-servlet"); jerseyServletRegistration.setLoadOnStartup(1); @@ -56,7 +54,7 @@ public class WebXmlOauthConfiguration { @Bean public ServletRegistrationBean dispatcherRegistration(DispatcherServlet dispatcherServlet) { - ServletRegistrationBean registrationBean = new ServletRegistrationBean(dispatcherServlet); + ServletRegistrationBean registrationBean = new ServletRegistrationBean(dispatcherServlet); registrationBean.addUrlMappings("/api/oauth/token"); return registrationBean; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/domain/MySQLDictionaryCustom.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/domain/MySQLDictionaryCustom.java index 98f702494..973ca4f77 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/domain/MySQLDictionaryCustom.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/domain/MySQLDictionaryCustom.java @@ -23,6 +23,7 @@ import java.sql.SQLException; import org.apache.openjpa.jdbc.sql.BooleanRepresentationFactory; import org.apache.openjpa.jdbc.sql.MySQLDictionary; +@SuppressWarnings("unchecked") public class MySQLDictionaryCustom extends MySQLDictionary { public MySQLDictionaryCustom(){ diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/serialization/FromJsonHelper.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/serialization/FromJsonHelper.java index 16617048f..a8f67b5b6 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/serialization/FromJsonHelper.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/serialization/FromJsonHelper.java @@ -49,12 +49,10 @@ public class FromJsonHelper { private final Gson gsonConverter; private final JsonParserHelper helperDelegator; - private final JsonParser parser; public FromJsonHelper() { this.gsonConverter = new Gson(); this.helperDelegator = new JsonParserHelper(); - this.parser = new JsonParser(); } public Map extractMap(final Type typeOfMap, final String json) { @@ -140,7 +138,7 @@ public class FromJsonHelper { JsonElement parsedElement = null; if (StringUtils.isNotBlank(json)) { - parsedElement = this.parser.parse(json); + parsedElement = JsonParser.parseString(json); } return parsedElement; } @@ -286,4 +284,4 @@ public class FromJsonHelper { return this.gsonConverter; } -} \ No newline at end of file +} diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/service/TenantDatabaseUpgradeService.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/service/TenantDatabaseUpgradeService.java index 08a358645..c6786442e 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/service/TenantDatabaseUpgradeService.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/service/TenantDatabaseUpgradeService.java @@ -18,11 +18,11 @@ */ package org.apache.fineract.infrastructure.core.service; -import com.google.common.collect.ImmutableMap; import com.googlecode.flyway.core.Flyway; import com.googlecode.flyway.core.api.FlywayException; import com.googlecode.flyway.core.util.jdbc.DriverDataSource; import java.util.List; +import java.util.Map; import javax.annotation.PostConstruct; import javax.sql.DataSource; import org.apache.fineract.infrastructure.core.boot.JDBCDriverConfig; @@ -94,7 +94,7 @@ public class TenantDatabaseUpgradeService { flyway.setDataSource(tenantDataSource); flyway.setLocations("sql/migrations/list_db"); flyway.setOutOfOrder(true); - flyway.setPlaceholders(ImmutableMap.of( // FINERACT-773 + flyway.setPlaceholders(Map.of( // FINERACT-773 "fineract_default_tenantdb_hostname", dbHostname, "fineract_default_tenantdb_port", dbPort, "fineract_default_tenantdb_uid", dbUid, diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/service/ReadWriteNonCoreDataServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/service/ReadWriteNonCoreDataServiceImpl.java index 4672e619a..46cacc4cd 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/service/ReadWriteNonCoreDataServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/service/ReadWriteNonCoreDataServiceImpl.java @@ -475,13 +475,13 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ // PERMITTED datatables final String sql = "select if((exists (select 1 from x_registered_table where registered_table_name = ?)) = 1, 'true', 'false')"; final String isRegisteredDataTable = this.jdbcTemplate.queryForObject(sql, String.class, new Object[] { name }); - return new Boolean(isRegisteredDataTable); + return Boolean.valueOf(isRegisteredDataTable); } private void assertDataTableExists(final String datatableName) { final String sql = "select if((exists (select 1 from information_schema.tables where table_schema = schema() and table_name = ?)) = 1, 'true', 'false')"; final String dataTableExistsString = this.jdbcTemplate.queryForObject(sql, String.class, new Object[] { datatableName }); - final boolean dataTableExists = new Boolean(dataTableExistsString); + final boolean dataTableExists = Boolean.valueOf(dataTableExistsString); if (!dataTableExists) { throw new PlatformDataIntegrityException("error.msg.invalid.datatable", "Invalid Data Table: " + datatableName, "name", datatableName); } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/documentmanagement/contentrepository/S3ContentRepository.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/documentmanagement/contentrepository/S3ContentRepository.java index 3ba4f1c29..08020712e 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/documentmanagement/contentrepository/S3ContentRepository.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/documentmanagement/contentrepository/S3ContentRepository.java @@ -20,7 +20,6 @@ package org.apache.fineract.infrastructure.documentmanagement.contentrepository; import com.amazonaws.AmazonClientException; import com.amazonaws.AmazonServiceException; -import com.amazonaws.SDKGlobalConfiguration; import com.amazonaws.auth.BasicAWSCredentials; import com.amazonaws.services.s3.AmazonS3; import com.amazonaws.services.s3.AmazonS3Client; @@ -54,8 +53,6 @@ public class S3ContentRepository implements ContentRepository { public S3ContentRepository(final String bucketName, final String secretKey, final String accessKey) { this.s3BucketName = bucketName; - //On some AWS regions by default V4 signature is enabled. Setting this property. - System.setProperty(SDKGlobalConfiguration.ENABLE_S3_SIGV4_SYSTEM_PROPERTY, "true"); this.s3Client = new AmazonS3Client(new BasicAWSCredentials(accessKey, secretKey)); } diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/gcm/domain/Sender.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/gcm/domain/Sender.java index e9ba9e48b..9d2f008ce 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/gcm/domain/Sender.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/gcm/domain/Sender.java @@ -228,10 +228,9 @@ public class Sender { if (responseBody == null) { return null; } - JsonParser jsonParser = new JsonParser(); JsonObject jsonResponse; try { - jsonResponse = (JsonObject) jsonParser.parse(responseBody); + jsonResponse = JsonParser.parseString(responseBody).getAsJsonObject(); Result.Builder resultBuilder = new Result.Builder(); if (jsonResponse.has("results")) { // Handle response from message sent to specific device. @@ -480,10 +479,9 @@ public class Sender { return null; } - JsonParser parser = new JsonParser(); JsonObject jsonResponse; try { - jsonResponse = (JsonObject) parser.parse(responseBody); + jsonResponse = JsonParser.parseString(responseBody).getAsJsonObject(); int success = getNumber(responseMap, JSON_SUCCESS).intValue(); int failure = getNumber(responseMap, JSON_FAILURE).intValue(); int canonicalIds = getNumber(responseMap, JSON_CANONICAL_IDS) diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/hooks/processor/TwilioHookProcessor.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/hooks/processor/TwilioHookProcessor.java index 9c56480c2..dbabedfd0 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/hooks/processor/TwilioHookProcessor.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/hooks/processor/TwilioHookProcessor.java @@ -106,7 +106,7 @@ public class TwilioHookProcessor implements HookProcessor { return; } } else { - json = new JsonParser().parse(payload).getAsJsonObject(); + json = JsonParser.parseString(payload).getAsJsonObject(); } service.sendSmsBridgeRequest(entityName, actionName, tenantIdentifier, apiKey, json, callback); @@ -136,7 +136,7 @@ public class TwilioHookProcessor implements HookProcessor { jsonMap.put("mobileNo", mobileNo); jsonMap.put("message", compiledMessage); final String jsonString = new Gson().toJson(jsonMap); - json = new JsonParser().parse(jsonString).getAsJsonObject(); + json = JsonParser.parseString(jsonString).getAsJsonObject(); } } } catch (IOException e) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/hooks/processor/WebHookProcessor.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/hooks/processor/WebHookProcessor.java index 476f053c5..8d1c04f19 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/hooks/processor/WebHookProcessor.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/hooks/processor/WebHookProcessor.java @@ -78,7 +78,7 @@ public class WebHookProcessor implements HookProcessor { if (contentType.equalsIgnoreCase("json") || contentType.contains("json")) { - final JsonObject json = new JsonParser().parse(payload) + final JsonObject json = JsonParser.parseString(payload) .getAsJsonObject(); service.sendJsonRequest(entityName, actionName, tenantIdentifier, fineractEndpointUrl, json, callback); diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/domain/OTPRequestRepository.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/domain/OTPRequestRepository.java index 65eb042f9..3283fa0ec 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/domain/OTPRequestRepository.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/domain/OTPRequestRepository.java @@ -33,14 +33,14 @@ public class OTPRequestRepository { public OTPRequest getOTPRequestForUser(AppUser user) { - Assert.notNull(user); + Assert.notNull(user, "User must not be null"); return this.OTPrequests.get(user.getId()); } public void addOTPRequest(AppUser user, OTPRequest request) { - Assert.notNull(user); - Assert.notNull(request); + Assert.notNull(user, "User must not be null"); + Assert.notNull(request, "Request must not be null"); this.OTPrequests.put(user.getId(), request); } diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/provisioning/service/ProvisioningCategoryWritePlatformServiceJpaRepositoryImpl.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/provisioning/service/ProvisioningCategoryWritePlatformServiceJpaRepositoryImpl.java index 8b4b0cbc4..3543c1345 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/organisation/provisioning/service/ProvisioningCategoryWritePlatformServiceJpaRepositoryImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/provisioning/service/ProvisioningCategoryWritePlatformServiceJpaRepositoryImpl.java @@ -112,7 +112,7 @@ public class ProvisioningCategoryWritePlatformServiceJpaRepositoryImpl implement private boolean isAnyLoanProductsAssociateWithThisProvisioningCategory(final Long categoryID) { final String sql = "select if((exists (select 1 from m_loanproduct_provisioning_details lpd where lpd.category_id = ?)) = 1, 'true', 'false')"; final String isLoansUsingCharge = this.jdbcTemplate.queryForObject(sql, String.class, new Object[] { categoryID }); - return new Boolean(isLoansUsingCharge); + return Boolean.valueOf(isLoansUsingCharge); } /* * Guaranteed to throw an exception no matter what the data integrity issue diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/charge/service/ChargeWritePlatformServiceJpaRepositoryImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/charge/service/ChargeWritePlatformServiceJpaRepositoryImpl.java index 6df930034..0fc9f1a87 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/charge/service/ChargeWritePlatformServiceJpaRepositoryImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/charge/service/ChargeWritePlatformServiceJpaRepositoryImpl.java @@ -242,27 +242,27 @@ public class ChargeWritePlatformServiceJpaRepositoryImpl implements ChargeWriteP final String sql = "select if((exists (select 1 from m_loan_charge lc where lc.charge_id = ? and lc.is_active = 1)) = 1, 'true', 'false')"; final String isLoansUsingCharge = this.jdbcTemplate.queryForObject(sql, String.class, new Object[] { chargeId }); - return new Boolean(isLoansUsingCharge); + return Boolean.valueOf(isLoansUsingCharge); } private boolean isAnySavingsAssociateWithThisCharge(final Long chargeId) { final String sql = "select if((exists (select 1 from m_savings_account_charge sc where sc.charge_id = ? and sc.is_active = 1)) = 1, 'true', 'false')"; final String isSavingsUsingCharge = this.jdbcTemplate.queryForObject(sql, String.class, new Object[] { chargeId }); - return new Boolean(isSavingsUsingCharge); + return Boolean.valueOf(isSavingsUsingCharge); } private boolean isAnyLoanProductsAssociateWithThisCharge(final Long chargeId) { final String sql = "select if((exists (select 1 from m_product_loan_charge lc where lc.charge_id = ?)) = 1, 'true', 'false')"; final String isLoansUsingCharge = this.jdbcTemplate.queryForObject(sql, String.class, new Object[] { chargeId }); - return new Boolean(isLoansUsingCharge); + return Boolean.valueOf(isLoansUsingCharge); } private boolean isAnySavingsProductsAssociateWithThisCharge(final Long chargeId) { final String sql = "select if((exists (select 1 from m_savings_product_charge sc where sc.charge_id = ?)) = 1, 'true', 'false')"; final String isSavingsUsingCharge = this.jdbcTemplate.queryForObject(sql, String.class, new Object[] { chargeId }); - return new Boolean(isSavingsUsingCharge); + return Boolean.valueOf(isSavingsUsingCharge); } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/api/GroupsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/api/GroupsApiResource.java index b0a820dc9..607c8cad7 100755 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/api/GroupsApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/api/GroupsApiResource.java @@ -536,11 +536,11 @@ public class GroupsApiResource { List glimContainer = Collections.emptyList(); if(parentLoanAccountNo==null) { - glimContainer=(List)glimAccountInfoReadPlatformService.findGlimAccount(groupId); + glimContainer=(List)glimAccountInfoReadPlatformService.findGlimAccount(groupId); } else { - glimContainer=(List)glimAccountInfoReadPlatformService.findGlimAccountbyGroupAndAccount(groupId,parentLoanAccountNo); + glimContainer=(List)glimAccountInfoReadPlatformService.findGlimAccountbyGroupAndAccount(groupId,parentLoanAccountNo); } @@ -568,11 +568,11 @@ public class GroupsApiResource { } else if(parentGSIMAccountNo !=null && parentGSIMId==null ) { - gsimContainer= (List)this.gsimReadPlatformService.findGsimAccountContainerbyGsimAccountNumber(parentGSIMAccountNo); + gsimContainer= (List)this.gsimReadPlatformService.findGsimAccountContainerbyGsimAccountNumber(parentGSIMAccountNo); } else { - gsimContainer= (List)this.gsimReadPlatformService.findGSIMAccountContainerByGroupId(groupId); + gsimContainer= (List)this.gsimReadPlatformService.findGSIMAccountContainerByGroupId(groupId); } @@ -585,4 +585,4 @@ public class GroupsApiResource { } -} \ No newline at end of file +} diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/savings/api/SelfSavingsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/savings/api/SelfSavingsApiResource.java index 67ee06b13..ec583af4f 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/savings/api/SelfSavingsApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/savings/api/SelfSavingsApiResource.java @@ -174,10 +174,8 @@ public class SelfSavingsApiResource { @GET @Path("template") - @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - public String template(@QueryParam("clientId") final Long clientId, @QueryParam("productId") final Long productId, - final String apiRequestBodyAsJson, @Context final UriInfo uriInfo) { + public String template(@QueryParam("clientId") final Long clientId, @QueryParam("productId") final Long productId, @Context final UriInfo uriInfo) { validateAppuserClientsMapping(clientId); Long groupId = null; 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 0af747240..58575c53d 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 @@ -20,8 +20,8 @@ package org.apache.fineract.common; 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.assertThat; import static org.junit.Assert.fail; import io.restassured.RestAssured; 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 33017f9c7..1ec2a037b 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 @@ -27,7 +27,7 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mockito; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; @RunWith(MockitoJUnitRunner.class) public class ReadTaxonomyMappingServiceImplTest { 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 4f0a83ff3..98d4fabb2 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 @@ -38,11 +38,11 @@ import org.apache.fineract.mix.service.XBRLBuilder; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; +import org.mockito.ArgumentMatchers; import org.mockito.InjectMocks; -import org.mockito.Matchers; import org.mockito.Mock; import org.mockito.Mockito; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import org.w3c.dom.NodeList; import org.xml.sax.SAXException; @@ -58,7 +58,7 @@ public class XBRLBuilderTest { public void setUp() { this.readNamespaceService = Mockito.mock(NamespaceReadPlatformServiceImpl.class); - lenient().when(this.readNamespaceService.retrieveNamespaceByPrefix(Matchers.anyString())).thenReturn( + lenient().when(this.readNamespaceService.retrieveNamespaceByPrefix(ArgumentMatchers.anyString())).thenReturn( new NamespaceData(1l, "mockedprefix", "mockedurl")); } 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 cb9b18929..f43ed09a4 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 @@ -25,7 +25,7 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mockito; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; @RunWith(MockitoJUnitRunner.class) public class ListenerTest { 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 d60b585e2..b9436a685 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 @@ -41,7 +41,7 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import org.springframework.security.core.userdetails.User; @RunWith(MockitoJUnitRunner.class) 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 aab72caa6..e79fa5ccf 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 @@ -40,7 +40,7 @@ import org.apache.fineract.useradministration.domain.RoleRepository; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; @RunWith(MockitoJUnitRunner.class) public class TopicTest { 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 3d639cdc0..e5c731477 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 @@ -29,7 +29,7 @@ import org.joda.time.LocalDate; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; @SuppressWarnings("unused") @RunWith(MockitoJUnitRunner.class) @@ -222,4 +222,4 @@ public class AdhikarLoanRepaymentScheduleTransactionProcessorTest { // private String interestWaivedOf(final String value) { // return value; // } -} \ No newline at end of file +} 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 e20d78354..c0e6f7b2f 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 @@ -29,7 +29,7 @@ import org.joda.time.LocalDate; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; @SuppressWarnings("unused") @RunWith(MockitoJUnitRunner.class) @@ -626,4 +626,4 @@ public class HeavensFamilyLoanRepaymentScheduleTransactionProcessorTest { // private String interestWaivedOf(final String value) { // return value; // } -} \ No newline at end of file +} 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 68f31e507..87767fbcc 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 @@ -125,7 +125,7 @@ public class TemplateMergeServiceTest { protected Map createMapFromJSON(String jsonText) { Gson gson = new Gson(); Type ssMap = new TypeToken>(){}.getType(); - JsonElement json = new JsonParser().parse(jsonText); + JsonElement json = JsonParser.parseString(jsonText); return gson.fromJson(json, ssMap); } }