FINERACT-855: Fixing test failures due to rounding difference

This commit is contained in:
Petri Tuomola
2020-06-02 13:00:00 +02:00
committed by Michael Vorburger ⛑️
parent b6e6eba56f
commit 23fa22e096
7 changed files with 118 additions and 162 deletions
@@ -120,7 +120,7 @@ public class AccountingScenarioIntegrationTest {
this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec);
this.accountHelper = new AccountHelper(this.requestSpec, this.responseSpec);
this.journalEntryHelper = new JournalEntryHelper(this.requestSpec, this.responseSpec);
this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec, this.responseSpec);
this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec);
this.periodicAccrualAccountingHelper = new PeriodicAccrualAccountingHelper(this.requestSpec, this.responseSpec);
}
@@ -2537,7 +2537,7 @@ public class ClientLoanIntegrationTest {
@Ignore // TODO FINERACT-885
public void loanWithFlatCahargesAndPeriodicAccrualAccountingEnabled() throws InterruptedException {
this.journalEntryHelper = new JournalEntryHelper(this.requestSpec, this.responseSpec);
this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec, this.responseSpec);
this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec);
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
ClientHelper.verifyClientCreatedOnServer(this.requestSpec, this.responseSpec, clientID);
@@ -2739,7 +2739,7 @@ public class ClientLoanIntegrationTest {
@Ignore // TODO FINERACT-885
public void loanWithCahargesOfTypeAmountPercentageAndPeriodicAccrualAccountingEnabled() throws InterruptedException {
this.journalEntryHelper = new JournalEntryHelper(this.requestSpec, this.responseSpec);
this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec, this.responseSpec);
this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec);
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
ClientHelper.verifyClientCreatedOnServer(this.requestSpec, this.responseSpec, clientID);
@@ -2945,7 +2945,7 @@ public class ClientLoanIntegrationTest {
public void loanWithCahargesOfTypeAmountPlusInterestPercentageAndPeriodicAccrualAccountingEnabled()
throws InterruptedException {
this.journalEntryHelper = new JournalEntryHelper(this.requestSpec, this.responseSpec);
this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec, this.responseSpec);
this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec);
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
ClientHelper.verifyClientCreatedOnServer(this.requestSpec, this.responseSpec, clientID);
@@ -3971,7 +3971,7 @@ public class ClientLoanIntegrationTest {
public void testLoanScheduleWithInterestRecalculation_WITH_REST_DAILY_INTEREST_COMPOUND_INTEREST_FEE_STRATEGY_WITH_OVERDUE_CHARGE()
throws InterruptedException {
this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec);
this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec, this.responseSpec);
this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec);
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy");
dateFormat.setTimeZone(Utils.getTimeZoneOfTenant());
@@ -1967,7 +1967,7 @@ public class ClientSavingsIntegrationTest {
transactionDate = transactionDate.minusDays(30);
}
SchedulerJobHelper jobHelper = new SchedulerJobHelper(this.requestSpec, this.responseSpec);
SchedulerJobHelper jobHelper = new SchedulerJobHelper(this.requestSpec);
jobHelper.executeJob("Update Savings Dormant Accounts");
//VERIFY WITHIN PROVIDED RANGE DOESN'T INACTIVATE
@@ -28,8 +28,6 @@ import io.restassured.specification.ResponseSpecification;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.DateFormat;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
@@ -61,7 +59,6 @@ import org.joda.time.Months;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -103,6 +100,11 @@ public class FixedDepositTest {
public static final Integer BIANNULLY_INTERVAL = 6;
public static final Integer ANNUL_INTERVAL = 12;
// TODO Given the difference in calculation methods in test vs application, the exact values
// returned may differ enough to cause differences in rounding. Given this, we only compare the full
// digits. A proper solution would be to implement the exact interest calculation in this test,
// and then to compare the exact results
@Before
public void setup() {
Utils.initializeRESTAssured();
@@ -398,7 +400,6 @@ public class FixedDepositTest {
@Test
@Ignore // TODO FINERACT-950
public void testFixedDepositAccountClosureTypeWithdrawal_WITH_HOLD_TAX() throws InterruptedException {
this.fixedDepositProductHelper = new FixedDepositProductHelper(this.requestSpec, this.responseSpec);
this.accountHelper = new AccountHelper(this.requestSpec, this.responseSpec);
@@ -507,7 +508,7 @@ public class FixedDepositTest {
* FD account verify whether account is matured
*/
SchedulerJobHelper schedulerJobHelper = new SchedulerJobHelper(requestSpec, responseSpec);
SchedulerJobHelper schedulerJobHelper = new SchedulerJobHelper(requestSpec);
String JobName = "Update Deposit Accounts Maturity details";
schedulerJobHelper.executeJob(JobName);
@@ -1234,10 +1235,8 @@ public class FixedDepositTest {
principal = this.fixedDepositAccountHelper.getPrincipalAfterCompoundingInterest(todaysDate, principal, depositPeriod,
interestPerDay, MONTHLY_INTERVAL, MONTHLY_INTERVAL);
DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern(".");
principal = Float.valueOf(decimalFormat.format(principal));
maturityAmount = Float.valueOf(decimalFormat.format(maturityAmount));
principal = (float) Math.floor(principal);
maturityAmount = (float) Math.floor(maturityAmount);
LOG.info("{}",principal.toString());
Assert.assertEquals("Verifying Maturity amount for Fixed Deposit Account", principal, maturityAmount);
}
@@ -1307,10 +1306,9 @@ public class FixedDepositTest {
principal = this.fixedDepositAccountHelper.getPrincipalAfterCompoundingInterest(todaysDate, principal, depositPeriod,
interestPerDay, MONTHLY_INTERVAL, MONTHLY_INTERVAL);
DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern(".");
principal = Float.valueOf(decimalFormat.format(principal));
maturityAmount = Float.valueOf(decimalFormat.format(maturityAmount));
principal = (float) Math.floor(principal);
maturityAmount = (float) Math.floor(maturityAmount);
LOG.info("{}",principal.toString());
Assert.assertEquals("Verifying Maturity amount for Fixed Deposit Account", principal, maturityAmount);
}
@@ -1409,11 +1407,9 @@ public class FixedDepositTest {
fixedDepositAccountData = this.fixedDepositAccountHelper.getFixedDepositAccountById(this.requestSpec, this.responseSpec,
fixedDepositAccountId);
DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern(".");
principal = Float.valueOf(decimalFormat.format(principal));
Float maturityAmount = Float.valueOf(decimalFormat.format(fixedDepositAccountData.get("maturityAmount")));
principal = (float) Math.floor(principal);
Float maturityAmount = (float) Math.floor((Float) fixedDepositAccountData.get("maturityAmount"));
Assert.assertEquals("Verifying Pre-Closure maturity amount", principal, maturityAmount);
@@ -1517,11 +1513,9 @@ public class FixedDepositTest {
fixedDepositAccountData = this.fixedDepositAccountHelper.getFixedDepositAccountById(this.requestSpec, this.responseSpec,
fixedDepositAccountId);
DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern(".");
principal = Float.valueOf(decimalFormat.format(principal));
Float maturityAmount = Float.valueOf(decimalFormat.format(fixedDepositAccountData.get("maturityAmount")));
principal = (float) Math.floor(principal);
Float maturityAmount = (float) Math.floor((Float) fixedDepositAccountData.get("maturityAmount"));
Assert.assertEquals("Verifying Pre-Closure maturity amount", principal, maturityAmount);
@@ -1630,10 +1624,9 @@ public class FixedDepositTest {
fixedDepositAccountData = this.fixedDepositAccountHelper.getFixedDepositAccountById(this.requestSpec, this.responseSpec,
fixedDepositAccountId);
DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern(".");
Float expectedPrematureAmount = Float.valueOf(decimalFormat.format(principal));
Float maturityAmount = Float.valueOf(decimalFormat.format(fixedDepositAccountData.get("maturityAmount")));
Double expectedPrematureAmount = Math.floor(principal);
Double maturityAmount = Math.floor((float) fixedDepositAccountData.get("maturityAmount"));
Assert.assertEquals("Verifying Pre-Closure maturity amount", expectedPrematureAmount, maturityAmount);
@@ -1746,10 +1739,9 @@ public class FixedDepositTest {
fixedDepositAccountData = this.fixedDepositAccountHelper.getFixedDepositAccountById(this.requestSpec, this.responseSpec,
fixedDepositAccountId);
DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern(".");
Float expectedPrematureAmount = Float.valueOf(decimalFormat.format(principal));
Float maturityAmount = Float.valueOf(decimalFormat.format(fixedDepositAccountData.get("maturityAmount")));
Float expectedPrematureAmount = (float) Math.floor(principal);
Float maturityAmount = (float) Math.floor((Float) fixedDepositAccountData.get("maturityAmount"));
Assert.assertEquals("Verifying Pre-Closure maturity amount", expectedPrematureAmount, maturityAmount);
@@ -1822,10 +1814,8 @@ public class FixedDepositTest {
principal = this.fixedDepositAccountHelper.getPrincipalAfterCompoundingInterest(todaysDate, principal, depositPeriod,
interestPerDay, DAILY_COMPOUNDING_INTERVAL, MONTHLY_INTERVAL);
DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern(".");
principal = Float.valueOf(decimalFormat.format(principal));
maturityAmount = Float.valueOf(decimalFormat.format(maturityAmount));
principal = (float) Math.floor(principal);
maturityAmount = (float) Math.floor(maturityAmount);
LOG.info("{}",principal.toString());
Assert.assertEquals("Verifying Maturity amount for Fixed Deposit Account", principal, maturityAmount);
@@ -1981,10 +1971,9 @@ public class FixedDepositTest {
fixedDepositAccountData = this.fixedDepositAccountHelper.getFixedDepositAccountById(this.requestSpec, this.responseSpec,
fixedDepositAccountId);
DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern(".");
Float expectedPrematureAmount = Float.valueOf(decimalFormat.format(principal));
Float maturityAmount = Float.valueOf(decimalFormat.format(fixedDepositAccountData.get("maturityAmount")));
Double expectedPrematureAmount = Math.floor(principal);
Double maturityAmount = Math.floor((Float) fixedDepositAccountData.get("maturityAmount"));
Assert.assertEquals("Verifying Maturity amount", expectedPrematureAmount, maturityAmount);
@@ -2065,10 +2054,9 @@ public class FixedDepositTest {
fixedDepositAccountData = this.fixedDepositAccountHelper.getFixedDepositAccountById(this.requestSpec, this.responseSpec,
fixedDepositAccountId);
DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern(".");
Float expectedPrematureAmount = Float.valueOf(decimalFormat.format(principal));
Float maturityAmount = Float.valueOf(decimalFormat.format(fixedDepositAccountData.get("maturityAmount")));
Double expectedPrematureAmount = Math.floor(principal);
Double maturityAmount = Math.floor((Float) fixedDepositAccountData.get("maturityAmount"));
Assert.assertEquals("Verifying Maturity amount", expectedPrematureAmount, maturityAmount);
@@ -2147,10 +2135,9 @@ public class FixedDepositTest {
fixedDepositAccountData = this.fixedDepositAccountHelper.getFixedDepositAccountById(this.requestSpec, this.responseSpec,
fixedDepositAccountId);
DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern(".");
Float expectedPrematureAmount = Float.valueOf(decimalFormat.format(principal));
Float maturityAmount = Float.valueOf(decimalFormat.format(fixedDepositAccountData.get("maturityAmount")));
Double expectedPrematureAmount = Math.floor(principal);
Double maturityAmount = Math.floor((Float) fixedDepositAccountData.get("maturityAmount"));
Assert.assertEquals("Verifying Pre-Closure maturity amount", expectedPrematureAmount, maturityAmount);
@@ -2229,10 +2216,9 @@ public class FixedDepositTest {
fixedDepositAccountData = this.fixedDepositAccountHelper.getFixedDepositAccountById(this.requestSpec, this.responseSpec,
fixedDepositAccountId);
DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern(".");
Float expectedPrematureAmount = Float.valueOf(decimalFormat.format(principal));
Float maturityAmount = Float.valueOf(decimalFormat.format(fixedDepositAccountData.get("maturityAmount")));
Double expectedPrematureAmount = Math.floor(principal);
Double maturityAmount = Math.floor((Float) fixedDepositAccountData.get("maturityAmount"));
Assert.assertEquals("Verifying Pre-Closure maturity amount", expectedPrematureAmount, maturityAmount);
@@ -2311,10 +2297,9 @@ public class FixedDepositTest {
fixedDepositAccountData = this.fixedDepositAccountHelper.getFixedDepositAccountById(this.requestSpec, this.responseSpec,
fixedDepositAccountId);
DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern(".");
Float expectedPrematureAmount = Float.valueOf(decimalFormat.format(principal));
Float maturityAmount = Float.valueOf(decimalFormat.format(fixedDepositAccountData.get("maturityAmount")));
Double expectedPrematureAmount = Math.floor(principal);
Double maturityAmount = Math.floor((Float) fixedDepositAccountData.get("maturityAmount"));
Assert.assertEquals("Verifying Pre-Closure maturity amount", expectedPrematureAmount, maturityAmount);
}
@@ -2392,10 +2377,9 @@ public class FixedDepositTest {
fixedDepositAccountData = this.fixedDepositAccountHelper.getFixedDepositAccountById(this.requestSpec, this.responseSpec,
fixedDepositAccountId);
DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern(".");
Float expectedPrematureAmount = Float.valueOf(decimalFormat.format(principal));
Float maturityAmount = Float.valueOf(decimalFormat.format(fixedDepositAccountData.get("maturityAmount")));
Double expectedPrematureAmount = Math.floor(principal);
Double maturityAmount = Math.floor((Float) fixedDepositAccountData.get("maturityAmount"));
Assert.assertEquals("Verifying Pre-Closure maturity amount", expectedPrematureAmount, maturityAmount);
}
@@ -26,8 +26,6 @@ import io.restassured.http.ContentType;
import io.restassured.specification.RequestSpecification;
import io.restassured.specification.ResponseSpecification;
import java.text.DateFormat;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
@@ -60,7 +58,6 @@ import org.joda.time.Months;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -104,6 +101,11 @@ public class RecurringDepositTest {
public static final Float DEPOSIT_AMOUNT = 2000.0f;
// TODO Given the difference in calculation methods in test vs application, the exact values
// returned may differ enough to cause differences in rounding. Given this, we only compare the full
// digits. A proper solution would be to implement the exact interest calculation in this test,
// and then to compare the exact results
@Before
public void setup() {
Utils.initializeRESTAssured();
@@ -462,14 +464,12 @@ public class RecurringDepositTest {
Float prematurityAmount = (Float) recurringDepositData.get("maturityAmount");
HashMap savingsSummaryAfter = this.savingsAccountHelper.getSavingsSummary(savingsId);
Float balanceAfter = (Float) savingsSummaryAfter.get("accountBalance");
Float expectedSavingsBalance = balanceBefore + prematurityAmount;
DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern(".");
Double balanceAfter = Math.floor((Float) savingsSummaryAfter.get("accountBalance"));
Double expectedSavingsBalance = Math.floor(balanceBefore + prematurityAmount);
Assert.assertEquals("Verifying Savings Account Balance after Premature Closure", decimalFormat.format(expectedSavingsBalance),
decimalFormat.format(balanceAfter));
Assert.assertEquals("Verifying Savings Account Balance after Premature Closure", expectedSavingsBalance,
balanceAfter);
}
@@ -676,21 +676,18 @@ public class RecurringDepositTest {
JournalEntry.TransactionType.CREDIT));
HashMap savingsSummaryAfter = this.savingsAccountHelper.getSavingsSummary(savingsId);
Float balanceAfter = (Float) savingsSummaryAfter.get("accountBalance");
Float expectedSavingsBalance = balanceBefore + prematurityAmount;
DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern(".");
Double balanceAfter = Math.floor((Float) savingsSummaryAfter.get("accountBalance"));
Double expectedSavingsBalance = Math.floor(balanceBefore + prematurityAmount);
Assert.assertEquals("Verifying Savings Account Balance after Premature Closure", decimalFormat.format(expectedSavingsBalance),
decimalFormat.format(balanceAfter));
Assert.assertEquals("Verifying Savings Account Balance after Premature Closure", expectedSavingsBalance,
balanceAfter);
}
@Test
@Ignore // TODO FINERACT-855
public void testRecurringDepositAccountWithClosureTypeTransferToSavings_WITH_HOLD_TAX() throws InterruptedException {
this.recurringDepositProductHelper = new RecurringDepositProductHelper(this.requestSpec, this.responseSpec);
this.accountHelper = new AccountHelper(this.requestSpec, this.responseSpec);
@@ -829,9 +826,9 @@ public class RecurringDepositTest {
* FD account verify whether account is matured
*/
SchedulerJobHelper schedulerJobHelper = new SchedulerJobHelper(requestSpec, responseSpec);
SchedulerJobHelper schedulerJobHelper = new SchedulerJobHelper(requestSpec);
String JobName = "Update Deposit Accounts Maturity details";
schedulerJobHelper.executeJob(JobName);
schedulerJobHelper.executeAndAwaitJob(JobName);
HashMap accountDetails = this.recurringDepositAccountHelper.getRecurringDepositAccountById(this.requestSpec, this.responseSpec,
recurringDepositAccountId);
@@ -857,7 +854,6 @@ public class RecurringDepositTest {
* transaction type ReInvest and Cash Based accounting enabled
*/
@Test
@Ignore // TODO FINERACT-855
public void testRecurringDepositAccountWithPrematureClosureTypeReinvest() {
this.recurringDepositProductHelper = new RecurringDepositProductHelper(this.requestSpec, this.responseSpec);
this.accountHelper = new AccountHelper(this.requestSpec, this.responseSpec);
@@ -1430,10 +1426,8 @@ public class RecurringDepositTest {
principal = this.recurringDepositAccountHelper.getPrincipalAfterCompoundingInterest(todaysDate, principal, depositAmount,
depositPeriod, interestPerDay, MONTHLY_INTERVAL, MONTHLY_INTERVAL);
DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern(".");
principal = Float.valueOf(decimalFormat.format(principal));
maturityAmount = Float.valueOf(decimalFormat.format(maturityAmount));
principal = (float) Math.floor(principal);
maturityAmount = (float) Math.floor(maturityAmount);
LOG.info("{}",principal.toString());
Assert.assertEquals("Verifying Maturity amount for Recurring Deposit Account", principal, maturityAmount);
}
@@ -1515,10 +1509,8 @@ public class RecurringDepositTest {
principal = this.recurringDepositAccountHelper.getPrincipalAfterCompoundingInterest(todaysDate, principal, depositAmount,
depositPeriod, interestPerDay, MONTHLY_INTERVAL, MONTHLY_INTERVAL);
DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern(".");
principal = Float.valueOf(decimalFormat.format(principal));
maturityAmount = Float.valueOf(decimalFormat.format(maturityAmount));
principal = (float) Math.floor(principal);
maturityAmount = (float) Math.floor(maturityAmount);
LOG.info("{}",principal.toString());
Assert.assertEquals("Verifying Maturity amount for Recurring Deposit Account", principal, maturityAmount);
}
@@ -1593,16 +1585,13 @@ public class RecurringDepositTest {
LOG.info("per day = {}" , perDay);
double interestPerDay = interestRateInFraction * perDay;
DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern(".");
Integer currentDate = Integer.valueOf(currentDateFormat.format(todaysDate.getTime()));
Integer daysInMonth = todaysDate.getActualMaximum(Calendar.DATE);
daysInMonth = (daysInMonth - currentDate) + 1;
Float interestToBePosted = Float.valueOf(decimalFormat.format(interestPerDay * principal * daysInMonth));
Float interestToBePosted = (float) (interestPerDay * principal * daysInMonth);
principal += interestToBePosted;
Float expectedBalanceAfter = Float.valueOf(decimalFormat.format(principal));
Float expectedBalanceAfter = (float) Math.floor(principal);
LOG.info("{}",expectedBalanceAfter.toString());
Integer transactionIdForPostInterest = this.recurringDepositAccountHelper
@@ -1610,8 +1599,9 @@ public class RecurringDepositTest {
Assert.assertNotNull(transactionIdForPostInterest);
HashMap recurringDepositAccountSummary = this.recurringDepositAccountHelper.getRecurringDepositSummary(recurringDepositAccountId);
Float interestAmountPosted = Float.valueOf(decimalFormat.format(recurringDepositAccountSummary.get("totalInterestPosted")));
Float principalAfter = Float.valueOf(decimalFormat.format(recurringDepositAccountSummary.get("accountBalance")));
Float interestAmountPosted = (float) Math.floor((Float) recurringDepositAccountSummary.get("totalInterestPosted"));
Float principalAfter = (float) Math.floor((Float) recurringDepositAccountSummary.get("accountBalance"));
interestToBePosted = (float) Math.floor(interestToBePosted);
Assert.assertEquals("Verifying Amount of Interest Posted to Recurring Deposit Account", interestToBePosted, interestAmountPosted);
Assert.assertEquals("Verifying Principal Amount after Interest Posting", expectedBalanceAfter, principalAfter);
@@ -1735,11 +1725,9 @@ public class RecurringDepositTest {
recurringDepositAccountData = this.recurringDepositAccountHelper.getRecurringDepositAccountById(this.requestSpec,
this.responseSpec, recurringDepositAccountId);
DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern(".");
principal = Float.valueOf(decimalFormat.format(principal));
Float maturityAmount = Float.valueOf(decimalFormat.format(recurringDepositAccountData.get("maturityAmount")));
principal = (float) Math.floor(principal);
Float maturityAmount = (float) Math.floor((Float) recurringDepositAccountData.get("maturityAmount"));
Assert.assertEquals("Verifying Pre-Closure maturity amount", principal, maturityAmount);
@@ -1867,11 +1855,9 @@ public class RecurringDepositTest {
recurringDepositAccountData = this.recurringDepositAccountHelper.getRecurringDepositAccountById(this.requestSpec,
this.responseSpec, recurringDepositAccountId);
DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern(".");
principal = Float.valueOf(decimalFormat.format(principal));
Float maturityAmount = Float.valueOf(decimalFormat.format(recurringDepositAccountData.get("maturityAmount")));
principal = (float) Math.floor(principal);
Float maturityAmount = (float) Math.floor((Float) recurringDepositAccountData.get("maturityAmount"));
Assert.assertEquals("Verifying Pre-Closure maturity amount", principal, maturityAmount);
@@ -2007,11 +1993,9 @@ public class RecurringDepositTest {
recurringDepositAccountData = this.recurringDepositAccountHelper.getRecurringDepositAccountById(this.requestSpec,
this.responseSpec, recurringDepositAccountId);
DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern(".");
principal = Float.valueOf(decimalFormat.format(principal));
Float maturityAmount = Float.valueOf(decimalFormat.format(recurringDepositAccountData.get("maturityAmount")));
principal = (float) Math.floor(principal);
Float maturityAmount = (float) Math.floor((Float) recurringDepositAccountData.get("maturityAmount"));
Assert.assertEquals("Verifying Pre-Closure maturity amount", principal, maturityAmount);
@@ -2152,11 +2136,9 @@ public class RecurringDepositTest {
recurringDepositAccountData = this.recurringDepositAccountHelper.getRecurringDepositAccountById(this.requestSpec,
this.responseSpec, recurringDepositAccountId);
DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern(".");
principal = Float.valueOf(decimalFormat.format(principal));
Float maturityAmount = Float.valueOf(decimalFormat.format(recurringDepositAccountData.get("maturityAmount")));
principal = (float) Math.floor(principal);
Float maturityAmount = (float) Math.floor((Float) recurringDepositAccountData.get("maturityAmount"));
Assert.assertEquals("Verifying Pre-Closure maturity amount", principal, maturityAmount);
@@ -2237,10 +2219,8 @@ public class RecurringDepositTest {
principal = this.recurringDepositAccountHelper.getPrincipalAfterCompoundingInterest(todaysDate, principal, recurringDepositAmount,
depositPeriod, interestPerDay, DAILY_COMPOUNDING_INTERVAL, MONTHLY_INTERVAL);
DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern(".");
principal = Float.valueOf(decimalFormat.format(principal));
maturityAmount = Float.valueOf(decimalFormat.format(maturityAmount));
principal = (float) Math.floor(principal);
maturityAmount = (float) Math.floor(maturityAmount);
LOG.info("{}",principal.toString());
Assert.assertEquals("Verifying Maturity amount for Recurring Deposit Account", principal, maturityAmount);
@@ -2322,10 +2302,8 @@ public class RecurringDepositTest {
principal = this.recurringDepositAccountHelper.getPrincipalAfterCompoundingInterest(todaysDate, principal, recurringDepositAmount,
depositPeriod, interestPerDay, DAILY_COMPOUNDING_INTERVAL, MONTHLY_INTERVAL);
DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern(".");
principal = Float.valueOf(decimalFormat.format(principal));
maturityAmount = Float.valueOf(decimalFormat.format(maturityAmount));
principal = (float) Math.floor(principal);
maturityAmount = (float) Math.floor(maturityAmount);
LOG.info("{}",principal.toString());
Assert.assertEquals("Verifying Maturity amount for Recurring Deposit Account", principal, maturityAmount);
@@ -2413,10 +2391,9 @@ public class RecurringDepositTest {
recurringDepositAccountData = this.recurringDepositAccountHelper.getRecurringDepositAccountById(this.requestSpec,
this.responseSpec, recurringDepositAccountId);
DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern(".");
Float expectedPrematureAmount = Float.valueOf(decimalFormat.format(principal));
Float maturityAmount = Float.valueOf(decimalFormat.format(recurringDepositAccountData.get("maturityAmount")));
Double expectedPrematureAmount = Math.floor(principal);
Double maturityAmount = Math.floor((Float) recurringDepositAccountData.get("maturityAmount"));
Assert.assertEquals("Verifying Pre-Closure maturity amount", expectedPrematureAmount, maturityAmount);
@@ -2504,10 +2481,9 @@ public class RecurringDepositTest {
recurringDepositAccountData = this.recurringDepositAccountHelper.getRecurringDepositAccountById(this.requestSpec,
this.responseSpec, recurringDepositAccountId);
DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern(".");
Float expectedPrematureAmount = Float.valueOf(decimalFormat.format(principal));
Float maturityAmount = Float.valueOf(decimalFormat.format(recurringDepositAccountData.get("maturityAmount")));
Double expectedPrematureAmount = Math.floor(principal);
Double maturityAmount = Math.floor((Float) recurringDepositAccountData.get("maturityAmount"));
Assert.assertEquals("Verifying Pre-Closure maturity amount", expectedPrematureAmount, maturityAmount);
@@ -2595,10 +2571,9 @@ public class RecurringDepositTest {
recurringDepositAccountData = this.recurringDepositAccountHelper.getRecurringDepositAccountById(this.requestSpec,
this.responseSpec, recurringDepositAccountId);
DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern(".");
Float expectedPrematureAmount = Float.valueOf(decimalFormat.format(principal));
Float maturityAmount = Float.valueOf(decimalFormat.format(recurringDepositAccountData.get("maturityAmount")));
Double expectedPrematureAmount = Math.floor(principal);
Double maturityAmount = Math.floor((Float) recurringDepositAccountData.get("maturityAmount"));
Assert.assertEquals("Verifying Maturity amount", expectedPrematureAmount, maturityAmount);
@@ -2686,10 +2661,9 @@ public class RecurringDepositTest {
recurringDepositAccountData = this.recurringDepositAccountHelper.getRecurringDepositAccountById(this.requestSpec,
this.responseSpec, recurringDepositAccountId);
DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern(".");
Float expectedPrematureAmount = Float.valueOf(decimalFormat.format(principal));
Float maturityAmount = Float.valueOf(decimalFormat.format(recurringDepositAccountData.get("maturityAmount")));
Double expectedPrematureAmount = Math.floor(principal);
Double maturityAmount = Math.floor((Float) recurringDepositAccountData.get("maturityAmount"));
Assert.assertEquals("Verifying Maturity amount", expectedPrematureAmount, maturityAmount);
@@ -2777,10 +2751,9 @@ public class RecurringDepositTest {
recurringDepositAccountData = this.recurringDepositAccountHelper.getRecurringDepositAccountById(this.requestSpec,
this.responseSpec, recurringDepositAccountId);
DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern(".");
Float expectedPrematureAmount = Float.valueOf(decimalFormat.format(principal));
Float maturityAmount = Float.valueOf(decimalFormat.format(recurringDepositAccountData.get("maturityAmount")));
Double expectedPrematureAmount = Math.floor(principal);
Double maturityAmount = Math.floor((Float) recurringDepositAccountData.get("maturityAmount"));
Assert.assertEquals("Verifying Pre-Closure maturity amount", expectedPrematureAmount, maturityAmount);
@@ -2868,10 +2841,9 @@ public class RecurringDepositTest {
recurringDepositAccountData = this.recurringDepositAccountHelper.getRecurringDepositAccountById(this.requestSpec,
this.responseSpec, recurringDepositAccountId);
DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern(".");
Float expectedPrematureAmount = Float.valueOf(decimalFormat.format(principal));
Float maturityAmount = Float.valueOf(decimalFormat.format(recurringDepositAccountData.get("maturityAmount")));
Double expectedPrematureAmount = Math.floor(principal);
Double maturityAmount = Math.floor((Float) recurringDepositAccountData.get("maturityAmount"));
Assert.assertEquals("Verifying Pre-Closure maturity amount", expectedPrematureAmount, maturityAmount);
@@ -116,7 +116,7 @@ public class SchedulerJobsTestResults {
@Ignore // TODO FINERACT-924
public void testApplyAnnualFeeForSavingsJobOutcome() throws InterruptedException {
this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec);
this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec, this.responseSpec);
this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec);
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
Assert.assertNotNull(clientID);
@@ -171,7 +171,7 @@ public class SchedulerJobsTestResults {
@Ignore
public void testInterestPostingForSavingsJobOutcome() throws InterruptedException {
this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec);
this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec, this.responseSpec);
this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec);
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
Assert.assertNotNull(clientID);
@@ -210,7 +210,7 @@ public class SchedulerJobsTestResults {
@Ignore // TODO FINERACT-857
public void testTransferFeeForLoansFromSavingsJobOutcome() throws InterruptedException {
this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec);
this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec, this.responseSpec);
this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec);
this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec);
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
@@ -283,7 +283,7 @@ public class SchedulerJobsTestResults {
@Test
@Ignore // TODO FINERACT-923
public void testApplyHolidaysToLoansJobOutcome() throws InterruptedException {
this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec, this.responseSpec);
this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec);
this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec);
this.holidayHelper = new HolidayHelper(this.requestSpec, this.responseSpec);
this.globalConfigurationHelper = new GlobalConfigurationHelper(this.requestSpec, this.responseSpec);
@@ -364,7 +364,7 @@ public class SchedulerJobsTestResults {
@Ignore // TODO FINERACT-857
public void testApplyDueFeeChargesForSavingsJobOutcome() throws InterruptedException {
this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec);
this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec, this.responseSpec);
this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec);
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
Assert.assertNotNull(clientID);
@@ -417,7 +417,7 @@ public class SchedulerJobsTestResults {
@Ignore // TODO FINERACT-857
public void testUpdateAccountingRunningBalancesJobOutcome() throws InterruptedException {
this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec);
this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec, this.responseSpec);
this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec);
final Account assetAccount = this.accountHelper.createAssetAccount();
final Account incomeAccount = this.accountHelper.createIncomeAccount();
@@ -471,7 +471,7 @@ public class SchedulerJobsTestResults {
@Test
@Ignore // TODO FINERACT-857
public void testUpdateLoanArrearsAgingJobOutcome() throws InterruptedException {
this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec, this.responseSpec);
this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec);
this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec);
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
@@ -512,7 +512,7 @@ public class SchedulerJobsTestResults {
@Test
@Ignore // TODO FINERACT-857
public void testUpdateLoanPaidInAdvanceJobOutcome() throws InterruptedException {
this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec, this.responseSpec);
this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec);
this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec);
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
@@ -580,7 +580,7 @@ public class SchedulerJobsTestResults {
@Ignore
@Test
public void testUpdateLoanSummaryJobOutcome() throws InterruptedException {
this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec, this.responseSpec);
this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec);
this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec);
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
@@ -641,7 +641,7 @@ public class SchedulerJobsTestResults {
@Test
@Ignore // TODO FINERACT-857
public void testExecuteStandingInstructionsJobOutcome() throws InterruptedException {
this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec, this.responseSpec);
this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec);
this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec);
this.standingInstructionsHelper = new StandingInstructionsHelper(this.requestSpec, this.responseSpec);
@@ -738,7 +738,7 @@ public class SchedulerJobsTestResults {
@Ignore
public void testApplyPenaltyForOverdueLoansJobOutcome() throws InterruptedException {
this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec);
this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec, this.responseSpec);
this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec);
this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec);
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
@@ -794,7 +794,7 @@ public class SchedulerJobsTestResults {
@Ignore // TODO FINERACT-857
public void testAvoidUnncessaryPenaltyWhenAmountZeroForOverdueLoansJobOutcome() throws InterruptedException {
this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec);
this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec, this.responseSpec);
this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec);
this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec);
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
@@ -863,7 +863,7 @@ public class SchedulerJobsTestResults {
@Test
@Ignore // TODO FINERACT-857
public void testUpdateOverdueDaysForNPA() throws InterruptedException {
this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec, this.responseSpec);
this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec);
this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec);
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
@@ -902,7 +902,7 @@ public class SchedulerJobsTestResults {
@Ignore // TODO FINERACT-857
public void testInterestTransferForSavings() throws InterruptedException {
this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec);
this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec, this.responseSpec);
this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec);
// FixedDepositProductHelper fixedDepositProductHelper = new
// FixedDepositProductHelper(this.requestSpec,this.responseSpec);
// AccountHelper accountHelper = new AccountHelper(this.requestSpec,
@@ -56,10 +56,10 @@ public class SchedulerJobHelper {
this.response202Spec = new ResponseSpecBuilder().expectStatusCode(202).build();
}
public SchedulerJobHelper(final RequestSpecification requestSpec, final ResponseSpecification responseSpec) {
public SchedulerJobHelper(final RequestSpecification requestSpec, final ResponseSpecification responseSpec200, final ResponseSpecification responseSpec202) {
this.requestSpec = requestSpec;
this.response200Spec = responseSpec;
this.response202Spec = responseSpec;
this.response200Spec = responseSpec200;
this.response202Spec = responseSpec202;
}
private List<Map<String, Object>> getAllSchedulerJobs() {