FINERACT-846: Migrating to Java 11, upgrading dependencies, fixing compiler warnings

This commit is contained in:
Petri Tuomola
2020-05-07 22:28:19 +02:00
committed by Michael Vorburger ⛑️
parent 7ace5d47b2
commit 0e4aeef1af
61 changed files with 530 additions and 518 deletions
+1 -1
View File
@@ -22,7 +22,7 @@ dist: trusty
language: java language: java
jdk: jdk:
- openjdk8 - openjdk12
services: services:
- mysql - mysql
+1 -4
View File
@@ -15,7 +15,7 @@
# specific language governing permissions and limitations # specific language governing permissions and limitations
# under the License. # 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 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/ 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 FROM bitnami/tomcat:9.0 as fineract
ENV JAVA_HOME /usr/local/openjdk-8/jre
USER root USER root
RUN apt-get update -qq && apt-get install -y wget 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 /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" 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 COPY ./docker/server.xml /opt/bitnami/tomcat/conf
+1 -1
View File
@@ -18,7 +18,7 @@ If you are interested in contributing to this project, but perhaps don't quite k
Requirements Requirements
============ ============
* Java >= 1.8 (Oracle JVMs have been tested) * Java >= 11 (Oracle JVMs have been tested)
* MySQL 5.5 * 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. * Tomcat 9, if deploying to a separate servlet container. Until FINERACT-730, Tomcat 7/8 were also supported, but now Tomcat 9 is required.
+23 -4
View File
@@ -21,6 +21,8 @@ Run as:
gradle clean bootRun''' gradle clean bootRun'''
project.ext.jerseyVersion = '1.19.4' project.ext.jerseyVersion = '1.19.4'
ext["groovy.version"] = '3.0.3'
buildscript { buildscript {
ext { ext {
@@ -103,12 +105,17 @@ dependencyManagement {
dependency 'io.swagger:swagger-jersey-jaxrs:1.5.15' dependency 'io.swagger:swagger-jersey-jaxrs:1.5.15'
dependency 'jakarta.management.j2ee:jakarta.management.j2ee-api:1.1.4' dependency 'jakarta.management.j2ee:jakarta.management.j2ee-api:1.1.4'
dependency 'jakarta.jms:jakarta.jms-api:2.0.3' 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.activemq:activemq-broker:+'
dependency 'org.apache.bval:org.apache.bval.bundle:2.0.2' dependency 'org.apache.bval:org.apache.bval.bundle:2.0.2'
dependency 'junit:junit:+' dependency 'junit:junit:+'
dependency 'org.mockito:mockito-core:+' 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 '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) { dependencySet(group: 'com.sun.jersey', version: jerseyVersion) {
entry 'jersey-core' entry 'jersey-core'
@@ -120,18 +127,24 @@ dependencyManagement {
entry 'jersey-spring' entry 'jersey-spring'
entry 'jersey-multipart' entry 'jersey-multipart'
} }
dependencySet(group: 'org.apache.poi', version: '3.9') { dependencySet(group: 'org.apache.poi', version: '4.1.2') {
entry 'poi' entry 'poi'
entry 'poi-ooxml' entry 'poi-ooxml'
entry 'poi-ooxml-schemas' 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 */ /* define the valid syntax level for source files */
sourceCompatibility = JavaVersion.VERSION_1_8 sourceCompatibility = JavaVersion.VERSION_11
/* define binary compatibility version */ /* define binary compatibility version */
targetCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_11
project.ext.mysqlUser='root' project.ext.mysqlUser='root'
project.ext.mysqlPassword='mysql' project.ext.mysqlPassword='mysql'
@@ -270,6 +283,12 @@ configurations {
runtime runtime
all*.exclude module: 'jul-to-slf4j' // see FINERACT-700 re. ClassCircularityError: java/util/logging/LogRecord 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 */ /* Pick up dependencies based on the environemnt, defaults to production */
if (project.hasProperty('env') && project.getProperty('env') == 'dev') { if (project.hasProperty('env') && project.getProperty('env') == 'dev') {
apply from: 'dev-dependencies.gradle' apply from: 'dev-dependencies.gradle'
+11 -5
View File
@@ -83,6 +83,7 @@ dependencies {
'org.apache.poi:poi', 'org.apache.poi:poi',
'org.apache.poi:poi-ooxml', 'org.apache.poi:poi-ooxml',
'org.apache.poi:poi-ooxml-schemas', 'org.apache.poi:poi-ooxml-schemas',
'dom4j:dom4j',
'com.lowagie:itext', '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 // 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.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') { implementation ('io.swagger:swagger-jersey-jaxrs') {
exclude group: 'javax.validation' exclude group: 'javax.validation'
@@ -106,8 +110,9 @@ dependencies {
} }
testCompile 'junit:junit', testCompile 'junit:junit',
'xerces:xercesImpl',
'org.mockito:mockito-core', 'org.mockito:mockito-core',
'io.github.classgraph:classgraph:4.8.43', 'io.github.classgraph:classgraph',
'com.google.code.gson:gson', 'com.google.code.gson:gson',
'org.springframework:spring-jms', 'org.springframework:spring-jms',
'joda-time:joda-time', 'joda-time:joda-time',
@@ -115,13 +120,14 @@ dependencies {
'org.apache.poi:poi-ooxml', 'org.apache.poi:poi-ooxml',
'org.springframework:spring-context-support', 'org.springframework:spring-context-support',
'com.sun.jersey:jersey-core' 'com.sun.jersey:jersey-core'
testCompile ('com.mockrunner:mockrunner-jms') {
exclude group: 'regexp'
}
testCompile ('io.rest-assured:rest-assured') { testCompile ('io.rest-assured:rest-assured') {
exclude group: 'commons-logging' exclude group: 'commons-logging'
exclude group: 'org.apache.sling' exclude group: 'org.apache.sling'
} }
testCompile ('com.mockrunner:mockrunner-jms') {
exclude group: 'regexp'
}
testCompile ('org.springframework.boot:spring-boot-starter-test') { testCompile ('org.springframework.boot:spring-boot-starter-test') {
exclude group: 'com.jayway.jsonpath', module: 'json-path' exclude group: 'com.jayway.jsonpath', module: 'json-path'
} }
@@ -77,8 +77,8 @@ public class AccountTransferTest {
private AccountHelper accountHelper; private AccountHelper accountHelper;
private JournalEntryHelper journalEntryHelper; private JournalEntryHelper journalEntryHelper;
Float TRANSFER_AMOUNT = new Float(ACCOUNT_TRANSFER_AMOUNT); Float TRANSFER_AMOUNT = Float.valueOf(ACCOUNT_TRANSFER_AMOUNT);
Float TRANSFER_AMOUNT_ADJUST = new Float(ACCOUNT_TRANSFER_AMOUNT_ADJUST); Float TRANSFER_AMOUNT_ADJUST = Float.valueOf(ACCOUNT_TRANSFER_AMOUNT_ADJUST);
private FinancialActivityAccountHelper financialActivityAccountHelper; private FinancialActivityAccountHelper financialActivityAccountHelper;
private Integer financialActivityAccountId; private Integer financialActivityAccountId;
@@ -195,14 +195,14 @@ public class AccountTransferTest {
final HashMap fromSavingsSummaryBefore = this.savingsAccountHelper.getSavingsSummary(fromSavingsID); final HashMap fromSavingsSummaryBefore = this.savingsAccountHelper.getSavingsSummary(fromSavingsID);
Float fromSavingsBalance = new Float(MINIMUM_OPENING_BALANCE); Float fromSavingsBalance = Float.valueOf(MINIMUM_OPENING_BALANCE);
Float toSavingsBalance = new Float(MINIMUM_OPENING_BALANCE); Float toSavingsBalance = Float.valueOf(MINIMUM_OPENING_BALANCE);
this.accountTransferHelper.accountTransfer(fromClientID, fromSavingsID, fromClientID, toSavingsID, FROM_SAVINGS_ACCOUNT_TYPE, this.accountTransferHelper.accountTransfer(fromClientID, fromSavingsID, fromClientID, toSavingsID, FROM_SAVINGS_ACCOUNT_TYPE,
TO_SAVINGS_ACCOUNT_TYPE, ACCOUNT_TRANSFER_AMOUNT); TO_SAVINGS_ACCOUNT_TYPE, ACCOUNT_TRANSFER_AMOUNT);
fromSavingsBalance -= new Float(ACCOUNT_TRANSFER_AMOUNT); fromSavingsBalance -= Float.valueOf(ACCOUNT_TRANSFER_AMOUNT);
toSavingsBalance += new Float(ACCOUNT_TRANSFER_AMOUNT); toSavingsBalance += Float.valueOf(ACCOUNT_TRANSFER_AMOUNT);
HashMap fromSavingsSummaryAfter = this.savingsAccountHelper.getSavingsSummary(fromSavingsID); HashMap fromSavingsSummaryAfter = this.savingsAccountHelper.getSavingsSummary(fromSavingsID);
assertEquals("Verifying From Savings Account Balance after Account Transfer", fromSavingsBalance, assertEquals("Verifying From Savings Account Balance after Account Transfer", fromSavingsBalance,
@@ -211,9 +211,9 @@ public class AccountTransferTest {
HashMap toSavingsSummaryAfter = this.savingsAccountHelper.getSavingsSummary(toSavingsID); HashMap toSavingsSummaryAfter = this.savingsAccountHelper.getSavingsSummary(toSavingsID);
assertEquals("Verifying To Savings Account Balance after Account Transfer", toSavingsBalance, assertEquals("Verifying To Savings Account Balance after Account Transfer", toSavingsBalance,
toSavingsSummaryAfter.get("accountBalance")); 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) }; 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) }; JournalEntry.TransactionType.DEBIT) };
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(fromOfficeId, liabilityTransferAccount, this.journalEntryHelper.checkJournalEntryForLiabilityAccount(fromOfficeId, liabilityTransferAccount,
@@ -293,7 +293,7 @@ public class AccountTransferTest {
final HashMap fromSavingsSummaryBefore = this.savingsAccountHelper.getSavingsSummary(fromSavingsID); 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, this.accountTransferHelper.accountTransfer(fromClientID, fromSavingsID, toClientID, toLoanID, FROM_SAVINGS_ACCOUNT_TYPE,
TO_LOAN_ACCOUNT_TYPE, ACCOUNT_TRANSFER_AMOUNT_ADJUST); 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, assertEquals("Verifying To Loan Repayment Amount after Account Transfer", TRANSFER_AMOUNT_ADJUST,
toLoanSummaryAfter.get("totalRepayment")); 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) }; 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) }; JournalEntry.TransactionType.DEBIT) };
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(fromOfficeId, liabilityTransferAccount, this.journalEntryHelper.checkJournalEntryForLiabilityAccount(fromOfficeId, liabilityTransferAccount,
@@ -403,7 +403,7 @@ public class AccountTransferTest {
final HashMap toSavingsSummaryBefore = this.savingsAccountHelper.getSavingsSummary(toSavingsID); 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, this.accountTransferHelper.accountTransfer(fromClientID, fromSavingsID, fromClientID, loanID, FROM_SAVINGS_ACCOUNT_TYPE,
TO_LOAN_ACCOUNT_TYPE, ACCOUNT_TRANSFER_AMOUNT); TO_LOAN_ACCOUNT_TYPE, ACCOUNT_TRANSFER_AMOUNT);
@@ -416,7 +416,7 @@ public class AccountTransferTest {
assertEquals("Verifying From Savings Account Balance after Account Transfer", fromSavingsBalance, assertEquals("Verifying From Savings Account Balance after Account Transfer", fromSavingsBalance,
fromSavingsSummaryAfter.get("accountBalance")); 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, this.accountTransferHelper.accountTransfer(fromClientID, loanID, toClientID, toSavingsID, FROM_LOAN_ACCOUNT_TYPE,
TO_SAVINGS_ACCOUNT_TYPE, ACCOUNT_TRANSFER_AMOUNT_ADJUST); 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, assertEquals("Verifying From Savings Account Balance after Account Transfer", toSavingsBalance,
toSavingsSummaryAfter.get("accountBalance")); 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) }; 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) }; JournalEntry.TransactionType.DEBIT) };
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(fromOfficeId, liabilityTransferAccount, this.journalEntryHelper.checkJournalEntryForLiabilityAccount(fromOfficeId, liabilityTransferAccount,
@@ -88,10 +88,10 @@ public class AccountingScenarioIntegrationTest {
public static final String WITHDRAWAL_AMOUNT = "3000"; public static final String WITHDRAWAL_AMOUNT = "3000";
public static final String WITHDRAWAL_AMOUNT_ADJUSTED = "2000"; public static final String WITHDRAWAL_AMOUNT_ADJUSTED = "2000";
Float SP_BALANCE = new Float(MINIMUM_OPENING_BALANCE); Float SP_BALANCE = Float.valueOf(MINIMUM_OPENING_BALANCE);
Float SP_DEPOSIT_AMOUNT = new Float(DEPOSIT_AMOUNT); Float SP_DEPOSIT_AMOUNT = Float.valueOf(DEPOSIT_AMOUNT);
Float SP_WITHDRAWAL_AMOUNT = new Float(WITHDRAWAL_AMOUNT); Float SP_WITHDRAWAL_AMOUNT = Float.valueOf(WITHDRAWAL_AMOUNT);
Float SP_WITHDRAWAL_AMOUNT_ADJUSTED = new Float(WITHDRAWAL_AMOUNT_ADJUSTED); 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 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 }; 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"); float totalInterest = (float) loanSchedule.get(1).get("interestOriginalDue");
DecimalFormat numberFormat = new DecimalFormat("#.00", new DecimalFormatSymbols(Locale.US)); DecimalFormat numberFormat = new DecimalFormat("#.00", new DecimalFormatSymbols(Locale.US));
float INTEREST_4_DAYS = totalInterest / totalDaysInPeriod * 4; 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, this.loanTransactionHelper.checkAccrualTransactionForRepayment(getDateAsLocalDate(currentDate), INTEREST_4_DAYS, FEE_PORTION,
PENALTY_PORTION, loanID); PENALTY_PORTION, loanID);
@@ -931,7 +931,7 @@ public class AccountingScenarioIntegrationTest {
float totalInterest = (float) loanSchedule.get(1).get("interestOriginalDue"); float totalInterest = (float) loanSchedule.get(1).get("interestOriginalDue");
DecimalFormat numberFormat = new DecimalFormat("#.00", new DecimalFormatSymbols(Locale.US)); DecimalFormat numberFormat = new DecimalFormat("#.00", new DecimalFormatSymbols(Locale.US));
float INTEREST_3_DAYS = totalInterest / totalDaysInPeriod * 3; 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, this.loanTransactionHelper.checkAccrualTransactionForRepayment(getDateAsLocalDate(runOndate), INTEREST_3_DAYS, FEE_PORTION,
PENALTY_PORTION, loanID); PENALTY_PORTION, loanID);
@@ -939,7 +939,7 @@ public class AccountingScenarioIntegrationTest {
this.periodicAccrualAccountingHelper.runPeriodicAccrualAccounting(runOndate); this.periodicAccrualAccountingHelper.runPeriodicAccrualAccounting(runOndate);
float interestPerDay = (totalInterest / totalDaysInPeriod * 4) - INTEREST_3_DAYS; 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, this.loanTransactionHelper.checkAccrualTransactionForRepayment(getDateAsLocalDate(runOndate), interestPerDay, NEXT_FEE_PORTION,
NEXT_PENALTY_PORTION, loanID); NEXT_PENALTY_PORTION, loanID);
@@ -721,7 +721,7 @@ public class ClientLoanIntegrationTest {
LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap); LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
HashMap summary = savingsAccountHelper.getSavingsSummary(savingsId); 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")); assertEquals("Verifying opening Balance", balance, summary.get("accountBalance"));
// DISBURSE // DISBURSE
@@ -730,7 +730,7 @@ public class ClientLoanIntegrationTest {
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap); LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
summary = savingsAccountHelper.getSavingsSummary(savingsId); 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")); assertEquals("Verifying opening Balance", balance, summary.get("accountBalance"));
loanStatusHashMap = this.loanTransactionHelper.undoDisbursal(loanID); loanStatusHashMap = this.loanTransactionHelper.undoDisbursal(loanID);
@@ -738,7 +738,7 @@ public class ClientLoanIntegrationTest {
LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap); LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
summary = savingsAccountHelper.getSavingsSummary(savingsId); summary = savingsAccountHelper.getSavingsSummary(savingsId);
balance = new Float(MINIMUM_OPENING_BALANCE); balance = Float.valueOf(MINIMUM_OPENING_BALANCE);
assertEquals("Verifying opening Balance", balance, summary.get("accountBalance")); assertEquals("Verifying opening Balance", balance, summary.get("accountBalance"));
} }
@@ -810,7 +810,7 @@ public class ClientLoanIntegrationTest {
LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap); LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
HashMap summary = savingsAccountHelper.getSavingsSummary(savingsId); 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")); assertEquals("Verifying opening Balance", balance, summary.get("accountBalance"));
// DISBURSE first Tranche // DISBURSE first Tranche
@@ -819,7 +819,7 @@ public class ClientLoanIntegrationTest {
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap); LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
summary = savingsAccountHelper.getSavingsSummary(savingsId); 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")); assertEquals("Verifying opening Balance", balance, summary.get("accountBalance"));
// DISBURSE Second Tranche // DISBURSE Second Tranche
@@ -828,7 +828,7 @@ public class ClientLoanIntegrationTest {
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap); LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
summary = savingsAccountHelper.getSavingsSummary(savingsId); 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")); assertEquals("Verifying opening Balance", balance, summary.get("accountBalance"));
loanStatusHashMap = this.loanTransactionHelper.undoDisbursal(loanID); loanStatusHashMap = this.loanTransactionHelper.undoDisbursal(loanID);
@@ -836,7 +836,7 @@ public class ClientLoanIntegrationTest {
LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap); LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
summary = savingsAccountHelper.getSavingsSummary(savingsId); summary = savingsAccountHelper.getSavingsSummary(savingsId);
balance = new Float(MINIMUM_OPENING_BALANCE); balance = Float.valueOf(MINIMUM_OPENING_BALANCE);
assertEquals("Verifying opening Balance", balance, summary.get("accountBalance")); assertEquals("Verifying opening Balance", balance, summary.get("accountBalance"));
} }
@@ -844,37 +844,37 @@ public class ClientLoanIntegrationTest {
private void validateCharge(Integer amountPercentage, final List<HashMap> loanCharges, final String amount, final String outstanding, private void validateCharge(Integer amountPercentage, final List<HashMap> loanCharges, final String amount, final String outstanding,
String amountPaid, String amountWaived) { String amountPaid, String amountWaived) {
HashMap chargeDetail = getloanCharge(amountPercentage, loanCharges); HashMap chargeDetail = getloanCharge(amountPercentage, loanCharges);
Assert.assertTrue(new Float(amount).compareTo(new Float(String.valueOf(chargeDetail.get("amountOrPercentage")))) == 0); Assert.assertTrue(Float.valueOf(amount).compareTo(Float.valueOf(String.valueOf(chargeDetail.get("amountOrPercentage")))) == 0);
Assert.assertTrue(new Float(outstanding).compareTo(new Float(String.valueOf(chargeDetail.get("amountOutstanding")))) == 0); Assert.assertTrue(Float.valueOf(outstanding).compareTo(Float.valueOf(String.valueOf(chargeDetail.get("amountOutstanding")))) == 0);
Assert.assertTrue(new Float(amountPaid).compareTo(new Float(String.valueOf(chargeDetail.get("amountPaid")))) == 0); Assert.assertTrue(Float.valueOf(amountPaid).compareTo(Float.valueOf(String.valueOf(chargeDetail.get("amountPaid")))) == 0);
Assert.assertTrue(new Float(amountWaived).compareTo(new Float(String.valueOf(chargeDetail.get("amountWaived")))) == 0); Assert.assertTrue(Float.valueOf(amountWaived).compareTo(Float.valueOf(String.valueOf(chargeDetail.get("amountWaived")))) == 0);
} }
private void validateChargeExcludePrecission(Integer amountPercentage, final List<HashMap> loanCharges, final String amount, private void validateChargeExcludePrecission(Integer amountPercentage, final List<HashMap> loanCharges, final String amount,
final String outstanding, String amountPaid, String amountWaived) { final String outstanding, String amountPaid, String amountWaived) {
DecimalFormat twoDForm = new DecimalFormat("#"); DecimalFormat twoDForm = new DecimalFormat("#");
HashMap chargeDetail = getloanCharge(amountPercentage, loanCharges); 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); .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); .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); .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); .valueOf(chargeDetail.get("amountWaived")))))) == 0);
} }
public void validateNumberForEqual(String val, String val2) { 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) { 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) { public void validateNumberForEqualExcludePrecission(String val, String val2) {
DecimalFormat twoDForm = new DecimalFormat("#"); 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) { 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) assertEquals("Checking for Due Date for 1st Month", new ArrayList<>(Arrays.asList(2011, 10, 20)), loanSchedule.get(1)
.get("dueDate")); .get("dueDate"));
assertEquals("Checking for Principal Due for 1st Month", new Float("2911.49"), loanSchedule.get(1).get("principalOriginalDue")); 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", new Float("240.00"), loanSchedule.get(1).get("interestOriginalDue")); 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) assertEquals("Checking for Due Date for 2nd Month", new ArrayList<>(Arrays.asList(2011, 11, 20)), loanSchedule.get(2)
.get("dueDate")); .get("dueDate"));
assertEquals("Checking for Principal Due for 2nd Month", new Float("2969.72"), loanSchedule.get(2).get("principalDue")); 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", new Float("181.77"), loanSchedule.get(2).get("interestOriginalDue")); 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) assertEquals("Checking for Due Date for 3rd Month", new ArrayList<>(Arrays.asList(2011, 12, 20)), loanSchedule.get(3)
.get("dueDate")); .get("dueDate"));
assertEquals("Checking for Principal Due for 3rd Month", new Float("3029.11"), loanSchedule.get(3).get("principalDue")); 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", new Float("122.38"), loanSchedule.get(3).get("interestOriginalDue")); 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 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 Principal Due for 4th Month", Float.valueOf("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 Interest Due for 4th Month", Float.valueOf("61.79"), loanSchedule.get(4).get("interestOriginalDue"));
} }
private void verifyLoanRepaymentScheduleForEqualPrincipal(final ArrayList<HashMap> loanSchedule) { private void verifyLoanRepaymentScheduleForEqualPrincipal(final ArrayList<HashMap> loanSchedule) {
System.out.println("--------------------VERIFYING THE PRINCIPAL DUES,INTEREST DUE AND DUE DATE--------------------------"); 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 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 Principal Due for 1st Month", Float.valueOf("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 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 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 Principal Due for 2nd Month", Float.valueOf("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 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 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 Principal Due for 3rd Month", Float.valueOf("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 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 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 Principal Due for 4th Month", Float.valueOf("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 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 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 Principal Due for 5th Month", Float.valueOf("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 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 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 Principal Due for 6th Month", Float.valueOf("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 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) assertEquals("Checking for Due Date for 10th Month", new ArrayList<>(Arrays.asList(2015, 4, 2)), loanSchedule.get(10)
.get("dueDate")); .get("dueDate"));
assertEquals("Checking for Principal Due for 10th Month", new Float("416700"), loanSchedule.get(10).get("principalDue")); assertEquals("Checking for Principal Due for 10th Month", Float.valueOf("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 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) assertEquals("Checking for Due Date for 20th Month", new ArrayList<>(Arrays.asList(2016, 2, 2)), loanSchedule.get(20)
.get("dueDate")); .get("dueDate"));
assertEquals("Checking for Principal Due for 20th Month", new Float("416700"), loanSchedule.get(20).get("principalDue")); assertEquals("Checking for Principal Due for 20th Month", Float.valueOf("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 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) assertEquals("Checking for Due Date for 24th Month", new ArrayList<>(Arrays.asList(2016, 6, 2)), loanSchedule.get(24)
.get("dueDate")); .get("dueDate"));
assertEquals("Checking for Principal Due for 24th Month", new Float("415900"), loanSchedule.get(24).get("principalDue")); assertEquals("Checking for Principal Due for 24th Month", Float.valueOf("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 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")); 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", validateNumberForEqualWithMsg("Checking for Principal Due for 1st Month", "0.0",
String.valueOf(loanSchedule.get(1).get("principalOriginalDue"))); 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")); 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", validateNumberForEqualWithMsg("Checking for Principal Due for 2nd Month", "0.0",
String.valueOf(loanSchedule.get(2).get("principalOriginalDue"))); 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")); 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", validateNumberForEqualWithMsg("Checking for Principal Due for 3rd Month", "0.0",
String.valueOf(loanSchedule.get(3).get("principalDue"))); 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")); 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", validateNumberForEqualWithMsg("Checking for Principal Due for 4th Month", "0",
String.valueOf(loanSchedule.get(4).get("principalDue"))); 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")); 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", validateNumberForEqualWithMsg("Checking for Principal Due for 5th Month", "0",
String.valueOf(loanSchedule.get(5).get("principalDue"))); 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 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 Principal Due for 6th Month", Float.valueOf("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 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 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 Principal Due for 7th Month", Float.valueOf("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 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) assertEquals("Checking for Due Date for 10th Month", new ArrayList<>(Arrays.asList(2015, 4, 2)), loanSchedule.get(10)
.get("dueDate")); .get("dueDate"));
assertEquals("Checking for Principal Due for 10th Month", new Float("526300"), loanSchedule.get(10).get("principalDue")); assertEquals("Checking for Principal Due for 10th Month", Float.valueOf("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 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) assertEquals("Checking for Due Date for 20th Month", new ArrayList<>(Arrays.asList(2016, 2, 2)), loanSchedule.get(20)
.get("dueDate")); .get("dueDate"));
assertEquals("Checking for Principal Due for 20th Month", new Float("526300"), loanSchedule.get(20).get("principalDue")); assertEquals("Checking for Principal Due for 20th Month", Float.valueOf("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 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) assertEquals("Checking for Due Date for 24th Month", new ArrayList<>(Arrays.asList(2016, 6, 2)), loanSchedule.get(24)
.get("dueDate")); .get("dueDate"));
assertEquals("Checking for Principal Due for 24th Month", new Float("526600"), loanSchedule.get(24).get("principalDue")); assertEquals("Checking for Principal Due for 24th Month", Float.valueOf("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 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"); addRepaymentValues(expectedvalues, todaysDate, 1, false, "2517.29", "11.62", "0.0", "0.0");
verifyLoanRepaymentSchedule(loanSchedule, expectedvalues); verifyLoanRepaymentSchedule(loanSchedule, expectedvalues);
Float earlyPayment = new Float("4000"); Float earlyPayment = Float.valueOf("4000");
todaysDate = Calendar.getInstance(Utils.getTimeZoneOfTenant()); todaysDate = Calendar.getInstance(Utils.getTimeZoneOfTenant());
todaysDate.add(Calendar.DAY_OF_MONTH, -5); todaysDate.add(Calendar.DAY_OF_MONTH, -5);
final String LOAN_SECOND_REPAYMENT_DATE = dateFormat.format(todaysDate.getTime()); 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); validateNumberForEqualWithMsg("verify pre-close amount", "3551.93", prepayAmount);
todaysDate = Calendar.getInstance(Utils.getTimeZoneOfTenant()); todaysDate = Calendar.getInstance(Utils.getTimeZoneOfTenant());
String LOAN_REPAYMENT_DATE = dateFormat.format(todaysDate.getTime()); 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); loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
LoanStatusChecker.verifyLoanAccountIsClosed(loanStatusHashMap); LoanStatusChecker.verifyLoanAccountIsClosed(loanStatusHashMap);
} }
@@ -3322,7 +3322,7 @@ public class ClientLoanIntegrationTest {
validateNumberForEqualWithMsg("verify pre-close amount", preCloseAmount, prepayAmount); validateNumberForEqualWithMsg("verify pre-close amount", preCloseAmount, prepayAmount);
todaysDate = Calendar.getInstance(Utils.getTimeZoneOfTenant()); todaysDate = Calendar.getInstance(Utils.getTimeZoneOfTenant());
String LOAN_REPAYMENT_DATE = dateFormat.format(todaysDate.getTime()); 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); loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
LoanStatusChecker.verifyLoanAccountIsClosed(loanStatusHashMap); LoanStatusChecker.verifyLoanAccountIsClosed(loanStatusHashMap);
} }
@@ -3400,7 +3400,7 @@ public class ClientLoanIntegrationTest {
addRepaymentValues(expectedvalues, todaysDate, 1, false, "2517.29", "11.62", "1.16", "0.0"); addRepaymentValues(expectedvalues, todaysDate, 1, false, "2517.29", "11.62", "1.16", "0.0");
verifyLoanRepaymentSchedule(loanSchedule, expectedvalues); verifyLoanRepaymentSchedule(loanSchedule, expectedvalues);
Float earlyPayment = new Float("4000"); Float earlyPayment = Float.valueOf("4000");
todaysDate = Calendar.getInstance(Utils.getTimeZoneOfTenant()); todaysDate = Calendar.getInstance(Utils.getTimeZoneOfTenant());
todaysDate.add(Calendar.DAY_OF_MONTH, -5); todaysDate.add(Calendar.DAY_OF_MONTH, -5);
final String LOAN_SECOND_REPAYMENT_DATE = dateFormat.format(todaysDate.getTime()); final String LOAN_SECOND_REPAYMENT_DATE = dateFormat.format(todaysDate.getTime());
@@ -3418,7 +3418,7 @@ public class ClientLoanIntegrationTest {
String prepayAmount = String.valueOf(prepayDetail.get("amount")); String prepayAmount = String.valueOf(prepayDetail.get("amount"));
todaysDate = Calendar.getInstance(Utils.getTimeZoneOfTenant()); todaysDate = Calendar.getInstance(Utils.getTimeZoneOfTenant());
String LOAN_REPAYMENT_DATE = dateFormat.format(todaysDate.getTime()); 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); loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
LoanStatusChecker.verifyLoanAccountIsClosed(loanStatusHashMap); LoanStatusChecker.verifyLoanAccountIsClosed(loanStatusHashMap);
} }
@@ -3505,7 +3505,7 @@ public class ClientLoanIntegrationTest {
addRepaymentValues(expectedvalues, todaysDate, 1, false, "2517.29", "11.62", "0.0", "0.0"); addRepaymentValues(expectedvalues, todaysDate, 1, false, "2517.29", "11.62", "0.0", "0.0");
verifyLoanRepaymentSchedule(loanSchedule, expectedvalues); verifyLoanRepaymentSchedule(loanSchedule, expectedvalues);
Float earlyPayment = new Float("4000"); Float earlyPayment = Float.valueOf("4000");
todaysDate = Calendar.getInstance(Utils.getTimeZoneOfTenant()); todaysDate = Calendar.getInstance(Utils.getTimeZoneOfTenant());
todaysDate.add(Calendar.DAY_OF_MONTH, -5); todaysDate.add(Calendar.DAY_OF_MONTH, -5);
final String LOAN_SECOND_REPAYMENT_DATE = dateFormat.format(todaysDate.getTime()); final String LOAN_SECOND_REPAYMENT_DATE = dateFormat.format(todaysDate.getTime());
@@ -3530,7 +3530,7 @@ public class ClientLoanIntegrationTest {
String prepayAmount = String.valueOf(prepayDetail.get("amount")); String prepayAmount = String.valueOf(prepayDetail.get("amount"));
todaysDate = Calendar.getInstance(Utils.getTimeZoneOfTenant()); todaysDate = Calendar.getInstance(Utils.getTimeZoneOfTenant());
String LOAN_REPAYMENT_DATE = dateFormat.format(todaysDate.getTime()); 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); loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
LoanStatusChecker.verifyLoanAccountIsClosed(loanStatusHashMap); LoanStatusChecker.verifyLoanAccountIsClosed(loanStatusHashMap);
@@ -3628,7 +3628,7 @@ public class ClientLoanIntegrationTest {
addRepaymentValues(expectedvalues, todaysDate, 1, false, "2517.29", "11.62", "0.0", "0.0"); addRepaymentValues(expectedvalues, todaysDate, 1, false, "2517.29", "11.62", "0.0", "0.0");
verifyLoanRepaymentSchedule(loanSchedule, expectedvalues); verifyLoanRepaymentSchedule(loanSchedule, expectedvalues);
Float earlyPayment = new Float("5100"); Float earlyPayment = Float.valueOf("5100");
repaymentDate = Calendar.getInstance(Utils.getTimeZoneOfTenant()); repaymentDate = Calendar.getInstance(Utils.getTimeZoneOfTenant());
repaymentDate.add(Calendar.DAY_OF_MONTH, -5); repaymentDate.add(Calendar.DAY_OF_MONTH, -5);
final String LOAN_SECOND_REPAYMENT_DATE = dateFormat.format(repaymentDate.getTime()); final String LOAN_SECOND_REPAYMENT_DATE = dateFormat.format(repaymentDate.getTime());
@@ -3647,7 +3647,7 @@ public class ClientLoanIntegrationTest {
String prepayAmount = String.valueOf(prepayDetail.get("amount")); String prepayAmount = String.valueOf(prepayDetail.get("amount"));
todaysDate = Calendar.getInstance(Utils.getTimeZoneOfTenant()); todaysDate = Calendar.getInstance(Utils.getTimeZoneOfTenant());
String LOAN_REPAYMENT_DATE = dateFormat.format(todaysDate.getTime()); 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); loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
LoanStatusChecker.verifyLoanAccountIsClosed(loanStatusHashMap); LoanStatusChecker.verifyLoanAccountIsClosed(loanStatusHashMap);
@@ -3765,7 +3765,7 @@ public class ClientLoanIntegrationTest {
validateNumberForEqualWithMsg("verify pre-close amount", preCloseAmount, prepayAmount); validateNumberForEqualWithMsg("verify pre-close amount", preCloseAmount, prepayAmount);
todaysDate = Calendar.getInstance(Utils.getTimeZoneOfTenant()); todaysDate = Calendar.getInstance(Utils.getTimeZoneOfTenant());
String LOAN_REPAYMENT_DATE = dateFormat.format(todaysDate.getTime()); 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); loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
LoanStatusChecker.verifyLoanAccountIsClosed(loanStatusHashMap); LoanStatusChecker.verifyLoanAccountIsClosed(loanStatusHashMap);
} }
@@ -3857,7 +3857,7 @@ public class ClientLoanIntegrationTest {
repaymentDate.add(Calendar.DAY_OF_MONTH, -7 * 2); repaymentDate.add(Calendar.DAY_OF_MONTH, -7 * 2);
final String LOAN_FIRST_REPAYMENT_DATE = dateFormat.format(repaymentDate.getTime()); final String LOAN_FIRST_REPAYMENT_DATE = dateFormat.format(repaymentDate.getTime());
Float totalDueForCurrentPeriod = (Float) loanSchedule.get(1).get("totalDueForPeriod"); 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); this.loanTransactionHelper.makeRepayment(LOAN_FIRST_REPAYMENT_DATE, totalDueForCurrentPeriod, loanID);
loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID); loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID);
@@ -3983,7 +3983,7 @@ public class ClientLoanIntegrationTest {
String prepayAmount = String.valueOf(prepayDetail.get("amount")); String prepayAmount = String.valueOf(prepayDetail.get("amount"));
todaysDate = Calendar.getInstance(Utils.getTimeZoneOfTenant()); todaysDate = Calendar.getInstance(Utils.getTimeZoneOfTenant());
String LOAN_REPAYMENT_DATE = dateFormat.format(todaysDate.getTime()); 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); loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
LoanStatusChecker.verifyLoanAccountIsClosed(loanStatusHashMap); LoanStatusChecker.verifyLoanAccountIsClosed(loanStatusHashMap);
@@ -4225,7 +4225,7 @@ public class ClientLoanIntegrationTest {
validateNumberForEqualWithMsg("verify pre-close amount", preCloseAmount, prepayAmount); validateNumberForEqualWithMsg("verify pre-close amount", preCloseAmount, prepayAmount);
todaysDate = Calendar.getInstance(Utils.getTimeZoneOfTenant()); todaysDate = Calendar.getInstance(Utils.getTimeZoneOfTenant());
String LOAN_REPAYMENT_DATE = dateFormat.format(todaysDate.getTime()); 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); loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
LoanStatusChecker.verifyLoanAccountIsClosed(loanStatusHashMap); LoanStatusChecker.verifyLoanAccountIsClosed(loanStatusHashMap);
} }
@@ -4851,7 +4851,7 @@ public class ClientLoanIntegrationTest {
this.accountTransferHelper.refundLoanByTransfer(now, clientID, loanID, clientID, savingsId, FROM_LOAN_ACCOUNT_TYPE, this.accountTransferHelper.refundLoanByTransfer(now, clientID, loanID, clientID, savingsId, FROM_LOAN_ACCOUNT_TYPE,
TO_SAVINGS_ACCOUNT_TYPE, TRANSFER_AMOUNT.toString()); 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); HashMap toSavingsSummaryAfter = this.savingsAccountHelper.getSavingsSummary(savingsId);
@@ -249,7 +249,7 @@ public class ClientSavingsIntegrationTest {
SavingsStatusChecker.verifySavingsIsActive(savingsStatusHashMap); SavingsStatusChecker.verifySavingsIsActive(savingsStatusHashMap);
HashMap summary = this.savingsAccountHelper.getSavingsSummary(savingsId); HashMap summary = this.savingsAccountHelper.getSavingsSummary(savingsId);
Float balance = new Float(openningBalance); Float balance = Float.valueOf(openningBalance);
Float chargeAmt = 100f; Float chargeAmt = 100f;
balance -= chargeAmt; balance -= chargeAmt;
assertEquals("Verifying opening Balance", balance, summary.get("accountBalance")); assertEquals("Verifying opening Balance", balance, summary.get("accountBalance"));
@@ -266,15 +266,15 @@ public class ClientSavingsIntegrationTest {
Integer depositTransactionId = (Integer) this.savingsAccountHelper.depositToSavingsAccount(savingsId, DEPOSIT_AMOUNT, Integer depositTransactionId = (Integer) this.savingsAccountHelper.depositToSavingsAccount(savingsId, DEPOSIT_AMOUNT,
TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID); TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID);
HashMap depositTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, depositTransactionId); HashMap depositTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, depositTransactionId);
balance += new Float(DEPOSIT_AMOUNT); balance += Float.valueOf(DEPOSIT_AMOUNT);
assertEquals("Verifying Deposit Amount", new Float(DEPOSIT_AMOUNT), depositTransaction.get("amount")); assertEquals("Verifying Deposit Amount", Float.valueOf(DEPOSIT_AMOUNT), depositTransaction.get("amount"));
assertEquals("Verifying Balance after Deposit", balance, depositTransaction.get("runningBalance")); assertEquals("Verifying Balance after Deposit", balance, depositTransaction.get("runningBalance"));
Integer withdrawTransactionId = (Integer) this.savingsAccountHelper.withdrawalFromSavingsAccount(savingsId, withdrawAmt, Integer withdrawTransactionId = (Integer) this.savingsAccountHelper.withdrawalFromSavingsAccount(savingsId, withdrawAmt,
TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID); TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID);
HashMap withdrawTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, withdrawTransactionId); HashMap withdrawTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, withdrawTransactionId);
balance -= new Float(withdrawAmt); balance -= Float.valueOf(withdrawAmt);
assertEquals("Verifying Withdrawal Amount", new Float(withdrawAmt), withdrawTransaction.get("amount")); assertEquals("Verifying Withdrawal Amount", Float.valueOf(withdrawAmt), withdrawTransaction.get("amount"));
assertEquals("Verifying Balance after Withdrawal", balance, withdrawTransaction.get("runningBalance")); assertEquals("Verifying Balance after Withdrawal", balance, withdrawTransaction.get("runningBalance"));
} }
@@ -435,28 +435,28 @@ public class ClientSavingsIntegrationTest {
SavingsStatusChecker.verifySavingsIsActive(savingsStatusHashMap); SavingsStatusChecker.verifySavingsIsActive(savingsStatusHashMap);
HashMap summary = this.savingsAccountHelper.getSavingsSummary(savingsId); 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")); assertEquals("Verifying opening Balance", balance, summary.get("accountBalance"));
Integer depositTransactionId = (Integer) this.savingsAccountHelper.depositToSavingsAccount(savingsId, DEPOSIT_AMOUNT, Integer depositTransactionId = (Integer) this.savingsAccountHelper.depositToSavingsAccount(savingsId, DEPOSIT_AMOUNT,
SavingsAccountHelper.TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID); SavingsAccountHelper.TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID);
HashMap depositTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, depositTransactionId); HashMap depositTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, depositTransactionId);
balance += new Float(DEPOSIT_AMOUNT); balance += Float.valueOf(DEPOSIT_AMOUNT);
assertEquals("Verifying Deposit Amount", new Float(DEPOSIT_AMOUNT), depositTransaction.get("amount")); assertEquals("Verifying Deposit Amount", Float.valueOf(DEPOSIT_AMOUNT), depositTransaction.get("amount"));
assertEquals("Verifying Balance after Deposit", balance, depositTransaction.get("runningBalance")); assertEquals("Verifying Balance after Deposit", balance, depositTransaction.get("runningBalance"));
Integer withdrawTransactionId = (Integer) this.savingsAccountHelper.withdrawalFromSavingsAccount(savingsId, WITHDRAW_AMOUNT, Integer withdrawTransactionId = (Integer) this.savingsAccountHelper.withdrawalFromSavingsAccount(savingsId, WITHDRAW_AMOUNT,
SavingsAccountHelper.TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID); SavingsAccountHelper.TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID);
HashMap withdrawTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, withdrawTransactionId); HashMap withdrawTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, withdrawTransactionId);
balance -= new Float(WITHDRAW_AMOUNT); balance -= Float.valueOf(WITHDRAW_AMOUNT);
assertEquals("Verifying Withdrawal Amount", new Float(WITHDRAW_AMOUNT), withdrawTransaction.get("amount")); assertEquals("Verifying Withdrawal Amount", Float.valueOf(WITHDRAW_AMOUNT), withdrawTransaction.get("amount"));
assertEquals("Verifying Balance after Withdrawal", balance, withdrawTransaction.get("runningBalance")); assertEquals("Verifying Balance after Withdrawal", balance, withdrawTransaction.get("runningBalance"));
Integer newWithdrawTransactionId = this.savingsAccountHelper.updateSavingsAccountTransaction(savingsId, withdrawTransactionId, Integer newWithdrawTransactionId = this.savingsAccountHelper.updateSavingsAccountTransaction(savingsId, withdrawTransactionId,
WITHDRAW_AMOUNT_ADJUSTED); WITHDRAW_AMOUNT_ADJUSTED);
HashMap newWithdrawTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, newWithdrawTransactionId); HashMap newWithdrawTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, newWithdrawTransactionId);
balance = balance + new Float(WITHDRAW_AMOUNT) - new Float(WITHDRAW_AMOUNT_ADJUSTED); balance = balance + Float.valueOf(WITHDRAW_AMOUNT) - Float.valueOf(WITHDRAW_AMOUNT_ADJUSTED);
assertEquals("Verifying adjusted Amount", new Float(WITHDRAW_AMOUNT_ADJUSTED), newWithdrawTransaction.get("amount")); assertEquals("Verifying adjusted Amount", Float.valueOf(WITHDRAW_AMOUNT_ADJUSTED), newWithdrawTransaction.get("amount"));
assertEquals("Verifying Balance after adjust", balance, newWithdrawTransaction.get("runningBalance")); assertEquals("Verifying Balance after adjust", balance, newWithdrawTransaction.get("runningBalance"));
summary = this.savingsAccountHelper.getSavingsSummary(savingsId); summary = this.savingsAccountHelper.getSavingsSummary(savingsId);
assertEquals("Verifying Adjusted Balance", balance, summary.get("accountBalance")); assertEquals("Verifying Adjusted Balance", balance, summary.get("accountBalance"));
@@ -467,7 +467,7 @@ public class ClientSavingsIntegrationTest {
newWithdrawTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, withdrawTransactionId); newWithdrawTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, withdrawTransactionId);
Assert.assertTrue((Boolean) newWithdrawTransaction.get("reversed")); Assert.assertTrue((Boolean) newWithdrawTransaction.get("reversed"));
summary = this.savingsAccountHelper.getSavingsSummary(savingsId); 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")); assertEquals("Verifying Balance After Undo Transaction", balance, summary.get("accountBalance"));
error = (List) savingsAccountHelperValidationError.withdrawalFromSavingsAccount(savingsId, "5000", error = (List) savingsAccountHelperValidationError.withdrawalFromSavingsAccount(savingsId, "5000",
@@ -740,8 +740,8 @@ public class ClientSavingsIntegrationTest {
Integer withdrawTransactionId = (Integer) this.savingsAccountHelper.withdrawalFromSavingsAccount(savingsId, WITHDRAW_AMOUNT, Integer withdrawTransactionId = (Integer) this.savingsAccountHelper.withdrawalFromSavingsAccount(savingsId, WITHDRAW_AMOUNT,
ACTIVATION_DATE, CommonConstants.RESPONSE_RESOURCE_ID); ACTIVATION_DATE, CommonConstants.RESPONSE_RESOURCE_ID);
HashMap withdrawTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, withdrawTransactionId); HashMap withdrawTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, withdrawTransactionId);
balance -= new Float(WITHDRAW_AMOUNT); balance -= Float.valueOf(WITHDRAW_AMOUNT);
assertEquals("Verifying Withdrawal Amount", new Float(WITHDRAW_AMOUNT), withdrawTransaction.get("amount")); assertEquals("Verifying Withdrawal Amount", Float.valueOf(WITHDRAW_AMOUNT), withdrawTransaction.get("amount"));
assertEquals("Verifying Balance after Withdrawal", balance, withdrawTransaction.get("runningBalance")); 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, Integer depositTransactionId = (Integer) this.savingsAccountHelper.depositToSavingsAccount(savingsId, DEPOSIT_AMOUNT,
TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID); TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID);
HashMap depositTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, depositTransactionId); HashMap depositTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, depositTransactionId);
balance += new Float(DEPOSIT_AMOUNT); balance += Float.valueOf(DEPOSIT_AMOUNT);
assertEquals("Verifying Deposit Amount", new Float(DEPOSIT_AMOUNT), depositTransaction.get("amount")); assertEquals("Verifying Deposit Amount", Float.valueOf(DEPOSIT_AMOUNT), depositTransaction.get("amount"));
assertEquals("Verifying Balance after Deposit", balance, depositTransaction.get("runningBalance")); 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 decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern("#.###"); decimalFormat.applyPattern("#.###");
interestPosted = new Float(decimalFormat.format(interestPosted)); interestPosted = Float.valueOf(decimalFormat.format(interestPosted));
actualInterestPosted = new Float(decimalFormat.format(actualInterestPosted)); actualInterestPosted = Float.valueOf(decimalFormat.format(actualInterestPosted));
assertEquals("Verifying interest posted", interestPosted, actualInterestPosted); assertEquals("Verifying interest posted", interestPosted, actualInterestPosted);
todaysDate = Calendar.getInstance(); todaysDate = Calendar.getInstance();
@@ -897,8 +897,8 @@ public class ClientSavingsIntegrationTest {
WITHDRAWAL_DATE, CommonConstants.RESPONSE_RESOURCE_ID); WITHDRAWAL_DATE, CommonConstants.RESPONSE_RESOURCE_ID);
HashMap depositTransaction = this.savingsAccountHelper HashMap depositTransaction = this.savingsAccountHelper
.getSavingsTransaction(savingsId, depositTransactionId); .getSavingsTransaction(savingsId, depositTransactionId);
balance += new Float(DEPOSIT_AMOUNT); balance += Float.valueOf(DEPOSIT_AMOUNT);
assertEquals("Verifying Deposit Amount", new Float(DEPOSIT_AMOUNT), assertEquals("Verifying Deposit Amount", Float.valueOf(DEPOSIT_AMOUNT),
depositTransaction.get("amount")); depositTransaction.get("amount"));
assertEquals("Verifying Balance after Deposit", balance, assertEquals("Verifying Balance after Deposit", balance,
depositTransaction.get("runningBalance")); depositTransaction.get("runningBalance"));
@@ -933,8 +933,8 @@ public class ClientSavingsIntegrationTest {
DecimalFormat decimalFormat = new DecimalFormat("", DecimalFormat decimalFormat = new DecimalFormat("",
new DecimalFormatSymbols(Locale.US)); new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern("#.###"); decimalFormat.applyPattern("#.###");
interestPosted = new Float(decimalFormat.format(interestPosted)); interestPosted = Float.valueOf(decimalFormat.format(interestPosted));
accountDetailsPostInterestPosted = new Float( accountDetailsPostInterestPosted = Float.valueOf(
decimalFormat.format(accountDetailsPostInterestPosted)); decimalFormat.format(accountDetailsPostInterestPosted));
assertEquals("Verifying interest posted", interestPosted, assertEquals("Verifying interest posted", interestPosted,
accountDetailsPostInterestPosted); accountDetailsPostInterestPosted);
@@ -965,8 +965,8 @@ public class ClientSavingsIntegrationTest {
decimalFormat = new DecimalFormat("", new DecimalFormatSymbols( decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(
Locale.US)); Locale.US));
decimalFormat.applyPattern("#.###"); decimalFormat.applyPattern("#.###");
interestPosted = new Float(decimalFormat.format(interestPosted)); interestPosted = Float.valueOf(decimalFormat.format(interestPosted));
accountDetailsPostInterestPosted = new Float( accountDetailsPostInterestPosted = Float.valueOf(
decimalFormat.format(accountDetailsPostInterestPosted)); decimalFormat.format(accountDetailsPostInterestPosted));
assertEquals("Verifying interest posted", interestPosted, assertEquals("Verifying interest posted", interestPosted,
accountDetailsPostInterestPosted); accountDetailsPostInterestPosted);
@@ -1002,8 +1002,8 @@ public class ClientSavingsIntegrationTest {
decimalFormat = new DecimalFormat("", new DecimalFormatSymbols( decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(
Locale.US)); Locale.US));
decimalFormat.applyPattern("#.###"); decimalFormat.applyPattern("#.###");
interestPosted = new Float(decimalFormat.format(interestPosted)); interestPosted = Float.valueOf(decimalFormat.format(interestPosted));
accountDetailsPostInterestPosted = new Float( accountDetailsPostInterestPosted = Float.valueOf(
decimalFormat.format(accountDetailsPostInterestPosted)); decimalFormat.format(accountDetailsPostInterestPosted));
assertEquals("Verifying interest posted", interestPosted, assertEquals("Verifying interest posted", interestPosted,
accountDetailsPostInterestPosted); accountDetailsPostInterestPosted);
@@ -1042,8 +1042,8 @@ public class ClientSavingsIntegrationTest {
decimalFormat = new DecimalFormat("", new DecimalFormatSymbols( decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(
Locale.US)); Locale.US));
decimalFormat.applyPattern("#.###"); decimalFormat.applyPattern("#.###");
interestPosted = new Float(decimalFormat.format(interestPosted)); interestPosted = Float.valueOf(decimalFormat.format(interestPosted));
accountDetailsPostInterestPosted = new Float( accountDetailsPostInterestPosted = Float.valueOf(
decimalFormat.format(accountDetailsPostInterestPosted)); decimalFormat.format(accountDetailsPostInterestPosted));
assertEquals("Verifying interest posted", interestPosted, assertEquals("Verifying interest posted", interestPosted,
accountDetailsPostInterestPosted); accountDetailsPostInterestPosted);
@@ -1086,8 +1086,8 @@ public class ClientSavingsIntegrationTest {
decimalFormat = new DecimalFormat("", new DecimalFormatSymbols( decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(
Locale.US)); Locale.US));
decimalFormat.applyPattern("#.###"); decimalFormat.applyPattern("#.###");
interestPosted = new Float(decimalFormat.format(interestPosted)); interestPosted = Float.valueOf(decimalFormat.format(interestPosted));
accountDetailsPostInterestPosted = new Float( accountDetailsPostInterestPosted = Float.valueOf(
decimalFormat.format(accountDetailsPostInterestPosted)); decimalFormat.format(accountDetailsPostInterestPosted));
assertEquals("Verifying interest posted", interestPosted, assertEquals("Verifying interest posted", interestPosted,
accountDetailsPostInterestPosted); accountDetailsPostInterestPosted);
@@ -1123,8 +1123,8 @@ public class ClientSavingsIntegrationTest {
decimalFormat = new DecimalFormat("", new DecimalFormatSymbols( decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(
Locale.US)); Locale.US));
decimalFormat.applyPattern("#.###"); decimalFormat.applyPattern("#.###");
interestPosted = new Float(decimalFormat.format(interestPosted)); interestPosted = Float.valueOf(decimalFormat.format(interestPosted));
accountDetailsPostInterestPosted = new Float( accountDetailsPostInterestPosted = Float.valueOf(
decimalFormat.format(accountDetailsPostInterestPosted)); decimalFormat.format(accountDetailsPostInterestPosted));
assertEquals("Verifying interest posted", interestPosted, assertEquals("Verifying interest posted", interestPosted,
accountDetailsPostInterestPosted); accountDetailsPostInterestPosted);
@@ -1228,8 +1228,8 @@ public class ClientSavingsIntegrationTest {
Integer withdrawTransactionId = (Integer) this.savingsAccountHelper.withdrawalFromSavingsAccount(savingsId, WITHDRAW_AMOUNT, Integer withdrawTransactionId = (Integer) this.savingsAccountHelper.withdrawalFromSavingsAccount(savingsId, WITHDRAW_AMOUNT,
ACTIVATION_DATE, CommonConstants.RESPONSE_RESOURCE_ID); ACTIVATION_DATE, CommonConstants.RESPONSE_RESOURCE_ID);
HashMap withdrawTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, withdrawTransactionId); HashMap withdrawTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, withdrawTransactionId);
balance -= new Float(WITHDRAW_AMOUNT); balance -= Float.valueOf(WITHDRAW_AMOUNT);
assertEquals("Verifying Withdrawal Amount", new Float(WITHDRAW_AMOUNT), withdrawTransaction.get("amount")); assertEquals("Verifying Withdrawal Amount", Float.valueOf(WITHDRAW_AMOUNT), withdrawTransaction.get("amount"));
assertEquals("Verifying Balance after Withdrawal", balance, withdrawTransaction.get("runningBalance")); 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, Integer depositTransactionId = (Integer) this.savingsAccountHelper.depositToSavingsAccount(savingsId, DEPOSIT_AMOUNT,
WITHDRAWAL_DATE, CommonConstants.RESPONSE_RESOURCE_ID); WITHDRAWAL_DATE, CommonConstants.RESPONSE_RESOURCE_ID);
HashMap depositTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, depositTransactionId); HashMap depositTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, depositTransactionId);
balance += new Float(DEPOSIT_AMOUNT); balance += Float.valueOf(DEPOSIT_AMOUNT);
assertEquals("Verifying Deposit Amount", new Float(DEPOSIT_AMOUNT), depositTransaction.get("amount")); assertEquals("Verifying Deposit Amount", Float.valueOf(DEPOSIT_AMOUNT), depositTransaction.get("amount"));
assertEquals("Verifying Balance after Deposit", balance, depositTransaction.get("runningBalance")); assertEquals("Verifying Balance after Deposit", balance, depositTransaction.get("runningBalance"));
/*** /***
@@ -1276,8 +1276,8 @@ public class ClientSavingsIntegrationTest {
DecimalFormat decimalFormat = new DecimalFormat("", DecimalFormat decimalFormat = new DecimalFormat("",
new DecimalFormatSymbols(Locale.US)); new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern("#.###"); decimalFormat.applyPattern("#.###");
interestPosted = new Float(decimalFormat.format(interestPosted)); interestPosted = Float.valueOf(decimalFormat.format(interestPosted));
accountDetailsPostInterestPosted = new Float( accountDetailsPostInterestPosted = Float.valueOf(
decimalFormat.format(accountDetailsPostInterestPosted)); decimalFormat.format(accountDetailsPostInterestPosted));
assertEquals("Verifying interest posted", interestPosted, assertEquals("Verifying interest posted", interestPosted,
accountDetailsPostInterestPosted); accountDetailsPostInterestPosted);
@@ -1308,8 +1308,8 @@ public class ClientSavingsIntegrationTest {
decimalFormat = new DecimalFormat("", new DecimalFormatSymbols( decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(
Locale.US)); Locale.US));
decimalFormat.applyPattern("#.###"); decimalFormat.applyPattern("#.###");
interestPosted = new Float(decimalFormat.format(interestPosted)); interestPosted = Float.valueOf(decimalFormat.format(interestPosted));
accountDetailsPostInterestPosted = new Float( accountDetailsPostInterestPosted = Float.valueOf(
decimalFormat.format(accountDetailsPostInterestPosted)); decimalFormat.format(accountDetailsPostInterestPosted));
assertEquals("Verifying interest posted", interestPosted, assertEquals("Verifying interest posted", interestPosted,
accountDetailsPostInterestPosted); accountDetailsPostInterestPosted);
@@ -1345,8 +1345,8 @@ public class ClientSavingsIntegrationTest {
decimalFormat = new DecimalFormat("", new DecimalFormatSymbols( decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(
Locale.US)); Locale.US));
decimalFormat.applyPattern("#.###"); decimalFormat.applyPattern("#.###");
interestPosted = new Float(decimalFormat.format(interestPosted)); interestPosted = Float.valueOf(decimalFormat.format(interestPosted));
accountDetailsPostInterestPosted = new Float( accountDetailsPostInterestPosted = Float.valueOf(
decimalFormat.format(accountDetailsPostInterestPosted)); decimalFormat.format(accountDetailsPostInterestPosted));
assertEquals("Verifying interest posted", interestPosted, assertEquals("Verifying interest posted", interestPosted,
accountDetailsPostInterestPosted); accountDetailsPostInterestPosted);
@@ -1385,8 +1385,8 @@ public class ClientSavingsIntegrationTest {
decimalFormat = new DecimalFormat("", new DecimalFormatSymbols( decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(
Locale.US)); Locale.US));
decimalFormat.applyPattern("#.###"); decimalFormat.applyPattern("#.###");
interestPosted = new Float(decimalFormat.format(interestPosted)); interestPosted = Float.valueOf(decimalFormat.format(interestPosted));
accountDetailsPostInterestPosted = new Float( accountDetailsPostInterestPosted = Float.valueOf(
decimalFormat.format(accountDetailsPostInterestPosted)); decimalFormat.format(accountDetailsPostInterestPosted));
assertEquals("Verifying interest posted", interestPosted, assertEquals("Verifying interest posted", interestPosted,
accountDetailsPostInterestPosted); accountDetailsPostInterestPosted);
@@ -1429,8 +1429,8 @@ public class ClientSavingsIntegrationTest {
decimalFormat = new DecimalFormat("", new DecimalFormatSymbols( decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(
Locale.US)); Locale.US));
decimalFormat.applyPattern("#.###"); decimalFormat.applyPattern("#.###");
interestPosted = new Float(decimalFormat.format(interestPosted)); interestPosted = Float.valueOf(decimalFormat.format(interestPosted));
accountDetailsPostInterestPosted = new Float( accountDetailsPostInterestPosted = Float.valueOf(
decimalFormat.format(accountDetailsPostInterestPosted)); decimalFormat.format(accountDetailsPostInterestPosted));
assertEquals("Verifying interest posted", interestPosted, assertEquals("Verifying interest posted", interestPosted,
accountDetailsPostInterestPosted); accountDetailsPostInterestPosted);
@@ -1466,8 +1466,8 @@ public class ClientSavingsIntegrationTest {
decimalFormat = new DecimalFormat("", new DecimalFormatSymbols( decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(
Locale.US)); Locale.US));
decimalFormat.applyPattern("#.###"); decimalFormat.applyPattern("#.###");
interestPosted = new Float(decimalFormat.format(interestPosted)); interestPosted = Float.valueOf(decimalFormat.format(interestPosted));
accountDetailsPostInterestPosted = new Float( accountDetailsPostInterestPosted = Float.valueOf(
decimalFormat.format(accountDetailsPostInterestPosted)); decimalFormat.format(accountDetailsPostInterestPosted));
assertEquals("Verifying interest posted", interestPosted, assertEquals("Verifying interest posted", interestPosted,
accountDetailsPostInterestPosted); accountDetailsPostInterestPosted);
@@ -1560,8 +1560,8 @@ public class ClientSavingsIntegrationTest {
Integer withdrawTransactionId = (Integer) this.savingsAccountHelper.withdrawalFromSavingsAccount(savingsId, WITHDRAW_AMOUNT, Integer withdrawTransactionId = (Integer) this.savingsAccountHelper.withdrawalFromSavingsAccount(savingsId, WITHDRAW_AMOUNT,
ACTIVATION_DATE, CommonConstants.RESPONSE_RESOURCE_ID); ACTIVATION_DATE, CommonConstants.RESPONSE_RESOURCE_ID);
HashMap withdrawTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, withdrawTransactionId); HashMap withdrawTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, withdrawTransactionId);
balance -= new Float(WITHDRAW_AMOUNT); balance -= Float.valueOf(WITHDRAW_AMOUNT);
assertEquals("Verifying Withdrawal Amount", new Float(WITHDRAW_AMOUNT), withdrawTransaction.get("amount")); assertEquals("Verifying Withdrawal Amount", Float.valueOf(WITHDRAW_AMOUNT), withdrawTransaction.get("amount"));
assertEquals("Verifying Balance after Withdrawal", balance, withdrawTransaction.get("runningBalance")); 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, Integer depositTransactionId = (Integer) this.savingsAccountHelper.depositToSavingsAccount(savingsId, DEPOSIT_AMOUNT,
TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID); TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID);
HashMap depositTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, depositTransactionId); HashMap depositTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, depositTransactionId);
balance += new Float(DEPOSIT_AMOUNT); balance += Float.valueOf(DEPOSIT_AMOUNT);
assertEquals("Verifying Deposit Amount", new Float(DEPOSIT_AMOUNT), depositTransaction.get("amount")); assertEquals("Verifying Deposit Amount", Float.valueOf(DEPOSIT_AMOUNT), depositTransaction.get("amount"));
assertEquals("Verifying Balance after Deposit", balance, depositTransaction.get("runningBalance")); 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 decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern("#.###"); decimalFormat.applyPattern("#.###");
interestPosted = new Float(decimalFormat.format(interestPosted)); interestPosted = Float.valueOf(decimalFormat.format(interestPosted));
//actualInterestPosted = new Float(decimalFormat.format(accountDetailsPostInterestPosted)); //actualInterestPosted = Float.valueOf(decimalFormat.format(accountDetailsPostInterestPosted));
assertEquals("Verifying interest posted", interestPosted, accountDetailsPostInterestPosted); assertEquals("Verifying interest posted", interestPosted, accountDetailsPostInterestPosted);
System.out.println("------Post Interest As On After doing a post interest Successfully worked--------"); 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, Integer withdrawTransactionId = (Integer) this.savingsAccountHelper.withdrawalFromSavingsAccount(savingsId, WITHDRAW_AMOUNT,
ACTIVATION_DATE, CommonConstants.RESPONSE_RESOURCE_ID); ACTIVATION_DATE, CommonConstants.RESPONSE_RESOURCE_ID);
HashMap withdrawTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, withdrawTransactionId); HashMap withdrawTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, withdrawTransactionId);
balance -= new Float(WITHDRAW_AMOUNT); balance -= Float.valueOf(WITHDRAW_AMOUNT);
assertEquals("Verifying Withdrawal Amount", new Float(WITHDRAW_AMOUNT), withdrawTransaction.get("amount")); assertEquals("Verifying Withdrawal Amount", Float.valueOf(WITHDRAW_AMOUNT), withdrawTransaction.get("amount"));
assertEquals("Verifying Balance after Withdrawal", balance, withdrawTransaction.get("runningBalance")); 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, Integer depositTransactionId = (Integer) this.savingsAccountHelper.depositToSavingsAccount(savingsId, DEPOSIT_AMOUNT,
TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID); TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID);
HashMap depositTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, depositTransactionId); HashMap depositTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, depositTransactionId);
balance += new Float(DEPOSIT_AMOUNT); balance += Float.valueOf(DEPOSIT_AMOUNT);
assertEquals("Verifying Deposit Amount", new Float(DEPOSIT_AMOUNT), depositTransaction.get("amount")); assertEquals("Verifying Deposit Amount", Float.valueOf(DEPOSIT_AMOUNT), depositTransaction.get("amount"));
assertEquals("Verifying Balance after Deposit", balance, depositTransaction.get("runningBalance")); 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 decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern("#.###"); decimalFormat.applyPattern("#.###");
interestPosted = new Float(decimalFormat.format(interestPosted)); interestPosted = Float.valueOf(decimalFormat.format(interestPosted));
actualInterestPosted = new Float(decimalFormat.format(actualInterestPosted)); actualInterestPosted = Float.valueOf(decimalFormat.format(actualInterestPosted));
assertEquals("Verifying interest posted", interestPosted, actualInterestPosted); assertEquals("Verifying interest posted", interestPosted, actualInterestPosted);
System.out.println("------Post Interest As On Successful Worked--------"); System.out.println("------Post Interest As On Successful Worked--------");
@@ -1803,8 +1803,8 @@ public class ClientSavingsIntegrationTest {
DecimalFormat decimalLastFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US)); DecimalFormat decimalLastFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalLastFormat.applyPattern("#.###"); decimalLastFormat.applyPattern("#.###");
interestLastPosted = new Float(decimalLastFormat.format(interestLastPosted)); interestLastPosted = Float.valueOf(decimalLastFormat.format(interestLastPosted));
actualInterestPosted = new Float(decimalFormat.format(actualInterestPosted)); actualInterestPosted = Float.valueOf(decimalFormat.format(actualInterestPosted));
assertEquals("Verifying interest posted", interestLastPosted, actualInterestPosted); assertEquals("Verifying interest posted", interestLastPosted, actualInterestPosted);
System.out.println("------Post Interest As On Successful Worked--------"); System.out.println("------Post Interest As On Successful Worked--------");
@@ -2108,7 +2108,7 @@ public class ClientSavingsIntegrationTest {
* "--------------------VERIFYING THE BALANCE, INTEREST --------------------------" * "--------------------VERIFYING THE BALANCE, INTEREST --------------------------"
* ); * );
* *
* assertEquals("Verifying Interest Calculation", new Float("238.3399"), * assertEquals("Verifying Interest Calculation", Float.valueOf("238.3399"),
* savingsInterest); } * savingsInterest); }
*/ */
@@ -2142,7 +2142,7 @@ public class ClientSavingsIntegrationTest {
SavingsStatusChecker.verifySavingsIsActive(savingsStatusHashMap); SavingsStatusChecker.verifySavingsIsActive(savingsStatusHashMap);
HashMap summary = this.savingsAccountHelper.getSavingsSummary(savingsId); 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); savingsStatusHashMap = this.savingsAccountHelper.blockSavings(savingsId);
SavingsStatusChecker.verifySavingsSubStatusblock(savingsStatusHashMap); SavingsStatusChecker.verifySavingsSubStatusblock(savingsStatusHashMap);
@@ -2162,8 +2162,8 @@ public class ClientSavingsIntegrationTest {
Integer depositTransactionId = (Integer) this.savingsAccountHelper.depositToSavingsAccount(savingsId, DEPOSIT_AMOUNT, Integer depositTransactionId = (Integer) this.savingsAccountHelper.depositToSavingsAccount(savingsId, DEPOSIT_AMOUNT,
SavingsAccountHelper.TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID); SavingsAccountHelper.TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID);
HashMap depositTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, depositTransactionId); HashMap depositTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, depositTransactionId);
balance += new Float(DEPOSIT_AMOUNT); balance += Float.valueOf(DEPOSIT_AMOUNT);
assertEquals("Verifying Deposit Amount", new Float(DEPOSIT_AMOUNT), depositTransaction.get("amount")); assertEquals("Verifying Deposit Amount", Float.valueOf(DEPOSIT_AMOUNT), depositTransaction.get("amount"));
savingsStatusHashMap = this.savingsAccountHelper.blockDebit(savingsId); savingsStatusHashMap = this.savingsAccountHelper.blockDebit(savingsId);
SavingsStatusChecker.verifySavingsSubStatusIsDebitBlocked(savingsStatusHashMap); SavingsStatusChecker.verifySavingsSubStatusIsDebitBlocked(savingsStatusHashMap);
@@ -2175,16 +2175,16 @@ public class ClientSavingsIntegrationTest {
depositTransactionId = (Integer) this.savingsAccountHelper.depositToSavingsAccount(savingsId, DEPOSIT_AMOUNT, depositTransactionId = (Integer) this.savingsAccountHelper.depositToSavingsAccount(savingsId, DEPOSIT_AMOUNT,
SavingsAccountHelper.TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID); SavingsAccountHelper.TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID);
depositTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, depositTransactionId); depositTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, depositTransactionId);
balance += new Float(DEPOSIT_AMOUNT); balance += Float.valueOf(DEPOSIT_AMOUNT);
assertEquals("Verifying Deposit Amount", new Float(DEPOSIT_AMOUNT), depositTransaction.get("amount")); assertEquals("Verifying Deposit Amount", Float.valueOf(DEPOSIT_AMOUNT), depositTransaction.get("amount"));
savingsStatusHashMap = this.savingsAccountHelper.unblockDebit(savingsId); savingsStatusHashMap = this.savingsAccountHelper.unblockDebit(savingsId);
SavingsStatusChecker.verifySavingsSubStatusIsNone(savingsStatusHashMap); SavingsStatusChecker.verifySavingsSubStatusIsNone(savingsStatusHashMap);
Integer withdrawTransactionId = (Integer) this.savingsAccountHelper.withdrawalFromSavingsAccount(savingsId, WITHDRAW_AMOUNT, Integer withdrawTransactionId = (Integer) this.savingsAccountHelper.withdrawalFromSavingsAccount(savingsId, WITHDRAW_AMOUNT,
SavingsAccountHelper.TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID); SavingsAccountHelper.TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID);
HashMap withdrawTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, withdrawTransactionId); HashMap withdrawTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, withdrawTransactionId);
balance -= new Float(WITHDRAW_AMOUNT); balance -= Float.valueOf(WITHDRAW_AMOUNT);
assertEquals("Verifying Withdrawal Amount", new Float(WITHDRAW_AMOUNT), withdrawTransaction.get("amount")); assertEquals("Verifying Withdrawal Amount", Float.valueOf(WITHDRAW_AMOUNT), withdrawTransaction.get("amount"));
savingsStatusHashMap = this.savingsAccountHelper.blockCredit(savingsId); savingsStatusHashMap = this.savingsAccountHelper.blockCredit(savingsId);
SavingsStatusChecker.verifySavingsSubStatusIsCreditBlocked(savingsStatusHashMap); SavingsStatusChecker.verifySavingsSubStatusIsCreditBlocked(savingsStatusHashMap);
@@ -2196,16 +2196,16 @@ public class ClientSavingsIntegrationTest {
withdrawTransactionId = (Integer) this.savingsAccountHelper.withdrawalFromSavingsAccount(savingsId, WITHDRAW_AMOUNT, withdrawTransactionId = (Integer) this.savingsAccountHelper.withdrawalFromSavingsAccount(savingsId, WITHDRAW_AMOUNT,
SavingsAccountHelper.TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID); SavingsAccountHelper.TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID);
withdrawTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, withdrawTransactionId); withdrawTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, withdrawTransactionId);
balance -= new Float(WITHDRAW_AMOUNT); balance -= Float.valueOf(WITHDRAW_AMOUNT);
assertEquals("Verifying Withdrawal Amount", new Float(WITHDRAW_AMOUNT), withdrawTransaction.get("amount")); assertEquals("Verifying Withdrawal Amount", Float.valueOf(WITHDRAW_AMOUNT), withdrawTransaction.get("amount"));
savingsStatusHashMap = this.savingsAccountHelper.unblockCredit(savingsId); savingsStatusHashMap = this.savingsAccountHelper.unblockCredit(savingsId);
SavingsStatusChecker.verifySavingsSubStatusIsNone(savingsStatusHashMap); SavingsStatusChecker.verifySavingsSubStatusIsNone(savingsStatusHashMap);
depositTransactionId = (Integer) this.savingsAccountHelper.depositToSavingsAccount(savingsId, DEPOSIT_AMOUNT, depositTransactionId = (Integer) this.savingsAccountHelper.depositToSavingsAccount(savingsId, DEPOSIT_AMOUNT,
SavingsAccountHelper.TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID); SavingsAccountHelper.TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID);
depositTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, depositTransactionId); depositTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, depositTransactionId);
balance += new Float(DEPOSIT_AMOUNT); balance += Float.valueOf(DEPOSIT_AMOUNT);
assertEquals("Verifying Deposit Amount", new Float(DEPOSIT_AMOUNT), depositTransaction.get("amount")); assertEquals("Verifying Deposit Amount", Float.valueOf(DEPOSIT_AMOUNT), depositTransaction.get("amount"));
Integer holdTransactionId = (Integer) this.savingsAccountHelper.holdAmountInSavingsAccount(savingsId, String.valueOf(balance - 100), Integer holdTransactionId = (Integer) this.savingsAccountHelper.holdAmountInSavingsAccount(savingsId, String.valueOf(balance - 100),
SavingsAccountHelper.TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID); SavingsAccountHelper.TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID);
@@ -2222,8 +2222,8 @@ public class ClientSavingsIntegrationTest {
withdrawTransactionId = (Integer) this.savingsAccountHelper.withdrawalFromSavingsAccount(savingsId, "300", todayDate, withdrawTransactionId = (Integer) this.savingsAccountHelper.withdrawalFromSavingsAccount(savingsId, "300", todayDate,
CommonConstants.RESPONSE_RESOURCE_ID); CommonConstants.RESPONSE_RESOURCE_ID);
withdrawTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, withdrawTransactionId); withdrawTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, withdrawTransactionId);
balance -= new Float("300"); balance -= Float.valueOf("300");
assertEquals("Verifying Withdrawal Amount", new Float("300"), withdrawTransaction.get("amount")); assertEquals("Verifying Withdrawal Amount", Float.valueOf("300"), withdrawTransaction.get("amount"));
} }
@@ -2290,10 +2290,9 @@ public class ClientSavingsIntegrationTest {
HashMap summary = this.savingsAccountHelper.getSavingsSummary(savingsId); 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")); assertEquals("Verifying opening Balance is -300", balance, summary.get("accountBalance"));
} }
} }
@@ -101,10 +101,10 @@ public class ClientUndoRejectAndWithdrawalIntegrationTest {
status = this.clientHelper.rejectClient(clientId); status = this.clientHelper.rejectClient(clientId);
ClientStatusChecker.verifyClientRejected(status); ClientStatusChecker.verifyClientRejected(status);
ArrayList<HashMap> clientErrorData = (ArrayList<HashMap>) validationErrorHelper.undoRejectedclient(clientId, ArrayList<HashMap<String, Object>> clientErrorData = validationErrorHelper.undoRejectedclient(clientId,
CommonConstants.RESPONSE_ERROR, ClientHelper.CREATED_DATE); CommonConstants.RESPONSE_ERROR, ClientHelper.CREATED_DATE);
assertEquals("error.msg.client.reopened.date.cannot.before.client.rejected.date", assertEquals("error.msg.client.reopened.date.cannot.before.client.rejected.date",
((HashMap<String, Object>) clientErrorData.get(0)).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE)); clientErrorData.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
status = this.clientHelper.undoReject(clientId); status = this.clientHelper.undoReject(clientId);
ClientStatusChecker.verifyClientPending(status); ClientStatusChecker.verifyClientPending(status);
@@ -130,10 +130,10 @@ public class ClientUndoRejectAndWithdrawalIntegrationTest {
Calendar todaysDate = Calendar.getInstance(); Calendar todaysDate = Calendar.getInstance();
final String undoRejectDate = dateFormat.format(todaysDate.getTime()); final String undoRejectDate = dateFormat.format(todaysDate.getTime());
ArrayList<HashMap> clientErrorData = (ArrayList<HashMap>) validationErrorHelper.undoRejectedclient(clientId, ArrayList<HashMap<String, Object>> clientErrorData = validationErrorHelper.undoRejectedclient(clientId,
CommonConstants.RESPONSE_ERROR, undoRejectDate); CommonConstants.RESPONSE_ERROR, undoRejectDate);
assertEquals("error.msg.client.undorejection.on.nonrejected.account", assertEquals("error.msg.client.undorejection.on.nonrejected.account",
((HashMap<String, Object>) 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)); status = this.clientHelper.getClientStatus(requestSpec, responseSpec, String.valueOf(clientId));
ClientStatusChecker.verifyClientPending(status); ClientStatusChecker.verifyClientPending(status);
@@ -163,10 +163,10 @@ public class ClientUndoRejectAndWithdrawalIntegrationTest {
Calendar todaysDate = Calendar.getInstance(); Calendar todaysDate = Calendar.getInstance();
todaysDate.add(Calendar.DATE, 1); todaysDate.add(Calendar.DATE, 1);
final String undoRejectDate = dateFormat.format(todaysDate.getTime()); final String undoRejectDate = dateFormat.format(todaysDate.getTime());
ArrayList<HashMap> clientErrorData = (ArrayList<HashMap>) validationErrorHelper.undoWithdrawclient(clientId, ArrayList<HashMap<String, Object>> clientErrorData = validationErrorHelper.undoWithdrawclient(clientId,
CommonConstants.RESPONSE_ERROR, undoRejectDate); CommonConstants.RESPONSE_ERROR, undoRejectDate);
assertEquals("validation.msg.client.reopenedDate.is.greater.than.date", assertEquals("validation.msg.client.reopenedDate.is.greater.than.date",
((HashMap<String, Object>) clientErrorData.get(0)).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE)); clientErrorData.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
status = this.clientHelper.undoReject(clientId); status = this.clientHelper.undoReject(clientId);
ClientStatusChecker.verifyClientPending(status); ClientStatusChecker.verifyClientPending(status);
@@ -215,10 +215,10 @@ public class ClientUndoRejectAndWithdrawalIntegrationTest {
status = this.clientHelper.withdrawClient(clientId); status = this.clientHelper.withdrawClient(clientId);
ClientStatusChecker.verifyClientWithdrawn(status); ClientStatusChecker.verifyClientWithdrawn(status);
ArrayList<HashMap> clientErrorData = (ArrayList<HashMap>) validationErrorHelper.undoWithdrawclient(clientId, ArrayList<HashMap<String, Object>> clientErrorData = validationErrorHelper.undoWithdrawclient(clientId,
CommonConstants.RESPONSE_ERROR, ClientHelper.CREATED_DATE); CommonConstants.RESPONSE_ERROR, ClientHelper.CREATED_DATE);
assertEquals("error.msg.client.reopened.date.cannot.before.client.withdrawal.date", assertEquals("error.msg.client.reopened.date.cannot.before.client.withdrawal.date",
((HashMap<String, Object>) clientErrorData.get(0)).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE)); clientErrorData.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
status = this.clientHelper.undoWithdrawn(clientId); status = this.clientHelper.undoWithdrawn(clientId);
ClientStatusChecker.verifyClientPending(status); ClientStatusChecker.verifyClientPending(status);
@@ -243,10 +243,10 @@ public class ClientUndoRejectAndWithdrawalIntegrationTest {
Calendar todaysDate = Calendar.getInstance(); Calendar todaysDate = Calendar.getInstance();
final String undoWithdrawDate = dateFormat.format(todaysDate.getTime()); final String undoWithdrawDate = dateFormat.format(todaysDate.getTime());
ArrayList<HashMap> clientErrorData = (ArrayList<HashMap>) validationErrorHelper.undoWithdrawclient(clientId, ArrayList<HashMap<String, Object>> clientErrorData = validationErrorHelper.undoWithdrawclient(clientId,
CommonConstants.RESPONSE_ERROR, undoWithdrawDate); CommonConstants.RESPONSE_ERROR, undoWithdrawDate);
assertEquals("error.msg.client.undoWithdrawal.on.nonwithdrawal.account", assertEquals("error.msg.client.undoWithdrawal.on.nonwithdrawal.account",
((HashMap<String, Object>) 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)); status = this.clientHelper.getClientStatus(requestSpec, responseSpec, String.valueOf(clientId));
ClientStatusChecker.verifyClientPending(status); ClientStatusChecker.verifyClientPending(status);
@@ -276,10 +276,10 @@ public class ClientUndoRejectAndWithdrawalIntegrationTest {
Calendar todaysDate = Calendar.getInstance(); Calendar todaysDate = Calendar.getInstance();
todaysDate.add(Calendar.DATE, 1); todaysDate.add(Calendar.DATE, 1);
final String undoWithdrawDate = dateFormat.format(todaysDate.getTime()); final String undoWithdrawDate = dateFormat.format(todaysDate.getTime());
ArrayList<HashMap> clientErrorData = (ArrayList<HashMap>) validationErrorHelper.undoWithdrawclient(clientId, ArrayList<HashMap<String, Object>> clientErrorData = validationErrorHelper.undoWithdrawclient(clientId,
CommonConstants.RESPONSE_ERROR, undoWithdrawDate); CommonConstants.RESPONSE_ERROR, undoWithdrawDate);
assertEquals("validation.msg.client.reopenedDate.is.greater.than.date", assertEquals("validation.msg.client.reopenedDate.is.greater.than.date",
((HashMap<String, Object>) clientErrorData.get(0)).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE)); clientErrorData.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
status = this.clientHelper.undoWithdrawn(clientId); status = this.clientHelper.undoWithdrawn(clientId);
ClientStatusChecker.verifyClientPending(status); ClientStatusChecker.verifyClientPending(status);
@@ -305,10 +305,10 @@ public class ClientUndoRejectAndWithdrawalIntegrationTest {
ClientStatusChecker.verifyClientWithdrawn(status); ClientStatusChecker.verifyClientWithdrawn(status);
status = this.clientHelper.undoWithdrawn(clientId); status = this.clientHelper.undoWithdrawn(clientId);
ClientStatusChecker.verifyClientPending(status); ClientStatusChecker.verifyClientPending(status);
ArrayList<HashMap> clientErrorData = (ArrayList<HashMap>) validationErrorHelper.activateClient(clientId, ArrayList<HashMap<String, Object>> clientErrorData = validationErrorHelper.activateClient(clientId,
CommonConstants.RESPONSE_ERROR); CommonConstants.RESPONSE_ERROR);
assertEquals("error.msg.clients.submittedOnDate.after.reopened.date", assertEquals("error.msg.clients.submittedOnDate.after.reopened.date",
((HashMap<String, Object>) clientErrorData.get(0)).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE)); clientErrorData.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
} }
@@ -26,6 +26,7 @@ import io.restassured.http.ContentType;
import io.restassured.specification.RequestSpecification; import io.restassured.specification.RequestSpecification;
import io.restassured.specification.ResponseSpecification; import io.restassured.specification.ResponseSpecification;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.DateFormat; import java.text.DateFormat;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols; import java.text.DecimalFormatSymbols;
@@ -535,7 +536,7 @@ public class FixedDepositTest {
final String chartToUse = "period"; final String chartToUse = "period";
final String depositAmount = "10000"; final String depositAmount = "10000";
final String depositPeriod = "12"; final String depositPeriod = "12";
final Float interestRate = new Float(6.0); final Float interestRate = Float.valueOf((float)6.0);
testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate); testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate);
} }
@@ -544,7 +545,7 @@ public class FixedDepositTest {
final String chartToUse = "period"; final String chartToUse = "period";
final String depositAmount = "2000"; final String depositAmount = "2000";
final String depositPeriod = "12"; final String depositPeriod = "12";
final Float interestRate = new Float(6.0); final Float interestRate = Float.valueOf((float)6.0);
testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate); testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate);
} }
@@ -553,7 +554,7 @@ public class FixedDepositTest {
final String chartToUse = "period"; final String chartToUse = "period";
final String depositAmount = "10000"; final String depositAmount = "10000";
final String depositPeriod = "18"; final String depositPeriod = "18";
final Float interestRate = new Float(7.0); final Float interestRate = Float.valueOf((float)7.0);
testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate); testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate);
} }
@@ -562,7 +563,7 @@ public class FixedDepositTest {
final String chartToUse = "amount"; final String chartToUse = "amount";
final String depositAmount = "10000"; final String depositAmount = "10000";
final String depositPeriod = "12"; final String depositPeriod = "12";
final Float interestRate = new Float(7.0); final Float interestRate = Float.valueOf((float)7.0);
testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate); testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate);
} }
@@ -571,7 +572,7 @@ public class FixedDepositTest {
final String chartToUse = "amount"; final String chartToUse = "amount";
final String depositAmount = "5000"; final String depositAmount = "5000";
final String depositPeriod = "12"; final String depositPeriod = "12";
final Float interestRate = new Float(5.0); final Float interestRate = Float.valueOf((float)5.0);
testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate); testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate);
} }
@@ -580,7 +581,7 @@ public class FixedDepositTest {
final String chartToUse = "amount"; final String chartToUse = "amount";
final String depositAmount = "10000"; final String depositAmount = "10000";
final String depositPeriod = "26"; final String depositPeriod = "26";
final Float interestRate = new Float(7.0); final Float interestRate = Float.valueOf((float)7.0);
testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate); testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate);
} }
@@ -589,7 +590,7 @@ public class FixedDepositTest {
final String chartToUse = "period_amount"; final String chartToUse = "period_amount";
final String depositAmount = "10000"; final String depositAmount = "10000";
final String depositPeriod = "12"; final String depositPeriod = "12";
final Float interestRate = new Float(7.0); final Float interestRate = Float.valueOf((float)7.0);
testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate); testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate);
} }
@@ -598,7 +599,7 @@ public class FixedDepositTest {
final String chartToUse = "period_amount"; final String chartToUse = "period_amount";
final String depositAmount = "5000"; final String depositAmount = "5000";
final String depositPeriod = "12"; final String depositPeriod = "12";
final Float interestRate = new Float(6.0); final Float interestRate = Float.valueOf((float)6.0);
testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate); testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate);
} }
@@ -607,7 +608,7 @@ public class FixedDepositTest {
final String chartToUse = "period_amount"; final String chartToUse = "period_amount";
final String depositAmount = "10000"; final String depositAmount = "10000";
final String depositPeriod = "20"; final String depositPeriod = "20";
final Float interestRate = new Float(9.0); final Float interestRate = Float.valueOf((float)9.0);
testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate); testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate);
} }
@@ -616,7 +617,7 @@ public class FixedDepositTest {
final String chartToUse = "amount_period"; final String chartToUse = "amount_period";
final String depositAmount = "10000"; final String depositAmount = "10000";
final String depositPeriod = "12"; final String depositPeriod = "12";
final Float interestRate = new Float(8.0); final Float interestRate = Float.valueOf((float)8.0);
testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate); testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate);
} }
@@ -625,7 +626,7 @@ public class FixedDepositTest {
final String chartToUse = "amount_period"; final String chartToUse = "amount_period";
final String depositAmount = "5000"; final String depositAmount = "5000";
final String depositPeriod = "12"; final String depositPeriod = "12";
final Float interestRate = new Float(6.0); final Float interestRate = Float.valueOf((float)6.0);
testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate); testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate);
} }
@@ -634,7 +635,7 @@ public class FixedDepositTest {
final String chartToUse = "amount_period"; final String chartToUse = "amount_period";
final String depositAmount = "10000"; final String depositAmount = "10000";
final String depositPeriod = "6"; final String depositPeriod = "6";
final Float interestRate = new Float(7.0); final Float interestRate = Float.valueOf((float)7.0);
testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate); testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate);
} }
@@ -1238,8 +1239,8 @@ public class FixedDepositTest {
DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US)); DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern("."); decimalFormat.applyPattern(".");
principal = new Float(decimalFormat.format(principal)); principal = Float.valueOf(decimalFormat.format(principal));
maturityAmount = new Float(decimalFormat.format(maturityAmount)); maturityAmount = Float.valueOf(decimalFormat.format(maturityAmount));
System.out.println(principal); System.out.println(principal);
Assert.assertEquals("Verifying Maturity amount for Fixed Deposit Account", principal, maturityAmount); Assert.assertEquals("Verifying Maturity amount for Fixed Deposit Account", principal, maturityAmount);
} }
@@ -1311,8 +1312,8 @@ public class FixedDepositTest {
interestPerDay, MONTHLY_INTERVAL, MONTHLY_INTERVAL); interestPerDay, MONTHLY_INTERVAL, MONTHLY_INTERVAL);
DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US)); DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern("."); decimalFormat.applyPattern(".");
principal = new Float(decimalFormat.format(principal)); principal = Float.valueOf(decimalFormat.format(principal));
maturityAmount = new Float(decimalFormat.format(maturityAmount)); maturityAmount = Float.valueOf(decimalFormat.format(maturityAmount));
System.out.println(principal); System.out.println(principal);
Assert.assertEquals("Verifying Maturity amount for Fixed Deposit Account", principal, maturityAmount); 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 decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern("."); decimalFormat.applyPattern(".");
principal = new Float(decimalFormat.format(principal)); principal = Float.valueOf(decimalFormat.format(principal));
Float maturityAmount = new Float(decimalFormat.format(fixedDepositAccountData.get("maturityAmount"))); Float maturityAmount = Float.valueOf(decimalFormat.format(fixedDepositAccountData.get("maturityAmount")));
Assert.assertEquals("Verifying Pre-Closure maturity amount", principal, 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 decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern("."); decimalFormat.applyPattern(".");
principal = new Float(decimalFormat.format(principal)); principal = Float.valueOf(decimalFormat.format(principal));
Float maturityAmount = new Float(decimalFormat.format(fixedDepositAccountData.get("maturityAmount"))); Float maturityAmount = Float.valueOf(decimalFormat.format(fixedDepositAccountData.get("maturityAmount")));
Assert.assertEquals("Verifying Pre-Closure maturity amount", principal, maturityAmount); Assert.assertEquals("Verifying Pre-Closure maturity amount", principal, maturityAmount);
@@ -1634,8 +1635,8 @@ public class FixedDepositTest {
fixedDepositAccountId); fixedDepositAccountId);
DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US)); DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern("."); decimalFormat.applyPattern(".");
Float expectedPrematureAmount = new Float(decimalFormat.format(principal)); Float expectedPrematureAmount = Float.valueOf(decimalFormat.format(principal));
Float maturityAmount = new Float(decimalFormat.format(fixedDepositAccountData.get("maturityAmount"))); Float maturityAmount = Float.valueOf(decimalFormat.format(fixedDepositAccountData.get("maturityAmount")));
Assert.assertEquals("Verifying Pre-Closure maturity amount", expectedPrematureAmount, maturityAmount); Assert.assertEquals("Verifying Pre-Closure maturity amount", expectedPrematureAmount, maturityAmount);
@@ -1750,8 +1751,8 @@ public class FixedDepositTest {
fixedDepositAccountId); fixedDepositAccountId);
DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US)); DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern("."); decimalFormat.applyPattern(".");
Float expectedPrematureAmount = new Float(decimalFormat.format(principal)); Float expectedPrematureAmount = Float.valueOf(decimalFormat.format(principal));
Float maturityAmount = new Float(decimalFormat.format(fixedDepositAccountData.get("maturityAmount"))); Float maturityAmount = Float.valueOf(decimalFormat.format(fixedDepositAccountData.get("maturityAmount")));
Assert.assertEquals("Verifying Pre-Closure maturity amount", expectedPrematureAmount, 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 decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern("."); decimalFormat.applyPattern(".");
principal = new Float(decimalFormat.format(principal)); principal = Float.valueOf(decimalFormat.format(principal));
maturityAmount = new Float(decimalFormat.format(maturityAmount)); maturityAmount = Float.valueOf(decimalFormat.format(maturityAmount));
System.out.println(principal); System.out.println(principal);
Assert.assertEquals("Verifying Maturity amount for Fixed Deposit Account", principal, maturityAmount); 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, principal = this.fixedDepositAccountHelper.getPrincipalAfterCompoundingInterest(todaysDate, principal, depositPeriod,
interestPerDay, DAILY_COMPOUNDING_INTERVAL, MONTHLY_INTERVAL); interestPerDay, DAILY_COMPOUNDING_INTERVAL, MONTHLY_INTERVAL);
principal = new BigDecimal(principal).setScale(0, BigDecimal.ROUND_FLOOR).floatValue(); principal = new BigDecimal(principal).setScale(0, RoundingMode.FLOOR).floatValue();
maturityAmount = new BigDecimal(maturityAmount).setScale(0, BigDecimal.ROUND_FLOOR).floatValue(); maturityAmount = new BigDecimal(maturityAmount).setScale(0, RoundingMode.FLOOR).floatValue();
System.out.println(principal); System.out.println(principal);
Assert.assertEquals("Verifying Maturity amount for Fixed Deposit Account", principal, maturityAmount); Assert.assertEquals("Verifying Maturity amount for Fixed Deposit Account", principal, maturityAmount);
@@ -1985,8 +1986,8 @@ public class FixedDepositTest {
fixedDepositAccountId); fixedDepositAccountId);
DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US)); DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern("."); decimalFormat.applyPattern(".");
Float expectedPrematureAmount = new Float(decimalFormat.format(principal)); Float expectedPrematureAmount = Float.valueOf(decimalFormat.format(principal));
Float maturityAmount = new Float(decimalFormat.format(fixedDepositAccountData.get("maturityAmount"))); Float maturityAmount = Float.valueOf(decimalFormat.format(fixedDepositAccountData.get("maturityAmount")));
Assert.assertEquals("Verifying Maturity amount", expectedPrematureAmount, maturityAmount); Assert.assertEquals("Verifying Maturity amount", expectedPrematureAmount, maturityAmount);
@@ -2069,8 +2070,8 @@ public class FixedDepositTest {
fixedDepositAccountId); fixedDepositAccountId);
DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US)); DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern("."); decimalFormat.applyPattern(".");
Float expectedPrematureAmount = new Float(decimalFormat.format(principal)); Float expectedPrematureAmount = Float.valueOf(decimalFormat.format(principal));
Float maturityAmount = new Float(decimalFormat.format(fixedDepositAccountData.get("maturityAmount"))); Float maturityAmount = Float.valueOf(decimalFormat.format(fixedDepositAccountData.get("maturityAmount")));
Assert.assertEquals("Verifying Maturity amount", expectedPrematureAmount, maturityAmount); Assert.assertEquals("Verifying Maturity amount", expectedPrematureAmount, maturityAmount);
@@ -2151,8 +2152,8 @@ public class FixedDepositTest {
fixedDepositAccountId); fixedDepositAccountId);
DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US)); DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern("."); decimalFormat.applyPattern(".");
Float expectedPrematureAmount = new Float(decimalFormat.format(principal)); Float expectedPrematureAmount = Float.valueOf(decimalFormat.format(principal));
Float maturityAmount = new Float(decimalFormat.format(fixedDepositAccountData.get("maturityAmount"))); Float maturityAmount = Float.valueOf(decimalFormat.format(fixedDepositAccountData.get("maturityAmount")));
Assert.assertEquals("Verifying Pre-Closure maturity amount", expectedPrematureAmount, maturityAmount); Assert.assertEquals("Verifying Pre-Closure maturity amount", expectedPrematureAmount, maturityAmount);
@@ -2233,8 +2234,8 @@ public class FixedDepositTest {
fixedDepositAccountId); fixedDepositAccountId);
DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US)); DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern("."); decimalFormat.applyPattern(".");
Float expectedPrematureAmount = new Float(decimalFormat.format(principal)); Float expectedPrematureAmount = Float.valueOf(decimalFormat.format(principal));
Float maturityAmount = new Float(decimalFormat.format(fixedDepositAccountData.get("maturityAmount"))); Float maturityAmount = Float.valueOf(decimalFormat.format(fixedDepositAccountData.get("maturityAmount")));
Assert.assertEquals("Verifying Pre-Closure maturity amount", expectedPrematureAmount, maturityAmount); Assert.assertEquals("Verifying Pre-Closure maturity amount", expectedPrematureAmount, maturityAmount);
@@ -2315,8 +2316,8 @@ public class FixedDepositTest {
fixedDepositAccountId); fixedDepositAccountId);
DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US)); DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern("."); decimalFormat.applyPattern(".");
Float expectedPrematureAmount = new Float(decimalFormat.format(principal)); Float expectedPrematureAmount = Float.valueOf(decimalFormat.format(principal));
Float maturityAmount = new Float(decimalFormat.format(fixedDepositAccountData.get("maturityAmount"))); Float maturityAmount = Float.valueOf(decimalFormat.format(fixedDepositAccountData.get("maturityAmount")));
Assert.assertEquals("Verifying Pre-Closure maturity amount", expectedPrematureAmount, maturityAmount); Assert.assertEquals("Verifying Pre-Closure maturity amount", expectedPrematureAmount, maturityAmount);
} }
@@ -2396,8 +2397,8 @@ public class FixedDepositTest {
fixedDepositAccountId); fixedDepositAccountId);
DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US)); DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern("."); decimalFormat.applyPattern(".");
Float expectedPrematureAmount = new Float(decimalFormat.format(principal)); Float expectedPrematureAmount = Float.valueOf(decimalFormat.format(principal));
Float maturityAmount = new Float(decimalFormat.format(fixedDepositAccountData.get("maturityAmount"))); Float maturityAmount = Float.valueOf(decimalFormat.format(fixedDepositAccountData.get("maturityAmount")));
Assert.assertEquals("Verifying Pre-Closure maturity amount", expectedPrematureAmount, maturityAmount); Assert.assertEquals("Verifying Pre-Closure maturity amount", expectedPrematureAmount, maturityAmount);
} }
@@ -18,11 +18,13 @@
*/ */
package org.apache.fineract.integrationtests; package org.apache.fineract.integrationtests;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.greaterThanOrEqualTo; import static org.hamcrest.Matchers.greaterThanOrEqualTo;
import static org.hamcrest.Matchers.hasItem; import static org.hamcrest.Matchers.hasItem;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import io.restassured.builder.RequestSpecBuilder; import io.restassured.builder.RequestSpecBuilder;
import io.restassured.builder.ResponseSpecBuilder; import io.restassured.builder.ResponseSpecBuilder;
import io.restassured.http.ContentType; import io.restassured.http.ContentType;
@@ -191,15 +193,15 @@ public class FundsIntegrationTest {
List<FundsHelper> fhList = FundsResourceHandler.retrieveAllFunds(this.requestSpec, this.statusOkResponseSpec); List<FundsHelper> fhList = FundsResourceHandler.retrieveAllFunds(this.requestSpec, this.statusOkResponseSpec);
Assert.assertNotNull(fhList); Assert.assertNotNull(fhList);
Assert.assertThat(fhList.size(), greaterThanOrEqualTo(1)); assertThat(fhList.size(), greaterThanOrEqualTo(1));
Assert.assertThat(fhList, hasItem(fh)); assertThat(fhList, hasItem(fh));
} }
@Test @Test
public void testRetrieveUnknownFund() { public void testRetrieveUnknownFund() {
ResponseSpecification responseSpec = new ResponseSpecBuilder().expectStatusCode(404).build(); ResponseSpecification responseSpec = new ResponseSpecBuilder().expectStatusCode(404).build();
String jsonData = FundsResourceHandler.retrieveFund(Long.MAX_VALUE, this.requestSpec, responseSpec); String jsonData = FundsResourceHandler.retrieveFund(Long.MAX_VALUE, this.requestSpec, responseSpec);
HashMap<String, String> map = new Gson().fromJson(jsonData, HashMap.class); HashMap<String, Object> map = new Gson().fromJson(jsonData, new TypeToken<HashMap<String, Object>>(){}.getType());
assertEquals(map.get("userMessageGlobalisationCode"), "error.msg.resource.not.found"); assertEquals(map.get("userMessageGlobalisationCode"), "error.msg.resource.not.found");
} }
@@ -249,22 +249,22 @@ public class GroupLoanIntegrationTest {
assertEquals("Checking for Due Date for 1st Month", new ArrayList<>(Arrays.asList(2011, 10, 20)), assertEquals("Checking for Due Date for 1st Month", new ArrayList<>(Arrays.asList(2011, 10, 20)),
loanSchedule.get(1).get("dueDate")); 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 Principal Due for 1st Month", Float.valueOf("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 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)), assertEquals("Checking for Due Date for 2nd Month", new ArrayList<>(Arrays.asList(2011, 11, 20)),
loanSchedule.get(2).get("dueDate")); 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 Principal Due for 2nd Month", Float.valueOf("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 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)), assertEquals("Checking for Due Date for 3rd Month", new ArrayList<>(Arrays.asList(2011, 12, 20)),
loanSchedule.get(3).get("dueDate")); 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 Principal Due for 3rd Month", Float.valueOf("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 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)), assertEquals("Checking for Due Date for 4th Month", new ArrayList<>(Arrays.asList(2012, 1, 20)),
loanSchedule.get(4).get("dueDate")); 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 Principal Due for 4th Month", Float.valueOf("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 Interest Due for 4th Month", Float.valueOf("61.79"), loanSchedule.get(4).get("interestOriginalDue"));
} }
} }
@@ -574,28 +574,28 @@ public class GroupSavingsIntegrationTest {
SavingsStatusChecker.verifySavingsIsActive(savingsStatusHashMap); SavingsStatusChecker.verifySavingsIsActive(savingsStatusHashMap);
HashMap summary = this.savingsAccountHelper.getSavingsSummary(savingsId); 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")); assertEquals("Verifying opening Balance", balance, summary.get("accountBalance"));
Integer depositTransactionId = (Integer) this.savingsAccountHelper.depositToSavingsAccount(savingsId, DEPOSIT_AMOUNT, Integer depositTransactionId = (Integer) this.savingsAccountHelper.depositToSavingsAccount(savingsId, DEPOSIT_AMOUNT,
SavingsAccountHelper.TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID); SavingsAccountHelper.TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID);
HashMap depositTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, depositTransactionId); HashMap depositTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, depositTransactionId);
balance += new Float(DEPOSIT_AMOUNT); balance += Float.valueOf(DEPOSIT_AMOUNT);
assertEquals("Verifying Deposit Amount", new Float(DEPOSIT_AMOUNT), depositTransaction.get("amount")); assertEquals("Verifying Deposit Amount", Float.valueOf(DEPOSIT_AMOUNT), depositTransaction.get("amount"));
assertEquals("Verifying Balance after Deposit", balance, depositTransaction.get("runningBalance")); assertEquals("Verifying Balance after Deposit", balance, depositTransaction.get("runningBalance"));
Integer withdrawTransactionId = (Integer) this.savingsAccountHelper.withdrawalFromSavingsAccount(savingsId, WITHDRAW_AMOUNT, Integer withdrawTransactionId = (Integer) this.savingsAccountHelper.withdrawalFromSavingsAccount(savingsId, WITHDRAW_AMOUNT,
SavingsAccountHelper.TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID); SavingsAccountHelper.TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID);
HashMap withdrawTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, withdrawTransactionId); HashMap withdrawTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, withdrawTransactionId);
balance -= new Float(WITHDRAW_AMOUNT); balance -= Float.valueOf(WITHDRAW_AMOUNT);
assertEquals("Verifying Withdrawal Amount", new Float(WITHDRAW_AMOUNT), withdrawTransaction.get("amount")); assertEquals("Verifying Withdrawal Amount", Float.valueOf(WITHDRAW_AMOUNT), withdrawTransaction.get("amount"));
assertEquals("Verifying Balance after Withdrawal", balance, withdrawTransaction.get("runningBalance")); assertEquals("Verifying Balance after Withdrawal", balance, withdrawTransaction.get("runningBalance"));
Integer newWithdrawTransactionId = this.savingsAccountHelper.updateSavingsAccountTransaction(savingsId, withdrawTransactionId, Integer newWithdrawTransactionId = this.savingsAccountHelper.updateSavingsAccountTransaction(savingsId, withdrawTransactionId,
WITHDRAW_AMOUNT_ADJUSTED); WITHDRAW_AMOUNT_ADJUSTED);
HashMap newWithdrawTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, newWithdrawTransactionId); HashMap newWithdrawTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, newWithdrawTransactionId);
balance = balance + new Float(WITHDRAW_AMOUNT) - new Float(WITHDRAW_AMOUNT_ADJUSTED); balance = balance + Float.valueOf(WITHDRAW_AMOUNT) - Float.valueOf(WITHDRAW_AMOUNT_ADJUSTED);
assertEquals("Verifying adjusted Amount", new Float(WITHDRAW_AMOUNT_ADJUSTED), newWithdrawTransaction.get("amount")); assertEquals("Verifying adjusted Amount", Float.valueOf(WITHDRAW_AMOUNT_ADJUSTED), newWithdrawTransaction.get("amount"));
assertEquals("Verifying Balance after adjust", balance, newWithdrawTransaction.get("runningBalance")); assertEquals("Verifying Balance after adjust", balance, newWithdrawTransaction.get("runningBalance"));
summary = this.savingsAccountHelper.getSavingsSummary(savingsId); summary = this.savingsAccountHelper.getSavingsSummary(savingsId);
assertEquals("Verifying Adjusted Balance", balance, summary.get("accountBalance")); assertEquals("Verifying Adjusted Balance", balance, summary.get("accountBalance"));
@@ -606,7 +606,7 @@ public class GroupSavingsIntegrationTest {
newWithdrawTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, withdrawTransactionId); newWithdrawTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, withdrawTransactionId);
Assert.assertTrue((Boolean) newWithdrawTransaction.get("reversed")); Assert.assertTrue((Boolean) newWithdrawTransaction.get("reversed"));
summary = this.savingsAccountHelper.getSavingsSummary(savingsId); 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")); assertEquals("Verifying Balance After Undo Transaction", balance, summary.get("accountBalance"));
error = (List) savingsAccountHelperValidationError.withdrawalFromSavingsAccount(savingsId, "5000", error = (List) savingsAccountHelperValidationError.withdrawalFromSavingsAccount(savingsId, "5000",
@@ -210,20 +210,20 @@ public class LoanDisbursementDetailsIntegrationTest {
assertEquals(period.get("dueDate").toString(), expectedRepaymentSchedule.getDueDate()); assertEquals(period.get("dueDate").toString(), expectedRepaymentSchedule.getDueDate());
assertEquals(period.get("principalLoanBalanceOutstanding"), expectedRepaymentSchedule.getPrincipalLoanBalanceOutstanding()); assertEquals(period.get("principalLoanBalanceOutstanding"), expectedRepaymentSchedule.getPrincipalLoanBalanceOutstanding());
System.out.println(period.get("totalOriginalDueForPeriod").toString()); 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); .getTotalOriginalDueForPeriod().floatValue(), 0.0f);
assertEquals(new Float(period.get("totalOutstandingForPeriod").toString()).floatValue(), assertEquals(Float.valueOf(period.get("totalOutstandingForPeriod").toString()).floatValue(),
expectedRepaymentSchedule.getTotalOutstandingForPeriod(), 0.0f); expectedRepaymentSchedule.getTotalOutstandingForPeriod(), 0.0f);
if (position != 0 && position != 3) { 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); expectedRepaymentSchedule.getInterestOutstanding(), 0.0f);
assertEquals(new Float(period.get("principalOutstanding").toString()).floatValue(), assertEquals(Float.valueOf(period.get("principalOutstanding").toString()).floatValue(),
expectedRepaymentSchedule.getPrincipalOutstanding(), 0.0f); expectedRepaymentSchedule.getPrincipalOutstanding(), 0.0f);
assertEquals(new Float(period.get("principalDue").toString()).floatValue(), expectedRepaymentSchedule.getPrincipalDue(), 0.0f); assertEquals(Float.valueOf(period.get("principalDue").toString()).floatValue(), expectedRepaymentSchedule.getPrincipalDue(), 0.0f);
assertEquals(new Float(period.get("principalOriginalDue").toString()).floatValue(), assertEquals(Float.valueOf(period.get("principalOriginalDue").toString()).floatValue(),
expectedRepaymentSchedule.getPrincipalOriginalDue(), 0.0f); expectedRepaymentSchedule.getPrincipalOriginalDue(), 0.0f);
assertEquals(period.get("fromDate").toString(), expectedRepaymentSchedule.getFromDate()); assertEquals(period.get("fromDate").toString(), expectedRepaymentSchedule.getFromDate());
} }
@@ -160,21 +160,21 @@ public class LoanWithWaiveInterestAndWriteOffIntegrationTest {
HashMap toLoanSummaryAfter = this.loanTransactionHelper.getLoanSummary(requestSpec, responseSpec, loanID); HashMap toLoanSummaryAfter = this.loanTransactionHelper.getLoanSummary(requestSpec, responseSpec, loanID);
Assert.assertTrue("Checking for Principal paid ", 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 ", 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 ", 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 // WRITE OFF LOAN AND CHECK ACCOUNT IS CLOSED
LoanStatusChecker.verifyLoanAccountIsClosed(this.loanTransactionHelper.writeOffLoan("1 January 2011", loanID)); LoanStatusChecker.verifyLoanAccountIsClosed(this.loanTransactionHelper.writeOffLoan("1 January 2011", loanID));
toLoanSummaryAfter = this.loanTransactionHelper.getLoanSummary(requestSpec, responseSpec, loanID); toLoanSummaryAfter = this.loanTransactionHelper.getLoanSummary(requestSpec, responseSpec, loanID);
Assert.assertTrue("Checking for Principal written off ", 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 ", 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 ", 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);
} }
@@ -1429,8 +1429,8 @@ public class RecurringDepositTest {
DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US)); DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern("."); decimalFormat.applyPattern(".");
principal = new Float(decimalFormat.format(principal)); principal = Float.valueOf(decimalFormat.format(principal));
maturityAmount = new Float(decimalFormat.format(maturityAmount)); maturityAmount = Float.valueOf(decimalFormat.format(maturityAmount));
System.out.println(principal); System.out.println(principal);
Assert.assertEquals("Verifying Maturity amount for Recurring Deposit Account", principal, maturityAmount); 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 decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern("."); decimalFormat.applyPattern(".");
principal = new Float(decimalFormat.format(principal)); principal = Float.valueOf(decimalFormat.format(principal));
maturityAmount = new Float(decimalFormat.format(maturityAmount)); maturityAmount = Float.valueOf(decimalFormat.format(maturityAmount));
System.out.println(principal); System.out.println(principal);
Assert.assertEquals("Verifying Maturity amount for Recurring Deposit Account", principal, maturityAmount); 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 currentDate = Integer.valueOf(currentDateFormat.format(todaysDate.getTime()));
Integer daysInMonth = todaysDate.getActualMaximum(Calendar.DATE); Integer daysInMonth = todaysDate.getActualMaximum(Calendar.DATE);
daysInMonth = (daysInMonth - currentDate) + 1; daysInMonth = (daysInMonth - currentDate) + 1;
Float interestToBePosted = new Float(decimalFormat.format(interestPerDay * principal * daysInMonth)); Float interestToBePosted = Float.valueOf(decimalFormat.format(interestPerDay * principal * daysInMonth));
principal += interestToBePosted; principal += interestToBePosted;
Float expectedBalanceAfter = new Float(decimalFormat.format(principal)); Float expectedBalanceAfter = Float.valueOf(decimalFormat.format(principal));
System.out.println(expectedBalanceAfter); System.out.println(expectedBalanceAfter);
Integer transactionIdForPostInterest = this.recurringDepositAccountHelper Integer transactionIdForPostInterest = this.recurringDepositAccountHelper
@@ -1607,8 +1607,8 @@ public class RecurringDepositTest {
Assert.assertNotNull(transactionIdForPostInterest); Assert.assertNotNull(transactionIdForPostInterest);
HashMap recurringDepositAccountSummary = this.recurringDepositAccountHelper.getRecurringDepositSummary(recurringDepositAccountId); HashMap recurringDepositAccountSummary = this.recurringDepositAccountHelper.getRecurringDepositSummary(recurringDepositAccountId);
Float interestAmountPosted = new Float(decimalFormat.format(recurringDepositAccountSummary.get("totalInterestPosted"))); Float interestAmountPosted = Float.valueOf(decimalFormat.format(recurringDepositAccountSummary.get("totalInterestPosted")));
Float principalAfter = new Float(decimalFormat.format(recurringDepositAccountSummary.get("accountBalance"))); 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 Amount of Interest Posted to Recurring Deposit Account", interestToBePosted, interestAmountPosted);
Assert.assertEquals("Verifying Principal Amount after Interest Posting", expectedBalanceAfter, principalAfter); 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 decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern("."); decimalFormat.applyPattern(".");
principal = new Float(decimalFormat.format(principal)); principal = Float.valueOf(decimalFormat.format(principal));
Float maturityAmount = new Float(decimalFormat.format(recurringDepositAccountData.get("maturityAmount"))); Float maturityAmount = Float.valueOf(decimalFormat.format(recurringDepositAccountData.get("maturityAmount")));
Assert.assertEquals("Verifying Pre-Closure maturity amount", principal, 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 decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern("."); decimalFormat.applyPattern(".");
principal = new Float(decimalFormat.format(principal)); principal = Float.valueOf(decimalFormat.format(principal));
Float maturityAmount = new Float(decimalFormat.format(recurringDepositAccountData.get("maturityAmount"))); Float maturityAmount = Float.valueOf(decimalFormat.format(recurringDepositAccountData.get("maturityAmount")));
Assert.assertEquals("Verifying Pre-Closure maturity amount", principal, 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 decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern("."); decimalFormat.applyPattern(".");
principal = new Float(decimalFormat.format(principal)); principal = Float.valueOf(decimalFormat.format(principal));
Float maturityAmount = new Float(decimalFormat.format(recurringDepositAccountData.get("maturityAmount"))); Float maturityAmount = Float.valueOf(decimalFormat.format(recurringDepositAccountData.get("maturityAmount")));
Assert.assertEquals("Verifying Pre-Closure maturity amount", principal, 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 decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern("."); decimalFormat.applyPattern(".");
principal = new Float(decimalFormat.format(principal)); principal = Float.valueOf(decimalFormat.format(principal));
Float maturityAmount = new Float(decimalFormat.format(recurringDepositAccountData.get("maturityAmount"))); Float maturityAmount = Float.valueOf(decimalFormat.format(recurringDepositAccountData.get("maturityAmount")));
Assert.assertEquals("Verifying Pre-Closure maturity amount", principal, 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 decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern("."); decimalFormat.applyPattern(".");
principal = new Float(decimalFormat.format(principal)); principal = Float.valueOf(decimalFormat.format(principal));
maturityAmount = new Float(decimalFormat.format(maturityAmount)); maturityAmount = Float.valueOf(decimalFormat.format(maturityAmount));
System.out.println(principal); System.out.println(principal);
Assert.assertEquals("Verifying Maturity amount for Recurring Deposit Account", principal, maturityAmount); 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 decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern("."); decimalFormat.applyPattern(".");
principal = new Float(decimalFormat.format(principal)); principal = Float.valueOf(decimalFormat.format(principal));
maturityAmount = new Float(decimalFormat.format(maturityAmount)); maturityAmount = Float.valueOf(decimalFormat.format(maturityAmount));
System.out.println(principal); System.out.println(principal);
Assert.assertEquals("Verifying Maturity amount for Recurring Deposit Account", principal, maturityAmount); Assert.assertEquals("Verifying Maturity amount for Recurring Deposit Account", principal, maturityAmount);
@@ -2412,8 +2412,8 @@ public class RecurringDepositTest {
this.responseSpec, recurringDepositAccountId); this.responseSpec, recurringDepositAccountId);
DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US)); DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern("."); decimalFormat.applyPattern(".");
Float expectedPrematureAmount = new Float(decimalFormat.format(principal)); Float expectedPrematureAmount = Float.valueOf(decimalFormat.format(principal));
Float maturityAmount = new Float(decimalFormat.format(recurringDepositAccountData.get("maturityAmount"))); Float maturityAmount = Float.valueOf(decimalFormat.format(recurringDepositAccountData.get("maturityAmount")));
Assert.assertEquals("Verifying Pre-Closure maturity amount", expectedPrematureAmount, maturityAmount); Assert.assertEquals("Verifying Pre-Closure maturity amount", expectedPrematureAmount, maturityAmount);
@@ -2503,8 +2503,8 @@ public class RecurringDepositTest {
this.responseSpec, recurringDepositAccountId); this.responseSpec, recurringDepositAccountId);
DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US)); DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern("."); decimalFormat.applyPattern(".");
Float expectedPrematureAmount = new Float(decimalFormat.format(principal)); Float expectedPrematureAmount = Float.valueOf(decimalFormat.format(principal));
Float maturityAmount = new Float(decimalFormat.format(recurringDepositAccountData.get("maturityAmount"))); Float maturityAmount = Float.valueOf(decimalFormat.format(recurringDepositAccountData.get("maturityAmount")));
Assert.assertEquals("Verifying Pre-Closure maturity amount", expectedPrematureAmount, maturityAmount); Assert.assertEquals("Verifying Pre-Closure maturity amount", expectedPrematureAmount, maturityAmount);
@@ -2594,8 +2594,8 @@ public class RecurringDepositTest {
this.responseSpec, recurringDepositAccountId); this.responseSpec, recurringDepositAccountId);
DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US)); DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern("."); decimalFormat.applyPattern(".");
Float expectedPrematureAmount = new Float(decimalFormat.format(principal)); Float expectedPrematureAmount = Float.valueOf(decimalFormat.format(principal));
Float maturityAmount = new Float(decimalFormat.format(recurringDepositAccountData.get("maturityAmount"))); Float maturityAmount = Float.valueOf(decimalFormat.format(recurringDepositAccountData.get("maturityAmount")));
Assert.assertEquals("Verifying Maturity amount", expectedPrematureAmount, maturityAmount); Assert.assertEquals("Verifying Maturity amount", expectedPrematureAmount, maturityAmount);
@@ -2685,8 +2685,8 @@ public class RecurringDepositTest {
this.responseSpec, recurringDepositAccountId); this.responseSpec, recurringDepositAccountId);
DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US)); DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern("."); decimalFormat.applyPattern(".");
Float expectedPrematureAmount = new Float(decimalFormat.format(principal)); Float expectedPrematureAmount = Float.valueOf(decimalFormat.format(principal));
Float maturityAmount = new Float(decimalFormat.format(recurringDepositAccountData.get("maturityAmount"))); Float maturityAmount = Float.valueOf(decimalFormat.format(recurringDepositAccountData.get("maturityAmount")));
Assert.assertEquals("Verifying Maturity amount", expectedPrematureAmount, maturityAmount); Assert.assertEquals("Verifying Maturity amount", expectedPrematureAmount, maturityAmount);
@@ -2776,8 +2776,8 @@ public class RecurringDepositTest {
this.responseSpec, recurringDepositAccountId); this.responseSpec, recurringDepositAccountId);
DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US)); DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern("."); decimalFormat.applyPattern(".");
Float expectedPrematureAmount = new Float(decimalFormat.format(principal)); Float expectedPrematureAmount = Float.valueOf(decimalFormat.format(principal));
Float maturityAmount = new Float(decimalFormat.format(recurringDepositAccountData.get("maturityAmount"))); Float maturityAmount = Float.valueOf(decimalFormat.format(recurringDepositAccountData.get("maturityAmount")));
Assert.assertEquals("Verifying Pre-Closure maturity amount", expectedPrematureAmount, maturityAmount); Assert.assertEquals("Verifying Pre-Closure maturity amount", expectedPrematureAmount, maturityAmount);
@@ -2867,8 +2867,8 @@ public class RecurringDepositTest {
this.responseSpec, recurringDepositAccountId); this.responseSpec, recurringDepositAccountId);
DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US)); DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern("."); decimalFormat.applyPattern(".");
Float expectedPrematureAmount = new Float(decimalFormat.format(principal)); Float expectedPrematureAmount = Float.valueOf(decimalFormat.format(principal));
Float maturityAmount = new Float(decimalFormat.format(recurringDepositAccountData.get("maturityAmount"))); Float maturityAmount = Float.valueOf(decimalFormat.format(recurringDepositAccountData.get("maturityAmount")));
Assert.assertEquals("Verifying Pre-Closure maturity amount", expectedPrematureAmount, maturityAmount); Assert.assertEquals("Verifying Pre-Closure maturity amount", expectedPrematureAmount, maturityAmount);
@@ -2879,7 +2879,7 @@ public class RecurringDepositTest {
final String chartToUse = "period"; final String chartToUse = "period";
final String depositAmount = "1000"; final String depositAmount = "1000";
final String depositPeriod = "12"; final String depositPeriod = "12";
final Float interestRate = new Float(6.0); final Float interestRate = Float.valueOf((float)6.0);
testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate); testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate);
} }
@@ -2888,7 +2888,7 @@ public class RecurringDepositTest {
final String chartToUse = "period"; final String chartToUse = "period";
final String depositAmount = "10000"; final String depositAmount = "10000";
final String depositPeriod = "12"; final String depositPeriod = "12";
final Float interestRate = new Float(6.0); final Float interestRate = Float.valueOf((float)6.0);
testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate); testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate);
} }
@@ -2897,7 +2897,7 @@ public class RecurringDepositTest {
final String chartToUse = "period"; final String chartToUse = "period";
final String depositAmount = "1000"; final String depositAmount = "1000";
final String depositPeriod = "18"; final String depositPeriod = "18";
final Float interestRate = new Float(7.0); final Float interestRate = Float.valueOf((float)7.0);
testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate); testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate);
} }
@@ -2906,7 +2906,7 @@ public class RecurringDepositTest {
final String chartToUse = "amount"; final String chartToUse = "amount";
final String depositAmount = "1000"; final String depositAmount = "1000";
final String depositPeriod = "12"; final String depositPeriod = "12";
final Float interestRate = new Float(8.0); final Float interestRate = Float.valueOf((float)8.0);
testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate); testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate);
} }
@@ -2915,7 +2915,7 @@ public class RecurringDepositTest {
final String chartToUse = "amount"; final String chartToUse = "amount";
final String depositAmount = "500"; final String depositAmount = "500";
final String depositPeriod = "12"; final String depositPeriod = "12";
final Float interestRate = new Float(7.0); final Float interestRate = Float.valueOf((float)7.0);
testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate); testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate);
} }
@@ -2924,7 +2924,7 @@ public class RecurringDepositTest {
final String chartToUse = "amount"; final String chartToUse = "amount";
final String depositAmount = "500"; final String depositAmount = "500";
final String depositPeriod = "10"; final String depositPeriod = "10";
final Float interestRate = new Float(5.0); final Float interestRate = Float.valueOf((float)5.0);
testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate); testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate);
} }
@@ -2933,7 +2933,7 @@ public class RecurringDepositTest {
final String chartToUse = "period_amount"; final String chartToUse = "period_amount";
final String depositAmount = "1000"; final String depositAmount = "1000";
final String depositPeriod = "12"; final String depositPeriod = "12";
final Float interestRate = new Float(7.0); final Float interestRate = Float.valueOf((float)7.0);
testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate); testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate);
} }
@@ -2942,7 +2942,7 @@ public class RecurringDepositTest {
final String chartToUse = "period_amount"; final String chartToUse = "period_amount";
final String depositAmount = "400"; final String depositAmount = "400";
final String depositPeriod = "12"; final String depositPeriod = "12";
final Float interestRate = new Float(6.0); final Float interestRate = Float.valueOf((float)6.0);
testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate); testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate);
} }
@@ -2951,7 +2951,7 @@ public class RecurringDepositTest {
final String chartToUse = "period_amount"; final String chartToUse = "period_amount";
final String depositAmount = "1000"; final String depositAmount = "1000";
final String depositPeriod = "14"; final String depositPeriod = "14";
final Float interestRate = new Float(8.0); final Float interestRate = Float.valueOf((float)8.0);
testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate); testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate);
} }
@@ -2960,7 +2960,7 @@ public class RecurringDepositTest {
final String chartToUse = "amount_period"; final String chartToUse = "amount_period";
final String depositAmount = "1000"; final String depositAmount = "1000";
final String depositPeriod = "12"; final String depositPeriod = "12";
final Float interestRate = new Float(8.0); final Float interestRate = Float.valueOf((float)8.0);
testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate); testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate);
} }
@@ -2969,7 +2969,7 @@ public class RecurringDepositTest {
final String chartToUse = "amount_period"; final String chartToUse = "amount_period";
final String depositAmount = "100"; final String depositAmount = "100";
final String depositPeriod = "12"; final String depositPeriod = "12";
final Float interestRate = new Float(6.0); final Float interestRate = Float.valueOf((float)6.0);
testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate); testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate);
} }
@@ -2978,7 +2978,7 @@ public class RecurringDepositTest {
final String chartToUse = "amount_period"; final String chartToUse = "amount_period";
final String depositAmount = "1000"; final String depositAmount = "1000";
final String depositPeriod = "6"; final String depositPeriod = "6";
final Float interestRate = new Float(7.0); final Float interestRate = Float.valueOf((float)7.0);
testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate); testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate);
} }
@@ -79,7 +79,7 @@ public class SchedulerJobsTestResults {
public static final String ACCOUNT_TYPE_INDIVIDUAL = "INDIVIDUAL"; public static final String ACCOUNT_TYPE_INDIVIDUAL = "INDIVIDUAL";
public static final String MINIMUM_OPENING_BALANCE = "1000"; 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 ResponseSpecification responseSpec;
private static RequestSpecification requestSpec; private static RequestSpecification requestSpec;
@@ -864,7 +864,7 @@ public class SchedulerJobsTestResults {
Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec); Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec);
Assert.assertNotNull(clientId); 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)); final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, String.valueOf(balance));
Assert.assertNotNull(savingsProductID); Assert.assertNotNull(savingsProductID);
@@ -900,22 +900,22 @@ public class SchedulerJobsTestResults {
fixedDepositAccountStatusHashMap = fixedDepositAccountHelper.activateFixedDeposit(fixedDepositAccountId, ACTIVATION_DATE); fixedDepositAccountStatusHashMap = fixedDepositAccountHelper.activateFixedDeposit(fixedDepositAccountId, ACTIVATION_DATE);
FixedDepositAccountStatusChecker.verifyFixedDepositIsActive(fixedDepositAccountStatusHashMap); FixedDepositAccountStatusChecker.verifyFixedDepositIsActive(fixedDepositAccountStatusHashMap);
summary = savingsAccountHelper.getSavingsSummary(savingsId); summary = savingsAccountHelper.getSavingsSummary(savingsId);
balance = new Float(MINIMUM_OPENING_BALANCE); balance = Float.valueOf(MINIMUM_OPENING_BALANCE);
assertEquals("Verifying Balance", balance, summary.get("accountBalance")); assertEquals("Verifying Balance", balance, summary.get("accountBalance"));
fixedDepositAccountHelper.postInterestForFixedDeposit(fixedDepositAccountId); fixedDepositAccountHelper.postInterestForFixedDeposit(fixedDepositAccountId);
HashMap fixedDepositSummary = savingsAccountHelper.getSavingsSummary(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"; String JobName = "Transfer Interest To Savings";
this.schedulerJobHelper.executeJob(JobName); this.schedulerJobHelper.executeJob(JobName);
fixedDepositSummary = savingsAccountHelper.getSavingsSummary(fixedDepositAccountId); fixedDepositSummary = savingsAccountHelper.getSavingsSummary(fixedDepositAccountId);
assertEquals("Verifying opening Balance", new Float(FixedDepositAccountHelper.depositAmount), assertEquals("Verifying opening Balance", Float.valueOf(FixedDepositAccountHelper.depositAmount),
fixedDepositSummary.get("accountBalance")); fixedDepositSummary.get("accountBalance"));
summary = savingsAccountHelper.getSavingsSummary(savingsId); 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"))); validateNumberForEqualExcludePrecission(String.valueOf(balance), String.valueOf(summary.get("accountBalance")));
} }
@@ -998,6 +998,6 @@ public class SchedulerJobsTestResults {
private void validateNumberForEqualExcludePrecission(String val, String val2) { private void validateNumberForEqualExcludePrecission(String val, String val2) {
DecimalFormat twoDForm = new DecimalFormat("#", new DecimalFormatSymbols(Locale.US)); 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);
} }
} }
@@ -132,7 +132,7 @@ public class StaffTest {
@Test @Test
public void testStaffListStatusActive() { public void testStaffListStatusActive() {
final List<HashMap> responseActive = (List<HashMap>) StaffHelper.getStaffListWithState(requestSpec, responseSpec, "active"); final List<HashMap> responseActive = (List<HashMap>)StaffHelper.getStaffListWithState(requestSpec, responseSpec, "active");
for(final HashMap staff : responseActive) { for(final HashMap staff : responseActive) {
Assert.assertNotNull(staff.get("id")); Assert.assertNotNull(staff.get("id"));
Assert.assertEquals(staff.get("isActive"), true); Assert.assertEquals(staff.get("isActive"), true);
@@ -141,7 +141,7 @@ public class StaffTest {
@Test @Test
public void testStaffListStatusInactive() { public void testStaffListStatusInactive() {
final List<HashMap> responseInactive = (List<HashMap>) StaffHelper.getStaffListWithState(requestSpec, responseSpec, "inactive"); final List<HashMap> responseInactive = (List<HashMap>)StaffHelper.getStaffListWithState(requestSpec, responseSpec, "inactive");
for(final HashMap staff : responseInactive) { for(final HashMap staff : responseInactive) {
Assert.assertNotNull(staff.get("id")); Assert.assertNotNull(staff.get("id"));
@@ -29,7 +29,7 @@ public class CenterDomain implements Comparable<CenterDomain> {
private Integer id; private Integer id;
private String accountNo; private String accountNo;
private HashMap status; private HashMap<String, Object> status;
private boolean active; private boolean active;
private String name; private String name;
private String externalId; private String externalId;
@@ -43,7 +43,7 @@ public class CenterDomain implements Comparable<CenterDomain> {
final String name, final String externalId, final Integer staffId, final int officeID, final String officeName, final String name, final String externalId, final Integer staffId, final int officeID, final String officeName,
final String hierarchy, final ArrayList<HashMap> groupMembers) { final String hierarchy, final ArrayList<HashMap> groupMembers) {
this.id = id; this.id = id;
this.status = new HashMap(); this.status = new HashMap<String, Object>();
this.status.put("id", statusid); this.status.put("id", statusid);
this.status.put("code", statuscode); this.status.put("code", statuscode);
this.status.put("value", statusvalue); this.status.put("value", statusvalue);
@@ -67,7 +67,7 @@ public class CenterDomain implements Comparable<CenterDomain> {
private Integer id; private Integer id;
private String accountNo; private String accountNo;
private HashMap status; private HashMap<String, Object> status;
private boolean active; private boolean active;
private String name; private String name;
private String externalId; private String externalId;
@@ -86,7 +86,7 @@ public class CenterDomain implements Comparable<CenterDomain> {
final String hierarchy, final ArrayList<HashMap> groupMembers) { final String hierarchy, final ArrayList<HashMap> groupMembers) {
this.id = id; this.id = id;
this.accountNo = accountNo; this.accountNo = accountNo;
this.status = new HashMap(); this.status = new HashMap<String, Object>();
this.status.put("id", statusid); this.status.put("id", statusid);
this.status.put("code", statuscode); this.status.put("code", statuscode);
this.status.put("value", statusvalue); this.status.put("value", statusvalue);
@@ -503,14 +503,14 @@ public class ClientHelper {
getUndoWithdrawnClientAsJSON(CREATED_DATE_PLUS_TWO), clientId); getUndoWithdrawnClientAsJSON(CREATED_DATE_PLUS_TWO), clientId);
} }
public Object undoRejectedclient(final Integer clientId, final String jsonAttributeToGetBack, public ArrayList<HashMap<String, Object>> undoRejectedclient(final Integer clientId, final String jsonAttributeToGetBack,
final String rejectedDate) { final String rejectedDate) {
System.out.println("----------------------------------UNDO REJECT CLIENT ----------------------------------"); System.out.println("----------------------------------UNDO REJECT CLIENT ----------------------------------");
return performClientActionsWithValidationErrors(createClientOperationURL(UNDOREJECT_CLIENT_COMMAND, clientId), return performClientActionsWithValidationErrors(createClientOperationURL(UNDOREJECT_CLIENT_COMMAND, clientId),
getUndoRejectClientAsJSON(rejectedDate), jsonAttributeToGetBack); getUndoRejectClientAsJSON(rejectedDate), jsonAttributeToGetBack);
} }
public Object undoWithdrawclient(final Integer clientId, final String jsonAttributeToGetBack, public ArrayList<HashMap<String, Object>> undoWithdrawclient(final Integer clientId, final String jsonAttributeToGetBack,
final String rejectedDate) { final String rejectedDate) {
System.out.println("----------------------------------UNDO WITHDRAW CLIENT ----------------------------------"); System.out.println("----------------------------------UNDO WITHDRAW CLIENT ----------------------------------");
return performClientActionsWithValidationErrors( return performClientActionsWithValidationErrors(
@@ -518,7 +518,7 @@ public class ClientHelper {
getUndoWithdrawnClientAsJSON(rejectedDate), jsonAttributeToGetBack); getUndoWithdrawnClientAsJSON(rejectedDate), jsonAttributeToGetBack);
} }
public Object activateClient(final Integer clientId, final String jsonAttributeToGetBack) { public ArrayList<HashMap<String, Object>> activateClient(final Integer clientId, final String jsonAttributeToGetBack) {
System.out.println("--------------------------------- ACTIVATE CLIENT -------------------------------"); System.out.println("--------------------------------- ACTIVATE CLIENT -------------------------------");
return performClientActionsWithValidationErrors(createClientOperationURL(ACTIVATE_CLIENT_COMMAND, clientId), return performClientActionsWithValidationErrors(createClientOperationURL(ACTIVATE_CLIENT_COMMAND, clientId),
getActivateClientAsJSON(CREATED_DATE_PLUS_ONE), jsonAttributeToGetBack); getActivateClientAsJSON(CREATED_DATE_PLUS_ONE), jsonAttributeToGetBack);
@@ -531,7 +531,7 @@ public class ClientHelper {
getActivateClientAsJSON(activationDate), clientId); getActivateClientAsJSON(activationDate), clientId);
} }
private ArrayList<HashMap> performClientActionsWithValidationErrors(final String postURLForClient, private ArrayList<HashMap<String, Object>> performClientActionsWithValidationErrors(final String postURLForClient,
final String jsonToBeSent, final String jsonAttributeToGetBack) { final String jsonToBeSent, final String jsonAttributeToGetBack) {
return Utils.performServerPost(this.requestSpec, this.responseSpec, postURLForClient, jsonToBeSent, return Utils.performServerPost(this.requestSpec, this.responseSpec, postURLForClient, jsonToBeSent,
jsonAttributeToGetBack); jsonAttributeToGetBack);
@@ -39,8 +39,8 @@ public class GlobalConfigurationHelper {
public static ArrayList<HashMap> getAllGlobalConfigurations(final RequestSpecification requestSpec, final ResponseSpecification responseSpec) { public static ArrayList<HashMap> getAllGlobalConfigurations(final RequestSpecification requestSpec, final ResponseSpecification responseSpec) {
final String GET_ALL_GLOBAL_CONFIG_URL = "/fineract-provider/api/v1/configurations?" + Utils.TENANT_IDENTIFIER; final String GET_ALL_GLOBAL_CONFIG_URL = "/fineract-provider/api/v1/configurations?" + Utils.TENANT_IDENTIFIER;
System.out.println("------------------------ RETRIEVING ALL GLOBAL CONFIGURATIONS -------------------------"); System.out.println("------------------------ RETRIEVING ALL GLOBAL CONFIGURATIONS -------------------------");
final HashMap response = Utils.performServerGet(requestSpec, responseSpec, GET_ALL_GLOBAL_CONFIG_URL, ""); final HashMap<String, ArrayList<HashMap>> response = Utils.performServerGet(requestSpec, responseSpec, GET_ALL_GLOBAL_CONFIG_URL, "");
return (ArrayList) response.get("globalConfiguration"); return (ArrayList<HashMap>) response.get("globalConfiguration");
} }
public static HashMap getGlobalConfigurationById(final RequestSpecification requestSpec, final ResponseSpecification responseSpec, public static HashMap getGlobalConfigurationById(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
@@ -86,7 +86,7 @@ public class HookHelper {
public void verifyUpdateHook(final String updateURL, final Long hookId) { public void verifyUpdateHook(final String updateURL, final Long hookId) {
System.out.println("------------------------------CHECK UPDATE HOOK DETAILS------------------------------------\n"); System.out.println("------------------------------CHECK UPDATE HOOK DETAILS------------------------------------\n");
final String GET_URL = "/fineract-provider/api/v1/hooks/" + hookId + "?" + Utils.TENANT_IDENTIFIER; 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<HashMap<String, String>> map = Utils.<ArrayList<HashMap<String, String>>>performServerGet(this.requestSpec, this.responseSpec, GET_URL, "config");
HashMap<String, String> hash = (HashMap<String, String>) map.get(1); HashMap<String, String> hash = (HashMap<String, String>) map.get(1);
assertEquals(updateURL, hash.get("fieldValue")); assertEquals(updateURL, hash.get("fieldValue"));
} }
@@ -95,7 +95,7 @@ public class HookHelper {
System.out.println("------------------------------CHECK DELETE HOOK DETAILS------------------------------------\n"); System.out.println("------------------------------CHECK DELETE HOOK DETAILS------------------------------------\n");
final String GET_URL = "/fineract-provider/api/v1/hooks/" + hookId + "?" + Utils.TENANT_IDENTIFIER; final String GET_URL = "/fineract-provider/api/v1/hooks/" + hookId + "?" + Utils.TENANT_IDENTIFIER;
ResponseSpecification responseSpec404 = new ResponseSpecBuilder().expectStatusCode(404).build(); ResponseSpecification responseSpec404 = new ResponseSpecBuilder().expectStatusCode(404).build();
ArrayList array = Utils.performServerGet(this.requestSpec, responseSpec404, GET_URL, "errors"); ArrayList<HashMap<String, String>> array = Utils.<ArrayList<HashMap<String, String>>>performServerGet(this.requestSpec, responseSpec404, GET_URL, "errors");
HashMap<String, String> map = (HashMap<String, String>)array.get(0); HashMap<String, String> map = (HashMap<String, String>)array.get(0);
assertEquals("error.msg.hook.identifier.not.found",map.get("userMessageGlobalisationCode")); assertEquals("error.msg.hook.identifier.not.found",map.get("userMessageGlobalisationCode"));
} }
@@ -61,7 +61,7 @@ public class OfficeHelper {
} }
public Integer updateOffice(int id, String name, String openingDate) { public Integer updateOffice(int id, String name, String openingDate) {
final HashMap map = new HashMap<>(); final HashMap<String, String> map = new HashMap<String, String>();
map.put("name", name); map.put("name", name);
map.put("dateFormat", "dd MMMM yyyy"); map.put("dateFormat", "dd MMMM yyyy");
map.put("locale", "en"); map.put("locale", "en");
@@ -106,7 +106,7 @@ public class ProvisioningIntegrationTest {
ArrayList definitions = (ArrayList)newCriteria.get("definitions") ; ArrayList definitions = (ArrayList)newCriteria.get("definitions") ;
for(int i = 0 ; i < definitions.size(); i++) { for(int i = 0 ; i < definitions.size(); i++) {
Map criteriadefinition = (Map) definitions.get(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"); newCriteria.put("locale", "en");
String updateCriteriaString = new Gson().toJson(newCriteria) ; String updateCriteriaString = new Gson().toJson(newCriteria) ;
@@ -20,8 +20,8 @@ package org.apache.fineract.integrationtests.common;
import static io.restassured.RestAssured.given; import static io.restassured.RestAssured.given;
import static io.restassured.path.json.JsonPath.from; import static io.restassured.path.json.JsonPath.from;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
import io.restassured.RestAssured; import io.restassured.RestAssured;
@@ -168,14 +168,14 @@ public class CampaignsHelper {
private ArrayList<ReportData> getReports(String jsonAttributeToGetBack) { private ArrayList<ReportData> getReports(String jsonAttributeToGetBack) {
System.out.println("--------------------------------- GET REPORTS OPTIONS -------------------------------"); 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 templateUrl = SMS_CAMPAIGNS_URL + "/template?" + Utils.TENANT_IDENTIFIER;
final String json = given().spec(requestSpec).expect().spec(responseSpec).log().ifError().when().get(templateUrl).andReturn() final String json = given().spec(requestSpec).expect().spec(responseSpec).log().ifError().when().get(templateUrl).andReturn()
.asString(); .asString();
Assert.notNull(json); Assert.notNull(json, "json");
ArrayList<ReportData> reportsList = new ArrayList<>(); ArrayList<ReportData> reportsList = new ArrayList<>();
String reportsString = new Gson().toJson(from(json).get(jsonAttributeToGetBack)); String reportsString = new Gson().toJson(from(json).get(jsonAttributeToGetBack));
Assert.notNull(reportsString); Assert.notNull(reportsString, "reportsString");
final Gson gson = new Gson(); final Gson gson = new Gson();
final Type typeOfHashMap = new TypeToken<List<ReportData>>() {}.getType(); final Type typeOfHashMap = new TypeToken<List<ReportData>>() {}.getType();
reportsList = gson.fromJson(reportsString, typeOfHashMap); reportsList = gson.fromJson(reportsString, typeOfHashMap);
@@ -190,7 +190,7 @@ public class CampaignsHelper {
if (reportName.equals(reportData.getReportName())) { return reportData.getReportId(); } if (reportName.equals(reportData.getReportName())) { return reportData.getReportId(); }
} }
} }
Assert.notNull(null); Assert.notNull(null, "null");
return null; return null;
} }
} }
@@ -65,12 +65,12 @@ public class CurrencyHelper {
final String json = given().spec(requestSpec).expect().spec(responseSpec).log().ifError().when() final String json = given().spec(requestSpec).expect().spec(responseSpec).log().ifError().when()
.get(getUrl).andReturn().asString(); .get(getUrl).andReturn().asString();
final Gson gson = new Gson(); final Gson gson = new Gson();
Assert.notNull(json); Assert.notNull(json, "json");
final ArrayList<Currency> currencyList = new ArrayList<Currency>(); final ArrayList<Currency> currencyList = new ArrayList<Currency>();
final Type typeOfHashMap = new TypeToken<Map<String, List<Currency>>>() { }.getType(); final Type typeOfHashMap = new TypeToken<Map<String, List<Currency>>>() { }.getType();
final Map<String, List<Currency>> responseMap = gson.fromJson(json, typeOfHashMap); final Map<String, List<Currency>> responseMap = gson.fromJson(json, typeOfHashMap);
for(Map.Entry<String, List<Currency>> entry : responseMap.entrySet()) { for(Map.Entry<String, List<Currency>> entry : responseMap.entrySet()) {
Assert.isTrue(permittedCurrencyArrays.contains(entry.getKey())); Assert.isTrue(permittedCurrencyArrays.contains(entry.getKey()), "permittedCurrencyArrays");
for(Currency currency : entry.getValue()) { for(Currency currency : entry.getValue()) {
currencyList.add(currency); 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() final String json = given().spec(requestSpec).body(getUpdateJSON(currencies)).expect().spec(responseSpec).log().ifError().when()
.put(CURRENCY_URL).andReturn().asString(); .put(CURRENCY_URL).andReturn().asString();
final Gson gson = new Gson(); final Gson gson = new Gson();
Assert.notNull(json); Assert.notNull(json, "json");
final Type typeOfHashMap = new TypeToken<Map<String,Map<String, List<String>>>>() { }.getType(); final Type typeOfHashMap = new TypeToken<Map<String,Map<String, List<String>>>>() { }.getType();
final Map<String,Map<String, List<String>>> responseMap = gson.fromJson(json, typeOfHashMap); final Map<String,Map<String, List<String>>> responseMap = gson.fromJson(json, typeOfHashMap);
return responseMap.get("changes").get("currencies"); return responseMap.get("changes").get("currencies");
@@ -66,23 +66,23 @@ public class ProvisioningHelper {
return provisioningEntryCreateJson; return provisioningEntryCreateJson;
} }
private static ArrayList addLoanProducts(ArrayList<Integer> loanProducts) { private static ArrayList<HashMap<String, Integer>> addLoanProducts(ArrayList<Integer> loanProducts) {
ArrayList list = new ArrayList<>(); ArrayList<HashMap<String, Integer>> list = new ArrayList<>();
for (int i = 0; i < loanProducts.size(); i++) { for (int i = 0; i < loanProducts.size(); i++) {
HashMap map = new HashMap(); HashMap<String, Integer> map = new HashMap<>();
map.put("id", loanProducts.get(i)); map.put("id", loanProducts.get(i));
list.add(map); list.add(map);
} }
return list; return list;
} }
public static ArrayList addProvisioningCategories(ArrayList categories, Account liability, Account expense) { public static ArrayList<HashMap<String, Object>> addProvisioningCategories(ArrayList categories, Account liability, Account expense) {
ArrayList list = new ArrayList(); ArrayList<HashMap<String, Object>> list = new ArrayList<>();
int minStart = 0; int minStart = 0;
int maxStart = 30; int maxStart = 30;
for (int i = 0; i < categories.size(); i++) { for (int i = 0; i < categories.size(); i++) {
HashMap map = new HashMap(); HashMap<String, Object> map = new HashMap<>();
HashMap category = (HashMap) categories.get(i); HashMap category = (HashMap) categories.get(i);
map.put("categoryId", category.get("id")); map.put("categoryId", category.get("id"));
map.put("categoryName", category.get("categoryName")); map.put("categoryName", category.get("categoryName"));
@@ -92,7 +92,7 @@ public class ProvisioningHelper {
} else { } else {
map.put("maxAge", (i+1) * 30); 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("liabilityAccount", liability.getAccountID());
map.put("expenseAccount", expense.getAccountID()); map.put("expenseAccount", expense.getAccountID());
list.add(map); list.add(map);
@@ -24,7 +24,7 @@ import static org.apache.fineract.integrationtests.interoperation.InteropHelper.
import io.restassured.builder.RequestSpecBuilder; import io.restassured.builder.RequestSpecBuilder;
import io.restassured.builder.ResponseSpecBuilder; import io.restassured.builder.ResponseSpecBuilder;
import io.restassured.http.ContentType; 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.path.json.JsonPath;
import io.restassured.specification.RequestSpecification; import io.restassured.specification.RequestSpecification;
import io.restassured.specification.ResponseSpecification; import io.restassured.specification.ResponseSpecification;
@@ -53,12 +53,12 @@ public class GuarantorTest {
private LoanTransactionHelper loanTransactionHelper; private LoanTransactionHelper loanTransactionHelper;
private GuarantorHelper guarantorHelper; private GuarantorHelper guarantorHelper;
private SavingsAccountHelper savingsAccountHelper; private SavingsAccountHelper savingsAccountHelper;
private final Float self1_balance = new Float(5000); private final Float self1_balance = Float.valueOf((float)5000);
private final Float external1_balance = new Float(5000); private final Float external1_balance = Float.valueOf((float)5000);
private final Float external2_balance = new Float(5000); private final Float external2_balance = Float.valueOf((float)5000);
private final Float self1_guarantee = new Float(2000); private final Float self1_guarantee = Float.valueOf((float)2000);
private final Float external1_guarantee = new Float(2000); private final Float external1_guarantee = Float.valueOf((float)2000);
private final Float external2_guarantee = new Float(1000); private final Float external2_guarantee = Float.valueOf((float)1000);
@Before @Before
public void setUp() throws Exception { public void setUp() throws Exception {
@@ -75,9 +75,9 @@ public class GuarantorTest {
@Test @Test
public void testGuarantor() { public void testGuarantor() {
Float self1_hold_funds = new Float(0); Float self1_hold_funds = Float.valueOf((float)0);
Float external1_hold_funds = new Float(0); Float external1_hold_funds = Float.valueOf((float)0);
Float external2_hold_funds = new Float(0); Float external2_hold_funds = Float.valueOf((float)0);
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec); final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
ClientHelper.verifyClientCreatedOnServer(this.requestSpec, this.responseSpec, clientID); ClientHelper.verifyClientCreatedOnServer(this.requestSpec, this.responseSpec, clientID);
final Integer clientID_external = ClientHelper.createClient(this.requestSpec, this.responseSpec); final Integer clientID_external = ClientHelper.createClient(this.requestSpec, this.responseSpec);
@@ -160,9 +160,9 @@ public class GuarantorTest {
System.out.println("-----------------------------------UNDO APPROVE LOAN-----------------------------------------"); System.out.println("-----------------------------------UNDO APPROVE LOAN-----------------------------------------");
loanStatusHashMap = this.loanTransactionHelper.undoApproval(loanID); loanStatusHashMap = this.loanTransactionHelper.undoApproval(loanID);
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap); LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
verifySavingsOnHoldBalance(selfSavigsId, new Float(0)); verifySavingsOnHoldBalance(selfSavigsId, Float.valueOf((float)0));
verifySavingsOnHoldBalance(externalSavigsId_1, new Float(0)); verifySavingsOnHoldBalance(externalSavigsId_1, Float.valueOf((float)0));
verifySavingsOnHoldBalance(externalSavigsId_2, new Float(0)); verifySavingsOnHoldBalance(externalSavigsId_2, Float.valueOf((float)0));
System.out.println("-----------------------------------APPROVE LOAN-----------------------------------------"); System.out.println("-----------------------------------APPROVE LOAN-----------------------------------------");
loanStatusHashMap = this.loanTransactionHelper.approveLoan(LOAN_DISBURSEMENT_DATE, loanID); loanStatusHashMap = this.loanTransactionHelper.approveLoan(LOAN_DISBURSEMENT_DATE, loanID);
@@ -182,8 +182,8 @@ public class GuarantorTest {
todaysDate.add(Calendar.DAY_OF_MONTH, -7 * 3); todaysDate.add(Calendar.DAY_OF_MONTH, -7 * 3);
String LOAN_REPAYMENT_DATE = dateFormat.format(todaysDate.getTime()); String LOAN_REPAYMENT_DATE = dateFormat.format(todaysDate.getTime());
Float totalDueForCurrentPeriod = (Float) loanSchedule.get(1).get("totalDueForPeriod"); Float totalDueForCurrentPeriod = (Float) loanSchedule.get(1).get("totalDueForPeriod");
external1_hold_funds -= new Float(827.5867); external1_hold_funds -= Float.valueOf((float)827.5867);
external2_hold_funds -= new Float(413.7933); external2_hold_funds -= Float.valueOf((float)413.7933);
this.loanTransactionHelper.makeRepayment(LOAN_REPAYMENT_DATE, totalDueForCurrentPeriod, loanID); this.loanTransactionHelper.makeRepayment(LOAN_REPAYMENT_DATE, totalDueForCurrentPeriod, loanID);
verifySavingsOnHoldBalance(selfSavigsId, self1_hold_funds); verifySavingsOnHoldBalance(selfSavigsId, self1_hold_funds);
verifySavingsOnHoldBalance(externalSavigsId_1, external1_hold_funds); verifySavingsOnHoldBalance(externalSavigsId_1, external1_hold_funds);
@@ -194,8 +194,8 @@ public class GuarantorTest {
todaysDate.add(Calendar.DAY_OF_MONTH, -7 * 2); todaysDate.add(Calendar.DAY_OF_MONTH, -7 * 2);
LOAN_REPAYMENT_DATE = dateFormat.format(todaysDate.getTime()); LOAN_REPAYMENT_DATE = dateFormat.format(todaysDate.getTime());
totalDueForCurrentPeriod = (Float) loanSchedule.get(2).get("totalDueForPeriod"); totalDueForCurrentPeriod = (Float) loanSchedule.get(2).get("totalDueForPeriod");
external1_hold_funds -= new Float(831.4067); external1_hold_funds -= Float.valueOf((float)831.4067);
external2_hold_funds -= new Float(415.7033333); external2_hold_funds -= Float.valueOf((float)415.7033333);
this.loanTransactionHelper.makeRepayment(LOAN_REPAYMENT_DATE, totalDueForCurrentPeriod, loanID); this.loanTransactionHelper.makeRepayment(LOAN_REPAYMENT_DATE, totalDueForCurrentPeriod, loanID);
verifySavingsOnHoldBalance(selfSavigsId, self1_hold_funds); verifySavingsOnHoldBalance(selfSavigsId, self1_hold_funds);
verifySavingsOnHoldBalance(externalSavigsId_1, external1_hold_funds); verifySavingsOnHoldBalance(externalSavigsId_1, external1_hold_funds);
@@ -206,20 +206,20 @@ public class GuarantorTest {
todaysDate.add(Calendar.DAY_OF_MONTH, -7); todaysDate.add(Calendar.DAY_OF_MONTH, -7);
LOAN_REPAYMENT_DATE = dateFormat.format(todaysDate.getTime()); LOAN_REPAYMENT_DATE = dateFormat.format(todaysDate.getTime());
totalDueForCurrentPeriod = (Float) loanSchedule.get(3).get("totalDueForPeriod"); 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); this.loanTransactionHelper.makeRepayment(LOAN_REPAYMENT_DATE, totalDueForCurrentPeriod, loanID);
verifySavingsOnHoldBalance(selfSavigsId, self1_hold_funds); verifySavingsOnHoldBalance(selfSavigsId, self1_hold_funds);
verifySavingsOnHoldBalance(externalSavigsId_1, new Float(0)); verifySavingsOnHoldBalance(externalSavigsId_1, Float.valueOf((float)0));
verifySavingsOnHoldBalance(externalSavigsId_2, new Float(0)); verifySavingsOnHoldBalance(externalSavigsId_2, Float.valueOf((float)0));
// forth repayment // forth repayment
todaysDate = Calendar.getInstance(); todaysDate = Calendar.getInstance();
LOAN_REPAYMENT_DATE = dateFormat.format(todaysDate.getTime()); LOAN_REPAYMENT_DATE = dateFormat.format(todaysDate.getTime());
totalDueForCurrentPeriod = (Float) loanSchedule.get(3).get("totalDueForPeriod"); totalDueForCurrentPeriod = (Float) loanSchedule.get(3).get("totalDueForPeriod");
this.loanTransactionHelper.makeRepayment(LOAN_REPAYMENT_DATE, totalDueForCurrentPeriod, loanID); this.loanTransactionHelper.makeRepayment(LOAN_REPAYMENT_DATE, totalDueForCurrentPeriod, loanID);
verifySavingsOnHoldBalance(selfSavigsId, new Float(0)); verifySavingsOnHoldBalance(selfSavigsId, Float.valueOf((float)0));
verifySavingsOnHoldBalance(externalSavigsId_1, new Float(0)); verifySavingsOnHoldBalance(externalSavigsId_1, Float.valueOf((float)0));
verifySavingsOnHoldBalance(externalSavigsId_2, new Float(0)); verifySavingsOnHoldBalance(externalSavigsId_2, Float.valueOf((float)0));
loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID); loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
LoanStatusChecker.verifyLoanAccountIsClosed(loanStatusHashMap); LoanStatusChecker.verifyLoanAccountIsClosed(loanStatusHashMap);
@@ -230,9 +230,9 @@ public class GuarantorTest {
@Test @Test
public void testGuarantor_UNDO_DISBURSAL() { public void testGuarantor_UNDO_DISBURSAL() {
Float self1_hold_funds = new Float(0); Float self1_hold_funds = Float.valueOf((float)0);
Float external1_hold_funds = new Float(0); Float external1_hold_funds = Float.valueOf((float)0);
Float external2_hold_funds = new Float(0); Float external2_hold_funds = Float.valueOf((float)0);
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec); final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
ClientHelper.verifyClientCreatedOnServer(this.requestSpec, this.responseSpec, clientID); ClientHelper.verifyClientCreatedOnServer(this.requestSpec, this.responseSpec, clientID);
final Integer clientID_external = ClientHelper.createClient(this.requestSpec, this.responseSpec); final Integer clientID_external = ClientHelper.createClient(this.requestSpec, this.responseSpec);
@@ -317,9 +317,9 @@ public class GuarantorTest {
System.out.println("-----------------------------------UNDO APPROVE LOAN-----------------------------------------"); System.out.println("-----------------------------------UNDO APPROVE LOAN-----------------------------------------");
loanStatusHashMap = this.loanTransactionHelper.undoApproval(loanID); loanStatusHashMap = this.loanTransactionHelper.undoApproval(loanID);
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap); LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
verifySavingsOnHoldBalance(selfSavigsId, new Float(0)); verifySavingsOnHoldBalance(selfSavigsId, Float.valueOf((float)0));
verifySavingsOnHoldBalance(externalSavigsId_1, new Float(0)); verifySavingsOnHoldBalance(externalSavigsId_1, Float.valueOf((float)0));
verifySavingsOnHoldBalance(externalSavigsId_2, new Float(0)); verifySavingsOnHoldBalance(externalSavigsId_2, Float.valueOf((float)0));
System.out.println("-----------------------------------APPROVE LOAN-----------------------------------------"); System.out.println("-----------------------------------APPROVE LOAN-----------------------------------------");
loanStatusHashMap = this.loanTransactionHelper.approveLoan(LOAN_DISBURSEMENT_DATE, loanID); loanStatusHashMap = this.loanTransactionHelper.approveLoan(LOAN_DISBURSEMENT_DATE, loanID);
@@ -373,8 +373,8 @@ public class GuarantorTest {
todaysDate.add(Calendar.DAY_OF_MONTH, -7 * 3); todaysDate.add(Calendar.DAY_OF_MONTH, -7 * 3);
String LOAN_REPAYMENT_DATE = dateFormat.format(todaysDate.getTime()); String LOAN_REPAYMENT_DATE = dateFormat.format(todaysDate.getTime());
Float totalDueForCurrentPeriod = (Float) loanSchedule.get(1).get("totalDueForPeriod"); Float totalDueForCurrentPeriod = (Float) loanSchedule.get(1).get("totalDueForPeriod");
external1_hold_funds -= new Float(827.5867); external1_hold_funds -= Float.valueOf((float)827.5867);
external2_hold_funds -= new Float(413.7933); external2_hold_funds -= Float.valueOf((float)413.7933);
this.loanTransactionHelper.makeRepayment(LOAN_REPAYMENT_DATE, totalDueForCurrentPeriod, loanID); this.loanTransactionHelper.makeRepayment(LOAN_REPAYMENT_DATE, totalDueForCurrentPeriod, loanID);
verifySavingsOnHoldBalance(selfSavigsId, self1_hold_funds); verifySavingsOnHoldBalance(selfSavigsId, self1_hold_funds);
verifySavingsOnHoldBalance(externalSavigsId_3, external1_hold_funds); verifySavingsOnHoldBalance(externalSavigsId_3, external1_hold_funds);
@@ -385,8 +385,8 @@ public class GuarantorTest {
todaysDate.add(Calendar.DAY_OF_MONTH, -7 * 2); todaysDate.add(Calendar.DAY_OF_MONTH, -7 * 2);
LOAN_REPAYMENT_DATE = dateFormat.format(todaysDate.getTime()); LOAN_REPAYMENT_DATE = dateFormat.format(todaysDate.getTime());
totalDueForCurrentPeriod = (Float) loanSchedule.get(2).get("totalDueForPeriod"); totalDueForCurrentPeriod = (Float) loanSchedule.get(2).get("totalDueForPeriod");
external1_hold_funds -= new Float(831.4067); external1_hold_funds -= Float.valueOf((float)831.4067);
external2_hold_funds -= new Float(415.7033333); external2_hold_funds -= Float.valueOf((float)415.7033333);
this.loanTransactionHelper.makeRepayment(LOAN_REPAYMENT_DATE, totalDueForCurrentPeriod, loanID); this.loanTransactionHelper.makeRepayment(LOAN_REPAYMENT_DATE, totalDueForCurrentPeriod, loanID);
verifySavingsOnHoldBalance(selfSavigsId, self1_hold_funds); verifySavingsOnHoldBalance(selfSavigsId, self1_hold_funds);
verifySavingsOnHoldBalance(externalSavigsId_3, external1_hold_funds); verifySavingsOnHoldBalance(externalSavigsId_3, external1_hold_funds);
@@ -397,11 +397,11 @@ public class GuarantorTest {
todaysDate.add(Calendar.DAY_OF_MONTH, -7); todaysDate.add(Calendar.DAY_OF_MONTH, -7);
LOAN_REPAYMENT_DATE = dateFormat.format(todaysDate.getTime()); LOAN_REPAYMENT_DATE = dateFormat.format(todaysDate.getTime());
totalDueForCurrentPeriod = (Float) loanSchedule.get(3).get("totalDueForPeriod"); 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); HashMap transactionDetail = this.loanTransactionHelper.makeRepayment(LOAN_REPAYMENT_DATE, totalDueForCurrentPeriod, loanID);
verifySavingsOnHoldBalance(selfSavigsId, self1_hold_funds_temp); verifySavingsOnHoldBalance(selfSavigsId, self1_hold_funds_temp);
verifySavingsOnHoldBalance(externalSavigsId_3, new Float(0)); verifySavingsOnHoldBalance(externalSavigsId_3, Float.valueOf((float)0));
verifySavingsOnHoldBalance(externalSavigsId_2, new Float(0)); verifySavingsOnHoldBalance(externalSavigsId_2, Float.valueOf((float)0));
// undo repayment // undo repayment
this.loanTransactionHelper.adjustLoanTransaction(loanID, (Integer) transactionDetail.get(CommonConstants.RESPONSE_RESOURCE_ID), this.loanTransactionHelper.adjustLoanTransaction(loanID, (Integer) transactionDetail.get(CommonConstants.RESPONSE_RESOURCE_ID),
@@ -414,17 +414,17 @@ public class GuarantorTest {
loanStatusHashMap = this.loanTransactionHelper.undoDisbursal(loanID); loanStatusHashMap = this.loanTransactionHelper.undoDisbursal(loanID);
LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap); LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap); LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
verifySavingsOnHoldBalance(selfSavigsId, new Float(self1_guarantee)); verifySavingsOnHoldBalance(selfSavigsId, Float.valueOf((float)self1_guarantee));
verifySavingsOnHoldBalance(externalSavigsId_3, new Float(external1_guarantee)); verifySavingsOnHoldBalance(externalSavigsId_3, Float.valueOf((float)external1_guarantee));
verifySavingsOnHoldBalance(externalSavigsId_2, new Float(external2_guarantee)); verifySavingsOnHoldBalance(externalSavigsId_2, Float.valueOf((float)external2_guarantee));
} }
@SuppressWarnings({ "rawtypes", "unchecked" }) @SuppressWarnings({ "rawtypes", "unchecked" })
@Test @Test
public void testGuarantor_RECOVER_GUARANTEES() { public void testGuarantor_RECOVER_GUARANTEES() {
Float self1_hold_funds = new Float(0); Float self1_hold_funds = Float.valueOf((float)0);
Float external1_hold_funds = new Float(0); Float external1_hold_funds = Float.valueOf((float)0);
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec); final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
ClientHelper.verifyClientCreatedOnServer(this.requestSpec, this.responseSpec, clientID); ClientHelper.verifyClientCreatedOnServer(this.requestSpec, this.responseSpec, clientID);
final Integer clientID_external = ClientHelper.createClient(this.requestSpec, this.responseSpec); final Integer clientID_external = ClientHelper.createClient(this.requestSpec, this.responseSpec);
@@ -476,14 +476,14 @@ public class GuarantorTest {
todaysDate.add(Calendar.DAY_OF_MONTH, -14); todaysDate.add(Calendar.DAY_OF_MONTH, -14);
String LOAN_REPAYMENT_DATE = dateFormat.format(todaysDate.getTime()); String LOAN_REPAYMENT_DATE = dateFormat.format(todaysDate.getTime());
Float totalDueForCurrentPeriod = (Float) loanSchedule.get(1).get("totalDueForPeriod"); 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); this.loanTransactionHelper.makeRepayment(LOAN_REPAYMENT_DATE, totalDueForCurrentPeriod, loanID);
verifySavingsOnHoldBalance(selfSavigsId, self1_hold_funds); verifySavingsOnHoldBalance(selfSavigsId, self1_hold_funds);
verifySavingsOnHoldBalance(externalSavigsId_1, external1_hold_funds); verifySavingsOnHoldBalance(externalSavigsId_1, external1_hold_funds);
this.loanTransactionHelper.recoverFromGuarantor(loanID); this.loanTransactionHelper.recoverFromGuarantor(loanID);
verifySavingsBalanceAndOnHoldBalance(selfSavigsId, new Float(0), self1_balance - self1_hold_funds); verifySavingsBalanceAndOnHoldBalance(selfSavigsId, Float.valueOf((float)0), self1_balance - self1_hold_funds);
verifySavingsBalanceAndOnHoldBalance(externalSavigsId_1, new Float(0), external1_balance - external1_hold_funds); verifySavingsBalanceAndOnHoldBalance(externalSavigsId_1, Float.valueOf((float)0), external1_balance - external1_hold_funds);
} }
@@ -491,17 +491,17 @@ public class GuarantorTest {
@Test @Test
public void testGuarantor_RECOVER_GUARANTEES_WITH_MORE_GUARANTEE() { public void testGuarantor_RECOVER_GUARANTEES_WITH_MORE_GUARANTEE() {
Float self1_hold_funds = new Float(0); Float self1_hold_funds = Float.valueOf((float)0);
Float external1_hold_funds = new Float(0); Float external1_hold_funds = Float.valueOf((float)0);
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec); final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
ClientHelper.verifyClientCreatedOnServer(this.requestSpec, this.responseSpec, clientID); ClientHelper.verifyClientCreatedOnServer(this.requestSpec, this.responseSpec, clientID);
final Integer clientID_external = ClientHelper.createClient(this.requestSpec, this.responseSpec); final Integer clientID_external = ClientHelper.createClient(this.requestSpec, this.responseSpec);
ClientHelper.verifyClientCreatedOnServer(this.requestSpec, this.responseSpec, clientID_external); ClientHelper.verifyClientCreatedOnServer(this.requestSpec, this.responseSpec, clientID_external);
Float selfBalance = new Float(10000); Float selfBalance = Float.valueOf((float)10000);
Float externalBalance = new Float(10000); Float externalBalance = Float.valueOf((float)10000);
Float selfguarantee = new Float(6000); Float selfguarantee = Float.valueOf((float)6000);
Float externalguarantee = new Float(7000); Float externalguarantee = Float.valueOf((float)7000);
final Integer selfSavigsId = SavingsAccountHelper.openSavingsAccount(this.requestSpec, this.responseSpec, clientID, final Integer selfSavigsId = SavingsAccountHelper.openSavingsAccount(this.requestSpec, this.responseSpec, clientID,
String.valueOf(selfBalance)); String.valueOf(selfBalance));
@@ -549,14 +549,14 @@ public class GuarantorTest {
todaysDate.add(Calendar.DAY_OF_MONTH, -14); todaysDate.add(Calendar.DAY_OF_MONTH, -14);
String LOAN_REPAYMENT_DATE = dateFormat.format(todaysDate.getTime()); String LOAN_REPAYMENT_DATE = dateFormat.format(todaysDate.getTime());
Float totalDueForCurrentPeriod = (Float) loanSchedule.get(1).get("totalDueForPeriod"); 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); this.loanTransactionHelper.makeRepayment(LOAN_REPAYMENT_DATE, totalDueForCurrentPeriod, loanID);
verifySavingsOnHoldBalance(selfSavigsId, self1_hold_funds); verifySavingsOnHoldBalance(selfSavigsId, self1_hold_funds);
verifySavingsOnHoldBalance(externalSavigsId_1, external1_hold_funds); verifySavingsOnHoldBalance(externalSavigsId_1, external1_hold_funds);
this.loanTransactionHelper.recoverFromGuarantor(loanID); this.loanTransactionHelper.recoverFromGuarantor(loanID);
verifySavingsBalanceAndOnHoldBalance(selfSavigsId, new Float(0), selfBalance - new Float(4615.385)); verifySavingsBalanceAndOnHoldBalance(selfSavigsId, Float.valueOf((float)0), selfBalance - Float.valueOf((float)4615.385));
verifySavingsBalanceAndOnHoldBalance(externalSavigsId_1, new Float(0), externalBalance - new Float(2901.8553)); verifySavingsBalanceAndOnHoldBalance(externalSavigsId_1, Float.valueOf((float)0), externalBalance - Float.valueOf((float)2901.8553));
} }
@@ -565,8 +565,8 @@ public class GuarantorTest {
@Test @Test
public void testGuarantor_WRITE_OFF_LOAN() { public void testGuarantor_WRITE_OFF_LOAN() {
Float self1_hold_funds = new Float(0); Float self1_hold_funds = Float.valueOf((float)0);
Float external1_hold_funds = new Float(0); Float external1_hold_funds = Float.valueOf((float)0);
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec); final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
ClientHelper.verifyClientCreatedOnServer(this.requestSpec, this.responseSpec, clientID); ClientHelper.verifyClientCreatedOnServer(this.requestSpec, this.responseSpec, clientID);
final Integer clientID_external = ClientHelper.createClient(this.requestSpec, this.responseSpec); final Integer clientID_external = ClientHelper.createClient(this.requestSpec, this.responseSpec);
@@ -618,7 +618,7 @@ public class GuarantorTest {
todaysDate.add(Calendar.DAY_OF_MONTH, -14); todaysDate.add(Calendar.DAY_OF_MONTH, -14);
String LOAN_REPAYMENT_DATE = dateFormat.format(todaysDate.getTime()); String LOAN_REPAYMENT_DATE = dateFormat.format(todaysDate.getTime());
Float totalDueForCurrentPeriod = (Float) loanSchedule.get(1).get("totalDueForPeriod"); 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); this.loanTransactionHelper.makeRepayment(LOAN_REPAYMENT_DATE, totalDueForCurrentPeriod, loanID);
verifySavingsOnHoldBalance(selfSavigsId, self1_hold_funds); verifySavingsOnHoldBalance(selfSavigsId, self1_hold_funds);
verifySavingsOnHoldBalance(externalSavigsId_1, external1_hold_funds); verifySavingsOnHoldBalance(externalSavigsId_1, external1_hold_funds);
@@ -626,8 +626,8 @@ public class GuarantorTest {
todaysDate = Calendar.getInstance(); todaysDate = Calendar.getInstance();
String LOAN_WRITEOFF_DATE = dateFormat.format(todaysDate.getTime()); String LOAN_WRITEOFF_DATE = dateFormat.format(todaysDate.getTime());
this.loanTransactionHelper.writeOffLoan(LOAN_WRITEOFF_DATE, loanID); this.loanTransactionHelper.writeOffLoan(LOAN_WRITEOFF_DATE, loanID);
verifySavingsBalanceAndOnHoldBalance(selfSavigsId, new Float(0), self1_balance); verifySavingsBalanceAndOnHoldBalance(selfSavigsId, Float.valueOf((float)0), self1_balance);
verifySavingsBalanceAndOnHoldBalance(externalSavigsId_1, new Float(0), external1_balance); verifySavingsBalanceAndOnHoldBalance(externalSavigsId_1, Float.valueOf((float)0), external1_balance);
} }
@@ -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.PlatformApiDataValidationException;
import org.apache.fineract.infrastructure.core.exception.PlatformDataIntegrityException; import org.apache.fineract.infrastructure.core.exception.PlatformDataIntegrityException;
import org.apache.fineract.infrastructure.core.exception.UnsupportedParameterException; 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.Cell;
import org.apache.poi.ss.usermodel.CellStyle; 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.CellValue;
import org.apache.poi.ss.usermodel.FillPatternType;
import org.apache.poi.ss.usermodel.FormulaEvaluator; import org.apache.poi.ss.usermodel.FormulaEvaluator;
import org.apache.poi.ss.usermodel.IndexedColors; import org.apache.poi.ss.usermodel.IndexedColors;
import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet; 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.usermodel.Workbook;
import org.apache.poi.ss.util.CellReference;
import org.joda.time.LocalDate; import org.joda.time.LocalDate;
public class ImportHandlerUtils { public class ImportHandlerUtils {
@@ -62,10 +64,10 @@ public class ImportHandlerUtils {
public static Long readAsLong(int colIndex, Row row) { public static Long readAsLong(int colIndex, Row row) {
Cell c = row.getCell(colIndex); Cell c = row.getCell(colIndex);
if (c == null || c.getCellType() == Cell.CELL_TYPE_BLANK) if (c == null || c.getCellType() == CellType.BLANK)
return null; return null;
FormulaEvaluator eval = row.getSheet().getWorkbook().getCreationHelper().createFormulaEvaluator(); FormulaEvaluator eval = row.getSheet().getWorkbook().getCreationHelper().createFormulaEvaluator();
if(c.getCellType() == Cell.CELL_TYPE_FORMULA) { if(c.getCellType() == CellType.FORMULA) {
if(eval!=null) { if(eval!=null) {
CellValue val = null; CellValue val = null;
try { try {
@@ -76,7 +78,7 @@ public class ImportHandlerUtils {
return ((Double)val.getNumberValue()).longValue(); return ((Double)val.getNumberValue()).longValue();
} }
} }
else if (c.getCellType()==Cell.CELL_TYPE_NUMERIC){ else if (c.getCellType()==CellType.NUMERIC){
return ((Double) c.getNumericCellValue()).longValue(); return ((Double) c.getNumericCellValue()).longValue();
} }
else { else {
@@ -89,10 +91,10 @@ public class ImportHandlerUtils {
public static String readAsString(int colIndex, Row row) { public static String readAsString(int colIndex, Row row) {
Cell c = row.getCell(colIndex); Cell c = row.getCell(colIndex);
if (c == null || c.getCellType() == Cell.CELL_TYPE_BLANK) if (c == null || c.getCellType() == CellType.BLANK)
return null; return null;
FormulaEvaluator eval = row.getSheet().getWorkbook().getCreationHelper().createFormulaEvaluator(); FormulaEvaluator eval = row.getSheet().getWorkbook().getCreationHelper().createFormulaEvaluator();
if(c.getCellType() == Cell.CELL_TYPE_FORMULA) { if(c.getCellType() == CellType.FORMULA) {
if (eval!=null) { if (eval!=null) {
CellValue val = null; CellValue val = null;
try { try {
@@ -114,13 +116,13 @@ public class ImportHandlerUtils {
}else { }else {
return null; return null;
} }
}else if(c.getCellType()==Cell.CELL_TYPE_STRING) { }else if(c.getCellType()==CellType.STRING) {
String res = trimEmptyDecimalPortion(c.getStringCellValue().trim()); String res = trimEmptyDecimalPortion(c.getStringCellValue().trim());
return res.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() + ""; return ((Double) row.getCell(colIndex).getNumericCellValue()).intValue() + "";
}else if (c.getCellType()==Cell.CELL_TYPE_BOOLEAN){ }else if (c.getCellType()==CellType.BOOLEAN){
return c.getBooleanCellValue()+""; return c.getBooleanCellValue()+"";
}else { }else {
return null; return null;
@@ -137,7 +139,7 @@ public class ImportHandlerUtils {
public static LocalDate readAsDate(int colIndex, Row row) { public static LocalDate readAsDate(int colIndex, Row row) {
Cell c = row.getCell(colIndex); Cell c = row.getCell(colIndex);
if(c == null || c.getCellType() == Cell.CELL_TYPE_BLANK) if(c == null || c.getCellType() == CellType.BLANK)
return null; return null;
LocalDate localDate=new LocalDate(c.getDateCellValue()); LocalDate localDate=new LocalDate(c.getDateCellValue());
@@ -146,10 +148,10 @@ public class ImportHandlerUtils {
public static Boolean readAsBoolean(int colIndex, Row row) { public static Boolean readAsBoolean(int colIndex, Row row) {
Cell c = row.getCell(colIndex); Cell c = row.getCell(colIndex);
if(c == null || c.getCellType() == Cell.CELL_TYPE_BLANK) if(c == null || c.getCellType() == CellType.BLANK)
return false; return false;
FormulaEvaluator eval = row.getSheet().getWorkbook().getCreationHelper().createFormulaEvaluator(); FormulaEvaluator eval = row.getSheet().getWorkbook().getCreationHelper().createFormulaEvaluator();
if(c.getCellType() == Cell.CELL_TYPE_FORMULA) { if(c.getCellType() == CellType.FORMULA) {
if(eval!=null) { if(eval!=null) {
CellValue val = null; CellValue val = null;
try { try {
@@ -160,7 +162,7 @@ public class ImportHandlerUtils {
return val.getBooleanValue(); return val.getBooleanValue();
} }
return false; return false;
}else if(c.getCellType()==Cell.CELL_TYPE_BOOLEAN) }else if(c.getCellType()==CellType.BOOLEAN)
return c.getBooleanCellValue(); return c.getBooleanCellValue();
else { else {
String booleanString = row.getCell(colIndex).getStringCellValue().trim(); String booleanString = row.getCell(colIndex).getStringCellValue().trim();
@@ -173,10 +175,10 @@ public class ImportHandlerUtils {
public static Integer readAsInt(int colIndex, Row row) { public static Integer readAsInt(int colIndex, Row row) {
Cell c = row.getCell(colIndex); Cell c = row.getCell(colIndex);
if (c == null || c.getCellType() == Cell.CELL_TYPE_BLANK) if (c == null || c.getCellType() == CellType.BLANK)
return null; return null;
FormulaEvaluator eval = row.getSheet().getWorkbook().getCreationHelper().createFormulaEvaluator(); FormulaEvaluator eval = row.getSheet().getWorkbook().getCreationHelper().createFormulaEvaluator();
if(c.getCellType() == Cell.CELL_TYPE_FORMULA) { if(c.getCellType() == CellType.FORMULA) {
if(eval!=null) { if(eval!=null) {
CellValue val = null; CellValue val = null;
try { try {
@@ -187,7 +189,7 @@ public class ImportHandlerUtils {
return ((Double)val.getNumberValue()).intValue(); return ((Double)val.getNumberValue()).intValue();
} }
return null; return null;
}else if (c.getCellType()==Cell.CELL_TYPE_NUMERIC) { }else if (c.getCellType()==CellType.NUMERIC) {
return ((Double) c.getNumericCellValue()).intValue(); return ((Double) c.getNumericCellValue()).intValue();
}else { }else {
return Integer.parseInt(row.getCell(colIndex).getStringCellValue()); return Integer.parseInt(row.getCell(colIndex).getStringCellValue());
@@ -196,10 +198,10 @@ public class ImportHandlerUtils {
public static Double readAsDouble(int colIndex, Row row) { public static Double readAsDouble(int colIndex, Row row) {
Cell c = row.getCell(colIndex); Cell c = row.getCell(colIndex);
if (c == null || c.getCellType() == Cell.CELL_TYPE_BLANK) if (c == null || c.getCellType() == CellType.BLANK)
return 0.0; return 0.0;
FormulaEvaluator eval = row.getSheet().getWorkbook().getCreationHelper().createFormulaEvaluator(); FormulaEvaluator eval = row.getSheet().getWorkbook().getCreationHelper().createFormulaEvaluator();
if(c.getCellType() == Cell.CELL_TYPE_FORMULA) { if(c.getCellType() == CellType.FORMULA) {
if (eval!=null) { if (eval!=null) {
CellValue val = null; CellValue val = null;
try { try {
@@ -211,7 +213,7 @@ public class ImportHandlerUtils {
}else { }else {
return 0.0; return 0.0;
} }
} else if (c.getCellType()==Cell.CELL_TYPE_NUMERIC) { } else if (c.getCellType()==CellType.NUMERIC) {
return row.getCell(colIndex).getNumericCellValue(); return row.getCell(colIndex).getNumericCellValue();
}else { }else {
return Double.parseDouble(row.getCell(colIndex).getStringCellValue()); return Double.parseDouble(row.getCell(colIndex).getStringCellValue());
@@ -234,16 +236,15 @@ public class ImportHandlerUtils {
} }
CellStyle style = workbook.createCellStyle(); CellStyle style = workbook.createCellStyle();
style.setFillForegroundColor(color.getIndex()); style.setFillForegroundColor(color.getIndex());
style.setFillPattern(CellStyle.SOLID_FOREGROUND); style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
Sheet cache = workbook.createSheet(color.toString()); 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()); Row row = cache.createRow(cellReference.getRow());
Cell cell = row.createCell(cellReference.getCol()); Cell cell = row.createCell(cellReference.getCol());
cell.setCellStyle(style); cell.setCellStyle(style);
return style; return style;
} }
public static String getDefaultUserMessages(List<ApiParameterError> ApiParameterErrorList){ public static String getDefaultUserMessages(List<ApiParameterError> ApiParameterErrorList){
@@ -301,20 +302,20 @@ public class ImportHandlerUtils {
for (Row row : sheet) { for (Row row : sheet) {
for (Cell cell : row) { for (Cell cell : row) {
if(name!=null) { 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) || if (sheetName.equals(TemplatePopulateImportConstants.OFFICE_SHEET_NAME) ||
sheetName.equals(TemplatePopulateImportConstants.GL_ACCOUNTS_SHEET_NAME) || sheetName.equals(TemplatePopulateImportConstants.GL_ACCOUNTS_SHEET_NAME) ||
sheetName.equals(TemplatePopulateImportConstants.EXTRAS_SHEET_NAME) || sheetName.equals(TemplatePopulateImportConstants.EXTRAS_SHEET_NAME) ||
sheetName.equals(TemplatePopulateImportConstants.SHARED_PRODUCTS_SHEET_NAME)|| sheetName.equals(TemplatePopulateImportConstants.SHARED_PRODUCTS_SHEET_NAME)||
sheetName.equals(TemplatePopulateImportConstants.ROLES_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 ((Double) row.getCell(cell.getColumnIndex() - 1).getNumericCellValue()).longValue();
return 0L; return 0L;
} else if (sheetName.equals(TemplatePopulateImportConstants.CLIENT_SHEET_NAME) || } else if (sheetName.equals(TemplatePopulateImportConstants.CLIENT_SHEET_NAME) ||
sheetName.equals(TemplatePopulateImportConstants.CENTER_SHEET_NAME) || sheetName.equals(TemplatePopulateImportConstants.CENTER_SHEET_NAME) ||
sheetName.equals(TemplatePopulateImportConstants.GROUP_SHEET_NAME) || sheetName.equals(TemplatePopulateImportConstants.GROUP_SHEET_NAME) ||
sheetName.equals(TemplatePopulateImportConstants.STAFF_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 ((Double) row.getCell(cell.getColumnIndex() + 1).getNumericCellValue()).longValue();
return 0L; return 0L;
} }
@@ -328,7 +329,7 @@ public class ImportHandlerUtils {
for(int i = 0; i < 2; i++) { for(int i = 0; i < 2; i++) {
if (name != null) { if (name != null) {
Cell cell = row.getCell(i); 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(); return ((Double) row.getCell(cell.getColumnIndex() - 1).getNumericCellValue()).longValue();
} }
}else { }else {
@@ -346,7 +347,7 @@ public class ImportHandlerUtils {
for (Row row : sheet) { for (Row row : sheet) {
for (Cell cell : row) { for (Cell cell : row) {
if (name!=null) { if (name!=null) {
if (cell.getCellType() == Cell.CELL_TYPE_STRING if (cell.getCellType() == CellType.STRING
&& cell.getRichStringCellValue().getString().trim() && cell.getRichStringCellValue().getString().trim()
.equals(name)) { .equals(name)) {
return row.getCell(cell.getColumnIndex() - 1) return row.getCell(cell.getColumnIndex() - 1)
@@ -27,7 +27,6 @@ import java.util.List;
import org.apache.fineract.organisation.office.data.OfficeData; import org.apache.fineract.organisation.office.data.OfficeData;
import org.apache.fineract.portfolio.client.data.ClientData; import org.apache.fineract.portfolio.client.data.ClientData;
import org.apache.fineract.portfolio.group.data.GroupGeneralData; 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.CellStyle;
import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet; 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) { protected void writeFormula(int colIndex, Row row, String formula) {
row.createCell(colIndex).setCellType(Cell.CELL_TYPE_FORMULA);
row.createCell(colIndex).setCellFormula(formula); row.createCell(colIndex).setCellFormula(formula);
} }
@@ -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.HSSFDataValidationHelper;
import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.ss.SpreadsheetVersion; 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.Cell;
import org.apache.poi.ss.usermodel.CellStyle; import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.ss.usermodel.DataValidation; import org.apache.poi.ss.usermodel.DataValidation;
@@ -378,9 +379,9 @@ public class LoanWorkbookPopulator extends AbstractWorkbookPopulator {
CellStyle borderStyle = worksheet.getWorkbook().createCellStyle(); CellStyle borderStyle = worksheet.getWorkbook().createCellStyle();
CellStyle doubleBorderStyle = worksheet.getWorkbook().createCellStyle(); CellStyle doubleBorderStyle = worksheet.getWorkbook().createCellStyle();
borderStyle.setBorderBottom(CellStyle.BORDER_THIN); borderStyle.setBorderBottom(BorderStyle.THIN);
doubleBorderStyle.setBorderBottom(CellStyle.BORDER_THIN); doubleBorderStyle.setBorderBottom(BorderStyle.THIN);
doubleBorderStyle.setBorderRight(CellStyle.BORDER_THICK); doubleBorderStyle.setBorderRight(BorderStyle.THICK);
for (int colNo = 0; colNo < 35; colNo++) { for (int colNo = 0; colNo < 35; colNo++) {
Cell cell = rowHeader.getCell(colNo); Cell cell = rowHeader.getCell(colNo);
if (cell == null) if (cell == null)
@@ -297,14 +297,14 @@ public class BulkImportWorkbookPopulatorServiceImpl implements BulkImportWorkboo
private List<CodeValueData> fetchCodeValuesByCodeName(String codeName){ private List<CodeValueData> fetchCodeValuesByCodeName(String codeName){
List<CodeValueData> codeValues=null; List<CodeValueData> codeValues=null;
if (codeName!=null){ if (codeName!=null){
codeValues=(List)codeValueReadPlatformService.retrieveCodeValuesByCode(codeName); codeValues=(List<CodeValueData>)codeValueReadPlatformService.retrieveCodeValuesByCode(codeName);
}else { }else {
throw new NullPointerException(); throw new NullPointerException();
} }
return codeValues; return codeValues;
} }
private List<SavingsProductData>fetchSavingsProducts(){ private List<SavingsProductData>fetchSavingsProducts(){
List<SavingsProductData> savingsProducts=(List)savingsProductReadPlatformService.retrieveAll(); List<SavingsProductData> savingsProducts=(List<SavingsProductData>)savingsProductReadPlatformService.retrieveAll();
return savingsProducts; return savingsProducts;
} }
@@ -21,11 +21,11 @@ package org.apache.fineract.infrastructure.core.boot;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc; import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; 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 @EnableWebMvc
@Configuration @Configuration
public class WebFrontEndConfiguration extends WebMvcConfigurerAdapter { public class WebFrontEndConfiguration implements WebMvcConfigurer {
@Override @Override
public void addResourceHandlers(ResourceHandlerRegistry registry) { public void addResourceHandlers(ResourceHandlerRegistry registry) {
@@ -29,7 +29,7 @@ public class WebTwoFactorXmlConfiguration {
@Bean @Bean
public FilterRegistrationBean twoFactorFilterBean(TwoFactorAuthenticationFilter filter) { public FilterRegistrationBean twoFactorFilterBean(TwoFactorAuthenticationFilter filter) {
FilterRegistrationBean registrationBean = new FilterRegistrationBean(filter); FilterRegistrationBean<TwoFactorAuthenticationFilter> registrationBean = new FilterRegistrationBean<TwoFactorAuthenticationFilter>(filter);
registrationBean.setEnabled(false); registrationBean.setEnabled(false);
return registrationBean; return registrationBean;
} }
@@ -19,7 +19,6 @@
package org.apache.fineract.infrastructure.core.boot; package org.apache.fineract.infrastructure.core.boot;
import com.sun.jersey.spi.spring.container.servlet.SpringServlet; 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.core.filters.ResponseCorsFilter;
import org.apache.fineract.infrastructure.security.filter.TenantAwareBasicAuthenticationFilter; import org.apache.fineract.infrastructure.security.filter.TenantAwareBasicAuthenticationFilter;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@@ -44,9 +43,8 @@ public class WebXmlConfiguration {
@Bean @Bean
public ServletRegistrationBean jersey() { public ServletRegistrationBean jersey() {
Servlet jerseyServlet = new SpringServlet(); ServletRegistrationBean<SpringServlet> jerseyServletRegistration = new ServletRegistrationBean<SpringServlet>();
ServletRegistrationBean jerseyServletRegistration = new ServletRegistrationBean(); jerseyServletRegistration.setServlet(new SpringServlet());
jerseyServletRegistration.setServlet(jerseyServlet);
jerseyServletRegistration.addUrlMappings("/api/v1/*"); jerseyServletRegistration.addUrlMappings("/api/v1/*");
jerseyServletRegistration.setName("jersey-servlet"); jerseyServletRegistration.setName("jersey-servlet");
jerseyServletRegistration.setLoadOnStartup(1); jerseyServletRegistration.setLoadOnStartup(1);
@@ -62,7 +60,7 @@ public class WebXmlConfiguration {
@Bean @Bean
public FilterRegistrationBean filterRegistrationBean() { public FilterRegistrationBean filterRegistrationBean() {
FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean(); FilterRegistrationBean<TenantAwareBasicAuthenticationFilter> filterRegistrationBean = new FilterRegistrationBean<TenantAwareBasicAuthenticationFilter>();
filterRegistrationBean.setFilter(basicAuthenticationProcessingFilter); filterRegistrationBean.setFilter(basicAuthenticationProcessingFilter);
filterRegistrationBean.setEnabled(false); filterRegistrationBean.setEnabled(false);
return filterRegistrationBean; return filterRegistrationBean;
@@ -19,7 +19,6 @@
package org.apache.fineract.infrastructure.core.boot; package org.apache.fineract.infrastructure.core.boot;
import com.sun.jersey.spi.spring.container.servlet.SpringServlet; import com.sun.jersey.spi.spring.container.servlet.SpringServlet;
import javax.servlet.Servlet;
import org.springframework.boot.web.servlet.ServletRegistrationBean; import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
@@ -38,9 +37,8 @@ public class WebXmlOauthConfiguration {
@Bean @Bean
public ServletRegistrationBean jersey() { public ServletRegistrationBean jersey() {
Servlet jerseyServlet = new SpringServlet(); ServletRegistrationBean<SpringServlet> jerseyServletRegistration = new ServletRegistrationBean<SpringServlet>();
ServletRegistrationBean jerseyServletRegistration = new ServletRegistrationBean(); jerseyServletRegistration.setServlet(new SpringServlet());
jerseyServletRegistration.setServlet(jerseyServlet);
jerseyServletRegistration.addUrlMappings("/api/v1/*"); jerseyServletRegistration.addUrlMappings("/api/v1/*");
jerseyServletRegistration.setName("jersey-servlet"); jerseyServletRegistration.setName("jersey-servlet");
jerseyServletRegistration.setLoadOnStartup(1); jerseyServletRegistration.setLoadOnStartup(1);
@@ -56,7 +54,7 @@ public class WebXmlOauthConfiguration {
@Bean @Bean
public ServletRegistrationBean dispatcherRegistration(DispatcherServlet dispatcherServlet) { public ServletRegistrationBean dispatcherRegistration(DispatcherServlet dispatcherServlet) {
ServletRegistrationBean registrationBean = new ServletRegistrationBean(dispatcherServlet); ServletRegistrationBean<DispatcherServlet> registrationBean = new ServletRegistrationBean<DispatcherServlet>(dispatcherServlet);
registrationBean.addUrlMappings("/api/oauth/token"); registrationBean.addUrlMappings("/api/oauth/token");
return registrationBean; return registrationBean;
} }
@@ -23,6 +23,7 @@ import java.sql.SQLException;
import org.apache.openjpa.jdbc.sql.BooleanRepresentationFactory; import org.apache.openjpa.jdbc.sql.BooleanRepresentationFactory;
import org.apache.openjpa.jdbc.sql.MySQLDictionary; import org.apache.openjpa.jdbc.sql.MySQLDictionary;
@SuppressWarnings("unchecked")
public class MySQLDictionaryCustom extends MySQLDictionary { public class MySQLDictionaryCustom extends MySQLDictionary {
public MySQLDictionaryCustom(){ public MySQLDictionaryCustom(){
@@ -49,12 +49,10 @@ public class FromJsonHelper {
private final Gson gsonConverter; private final Gson gsonConverter;
private final JsonParserHelper helperDelegator; private final JsonParserHelper helperDelegator;
private final JsonParser parser;
public FromJsonHelper() { public FromJsonHelper() {
this.gsonConverter = new Gson(); this.gsonConverter = new Gson();
this.helperDelegator = new JsonParserHelper(); this.helperDelegator = new JsonParserHelper();
this.parser = new JsonParser();
} }
public Map<String, Boolean> extractMap(final Type typeOfMap, final String json) { public Map<String, Boolean> extractMap(final Type typeOfMap, final String json) {
@@ -140,7 +138,7 @@ public class FromJsonHelper {
JsonElement parsedElement = null; JsonElement parsedElement = null;
if (StringUtils.isNotBlank(json)) { if (StringUtils.isNotBlank(json)) {
parsedElement = this.parser.parse(json); parsedElement = JsonParser.parseString(json);
} }
return parsedElement; return parsedElement;
} }
@@ -18,11 +18,11 @@
*/ */
package org.apache.fineract.infrastructure.core.service; package org.apache.fineract.infrastructure.core.service;
import com.google.common.collect.ImmutableMap;
import com.googlecode.flyway.core.Flyway; import com.googlecode.flyway.core.Flyway;
import com.googlecode.flyway.core.api.FlywayException; import com.googlecode.flyway.core.api.FlywayException;
import com.googlecode.flyway.core.util.jdbc.DriverDataSource; import com.googlecode.flyway.core.util.jdbc.DriverDataSource;
import java.util.List; import java.util.List;
import java.util.Map;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
import javax.sql.DataSource; import javax.sql.DataSource;
import org.apache.fineract.infrastructure.core.boot.JDBCDriverConfig; import org.apache.fineract.infrastructure.core.boot.JDBCDriverConfig;
@@ -94,7 +94,7 @@ public class TenantDatabaseUpgradeService {
flyway.setDataSource(tenantDataSource); flyway.setDataSource(tenantDataSource);
flyway.setLocations("sql/migrations/list_db"); flyway.setLocations("sql/migrations/list_db");
flyway.setOutOfOrder(true); flyway.setOutOfOrder(true);
flyway.setPlaceholders(ImmutableMap.of( // FINERACT-773 flyway.setPlaceholders(Map.of( // FINERACT-773
"fineract_default_tenantdb_hostname", dbHostname, "fineract_default_tenantdb_hostname", dbHostname,
"fineract_default_tenantdb_port", dbPort, "fineract_default_tenantdb_port", dbPort,
"fineract_default_tenantdb_uid", dbUid, "fineract_default_tenantdb_uid", dbUid,
@@ -475,13 +475,13 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ
// PERMITTED datatables // PERMITTED datatables
final String sql = "select if((exists (select 1 from x_registered_table where registered_table_name = ?)) = 1, 'true', 'false')"; 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 }); 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) { 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 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 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", if (!dataTableExists) { throw new PlatformDataIntegrityException("error.msg.invalid.datatable",
"Invalid Data Table: " + datatableName, "name", datatableName); } "Invalid Data Table: " + datatableName, "name", datatableName); }
} }
@@ -20,7 +20,6 @@ package org.apache.fineract.infrastructure.documentmanagement.contentrepository;
import com.amazonaws.AmazonClientException; import com.amazonaws.AmazonClientException;
import com.amazonaws.AmazonServiceException; import com.amazonaws.AmazonServiceException;
import com.amazonaws.SDKGlobalConfiguration;
import com.amazonaws.auth.BasicAWSCredentials; import com.amazonaws.auth.BasicAWSCredentials;
import com.amazonaws.services.s3.AmazonS3; import com.amazonaws.services.s3.AmazonS3;
import com.amazonaws.services.s3.AmazonS3Client; 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) { public S3ContentRepository(final String bucketName, final String secretKey, final String accessKey) {
this.s3BucketName = bucketName; 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)); this.s3Client = new AmazonS3Client(new BasicAWSCredentials(accessKey, secretKey));
} }
@@ -228,10 +228,9 @@ public class Sender {
if (responseBody == null) { if (responseBody == null) {
return null; return null;
} }
JsonParser jsonParser = new JsonParser();
JsonObject jsonResponse; JsonObject jsonResponse;
try { try {
jsonResponse = (JsonObject) jsonParser.parse(responseBody); jsonResponse = JsonParser.parseString(responseBody).getAsJsonObject();
Result.Builder resultBuilder = new Result.Builder(); Result.Builder resultBuilder = new Result.Builder();
if (jsonResponse.has("results")) { if (jsonResponse.has("results")) {
// Handle response from message sent to specific device. // Handle response from message sent to specific device.
@@ -480,10 +479,9 @@ public class Sender {
return null; return null;
} }
JsonParser parser = new JsonParser();
JsonObject jsonResponse; JsonObject jsonResponse;
try { try {
jsonResponse = (JsonObject) parser.parse(responseBody); jsonResponse = JsonParser.parseString(responseBody).getAsJsonObject();
int success = getNumber(responseMap, JSON_SUCCESS).intValue(); int success = getNumber(responseMap, JSON_SUCCESS).intValue();
int failure = getNumber(responseMap, JSON_FAILURE).intValue(); int failure = getNumber(responseMap, JSON_FAILURE).intValue();
int canonicalIds = getNumber(responseMap, JSON_CANONICAL_IDS) int canonicalIds = getNumber(responseMap, JSON_CANONICAL_IDS)
@@ -106,7 +106,7 @@ public class TwilioHookProcessor implements HookProcessor {
return; return;
} }
} else { } else {
json = new JsonParser().parse(payload).getAsJsonObject(); json = JsonParser.parseString(payload).getAsJsonObject();
} }
service.sendSmsBridgeRequest(entityName, actionName, service.sendSmsBridgeRequest(entityName, actionName,
tenantIdentifier, apiKey, json, callback); tenantIdentifier, apiKey, json, callback);
@@ -136,7 +136,7 @@ public class TwilioHookProcessor implements HookProcessor {
jsonMap.put("mobileNo", mobileNo); jsonMap.put("mobileNo", mobileNo);
jsonMap.put("message", compiledMessage); jsonMap.put("message", compiledMessage);
final String jsonString = new Gson().toJson(jsonMap); final String jsonString = new Gson().toJson(jsonMap);
json = new JsonParser().parse(jsonString).getAsJsonObject(); json = JsonParser.parseString(jsonString).getAsJsonObject();
} }
} }
} catch (IOException e) { } catch (IOException e) {
@@ -78,7 +78,7 @@ public class WebHookProcessor implements HookProcessor {
if (contentType.equalsIgnoreCase("json") if (contentType.equalsIgnoreCase("json")
|| contentType.contains("json")) { || contentType.contains("json")) {
final JsonObject json = new JsonParser().parse(payload) final JsonObject json = JsonParser.parseString(payload)
.getAsJsonObject(); .getAsJsonObject();
service.sendJsonRequest(entityName, actionName, tenantIdentifier, service.sendJsonRequest(entityName, actionName, tenantIdentifier,
fineractEndpointUrl, json, callback); fineractEndpointUrl, json, callback);
@@ -33,14 +33,14 @@ public class OTPRequestRepository {
public OTPRequest getOTPRequestForUser(AppUser user) { public OTPRequest getOTPRequestForUser(AppUser user) {
Assert.notNull(user); Assert.notNull(user, "User must not be null");
return this.OTPrequests.get(user.getId()); return this.OTPrequests.get(user.getId());
} }
public void addOTPRequest(AppUser user, OTPRequest request) { public void addOTPRequest(AppUser user, OTPRequest request) {
Assert.notNull(user); Assert.notNull(user, "User must not be null");
Assert.notNull(request); Assert.notNull(request, "Request must not be null");
this.OTPrequests.put(user.getId(), request); this.OTPrequests.put(user.getId(), request);
} }
@@ -112,7 +112,7 @@ public class ProvisioningCategoryWritePlatformServiceJpaRepositoryImpl implement
private boolean isAnyLoanProductsAssociateWithThisProvisioningCategory(final Long categoryID) { 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 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 }); 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 * Guaranteed to throw an exception no matter what the data integrity issue
@@ -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 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 }); 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) { 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 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 }); 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) { 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 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 }); 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) { 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 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 }); final String isSavingsUsingCharge = this.jdbcTemplate.queryForObject(sql, String.class, new Object[] { chargeId });
return new Boolean(isSavingsUsingCharge); return Boolean.valueOf(isSavingsUsingCharge);
} }
} }
@@ -536,11 +536,11 @@ public class GroupsApiResource {
List<GLIMContainer> glimContainer = Collections.emptyList(); List<GLIMContainer> glimContainer = Collections.emptyList();
if(parentLoanAccountNo==null) if(parentLoanAccountNo==null)
{ {
glimContainer=(List)glimAccountInfoReadPlatformService.findGlimAccount(groupId); glimContainer=(List<GLIMContainer>)glimAccountInfoReadPlatformService.findGlimAccount(groupId);
} }
else else
{ {
glimContainer=(List)glimAccountInfoReadPlatformService.findGlimAccountbyGroupAndAccount(groupId,parentLoanAccountNo); glimContainer=(List<GLIMContainer>)glimAccountInfoReadPlatformService.findGlimAccountbyGroupAndAccount(groupId,parentLoanAccountNo);
} }
@@ -568,11 +568,11 @@ public class GroupsApiResource {
} }
else if(parentGSIMAccountNo !=null && parentGSIMId==null ) else if(parentGSIMAccountNo !=null && parentGSIMId==null )
{ {
gsimContainer= (List)this.gsimReadPlatformService.findGsimAccountContainerbyGsimAccountNumber(parentGSIMAccountNo); gsimContainer= (List<GSIMContainer>)this.gsimReadPlatformService.findGsimAccountContainerbyGsimAccountNumber(parentGSIMAccountNo);
} }
else else
{ {
gsimContainer= (List)this.gsimReadPlatformService.findGSIMAccountContainerByGroupId(groupId); gsimContainer= (List<GSIMContainer>)this.gsimReadPlatformService.findGSIMAccountContainerByGroupId(groupId);
} }
@@ -174,10 +174,8 @@ public class SelfSavingsApiResource {
@GET @GET
@Path("template") @Path("template")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON })
public String template(@QueryParam("clientId") final Long clientId, @QueryParam("productId") final Long productId, public String template(@QueryParam("clientId") final Long clientId, @QueryParam("productId") final Long productId, @Context final UriInfo uriInfo) {
final String apiRequestBodyAsJson, @Context final UriInfo uriInfo) {
validateAppuserClientsMapping(clientId); validateAppuserClientsMapping(clientId);
Long groupId = null; Long groupId = null;
@@ -20,8 +20,8 @@ package org.apache.fineract.common;
import static io.restassured.RestAssured.given; import static io.restassured.RestAssured.given;
import static io.restassured.path.json.JsonPath.from; import static io.restassured.path.json.JsonPath.from;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
import io.restassured.RestAssured; import io.restassured.RestAssured;
@@ -27,7 +27,7 @@ import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.mockito.Mockito; import org.mockito.Mockito;
import org.mockito.runners.MockitoJUnitRunner; import org.mockito.junit.MockitoJUnitRunner;
@RunWith(MockitoJUnitRunner.class) @RunWith(MockitoJUnitRunner.class)
public class ReadTaxonomyMappingServiceImplTest { public class ReadTaxonomyMappingServiceImplTest {
@@ -38,11 +38,11 @@ import org.apache.fineract.mix.service.XBRLBuilder;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.mockito.ArgumentMatchers;
import org.mockito.InjectMocks; import org.mockito.InjectMocks;
import org.mockito.Matchers;
import org.mockito.Mock; import org.mockito.Mock;
import org.mockito.Mockito; import org.mockito.Mockito;
import org.mockito.runners.MockitoJUnitRunner; import org.mockito.junit.MockitoJUnitRunner;
import org.w3c.dom.NodeList; import org.w3c.dom.NodeList;
import org.xml.sax.SAXException; import org.xml.sax.SAXException;
@@ -58,7 +58,7 @@ public class XBRLBuilderTest {
public void setUp() { public void setUp() {
this.readNamespaceService = Mockito.mock(NamespaceReadPlatformServiceImpl.class); 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")); new NamespaceData(1l, "mockedprefix", "mockedurl"));
} }
@@ -25,7 +25,7 @@ import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.mockito.Mockito; import org.mockito.Mockito;
import org.mockito.runners.MockitoJUnitRunner; import org.mockito.junit.MockitoJUnitRunner;
@RunWith(MockitoJUnitRunner.class) @RunWith(MockitoJUnitRunner.class)
public class ListenerTest { public class ListenerTest {
@@ -41,7 +41,7 @@ import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.mockito.Mock; import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner; import org.mockito.junit.MockitoJUnitRunner;
import org.springframework.security.core.userdetails.User; import org.springframework.security.core.userdetails.User;
@RunWith(MockitoJUnitRunner.class) @RunWith(MockitoJUnitRunner.class)
@@ -40,7 +40,7 @@ import org.apache.fineract.useradministration.domain.RoleRepository;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.mockito.Mock; import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner; import org.mockito.junit.MockitoJUnitRunner;
@RunWith(MockitoJUnitRunner.class) @RunWith(MockitoJUnitRunner.class)
public class TopicTest { public class TopicTest {
@@ -29,7 +29,7 @@ import org.joda.time.LocalDate;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.mockito.runners.MockitoJUnitRunner; import org.mockito.junit.MockitoJUnitRunner;
@SuppressWarnings("unused") @SuppressWarnings("unused")
@RunWith(MockitoJUnitRunner.class) @RunWith(MockitoJUnitRunner.class)
@@ -29,7 +29,7 @@ import org.joda.time.LocalDate;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.mockito.runners.MockitoJUnitRunner; import org.mockito.junit.MockitoJUnitRunner;
@SuppressWarnings("unused") @SuppressWarnings("unused")
@RunWith(MockitoJUnitRunner.class) @RunWith(MockitoJUnitRunner.class)
@@ -125,7 +125,7 @@ public class TemplateMergeServiceTest {
protected Map<String, Object> createMapFromJSON(String jsonText) { protected Map<String, Object> createMapFromJSON(String jsonText) {
Gson gson = new Gson(); Gson gson = new Gson();
Type ssMap = new TypeToken<Map<String, Object>>(){}.getType(); Type ssMap = new TypeToken<Map<String, Object>>(){}.getType();
JsonElement json = new JsonParser().parse(jsonText); JsonElement json = JsonParser.parseString(jsonText);
return gson.fromJson(json, ssMap); return gson.fromJson(json, ssMap);
} }
} }