From 1f07da18d4c351e47c5553b3fd883d4da14e87fb Mon Sep 17 00:00:00 2001 From: Pramod Nuthakki Date: Tue, 17 Jun 2014 23:27:37 +0530 Subject: [PATCH] added junit test cases --- .../ClientLoanIntegrationTest.java | 208 ++++++++++++++++-- .../loans/LoanApplicationTestBuilder.java | 10 + .../common/loans/LoanProductTestBuilder.java | 15 +- 3 files changed, 213 insertions(+), 20 deletions(-) diff --git a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/ClientLoanIntegrationTest.java b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/ClientLoanIntegrationTest.java index e01675997..bf3993334 100644 --- a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/ClientLoanIntegrationTest.java +++ b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/ClientLoanIntegrationTest.java @@ -781,6 +781,10 @@ public class ClientLoanIntegrationTest { Assert.assertTrue(new Float(val).compareTo(new Float(val2)) == 0); } + public void validateNumberForEqualWithMsg(String msg, String val, String val2) { + Assert.assertTrue(msg, new Float(val).compareTo(new Float(val2)) == 0); + } + public void validateNumberForEqualExcludePrecission(String val, String val2) { DecimalFormat twoDForm = new DecimalFormat("#"); Assert.assertTrue(new Float(twoDForm.format(new Float(val))).compareTo(new Float(twoDForm.format(new Float(val2)))) == 0); @@ -802,6 +806,40 @@ public class ClientLoanIntegrationTest { return this.loanTransactionHelper.getLoanProductId(loanProductJSON); } + private Integer createLoanProduct(final String inMultiplesOf, final String digitsAfterDecimal) { + System.out.println("------------------------------CREATING NEW LOAN PRODUCT ---------------------------------------"); + final String loanProductJSON = new LoanProductTestBuilder() // + .withPrincipal("10000000.00") // + .withNumberOfRepayments("24") // + .withRepaymentAfterEvery("1") // + .withRepaymentTypeAsMonth() // + .withinterestRatePerPeriod("2") // + .withInterestRateFrequencyTypeAsMonths() // + .withAmortizationTypeAsEqualPrincipalPayment() // + .withInterestTypeAsDecliningBalance() // + .currencyDetails(digitsAfterDecimal, inMultiplesOf).build(null); + return this.loanTransactionHelper.getLoanProductId(loanProductJSON); + } + + private Integer applyForLoanApplication(final Integer clientID, final Integer loanProductID, String graceOnPrincipalPayment) { + System.out.println("--------------------------------APPLYING FOR LOAN APPLICATION--------------------------------"); + final String loanApplicationJSON = new LoanApplicationTestBuilder() // + .withPrincipal("10000000.00") // + .withLoanTermFrequency("24") // + .withLoanTermFrequencyAsMonths() // + .withNumberOfRepayments("24") // + .withRepaymentEveryAfter("1") // + .withRepaymentFrequencyTypeAsMonths() // + .withInterestRatePerPeriod("2") // + .withAmortizationTypeAsEqualPrincipalPayments() // + .withInterestTypeAsDecliningBalance() // + .withInterestCalculationPeriodTypeSameAsRepaymentPeriod() // + .withPrincipalGrace(graceOnPrincipalPayment).withExpectedDisbursementDate("2 June 2014") // + .withSubmittedOnDate("2 June 2014") // + .build(clientID.toString(), loanProductID.toString(), null); + return this.loanTransactionHelper.getLoanId(loanApplicationJSON); + } + private Integer applyForLoanApplication(final Integer clientID, final Integer loanProductID, List charges, final String savingsId, String principal) { System.out.println("--------------------------------APPLYING FOR LOAN APPLICATION--------------------------------"); @@ -887,6 +925,113 @@ public class ClientLoanIntegrationTest { assertEquals("Checking for Interest Due for 4th Month", new Float("61.79"), loanSchedule.get(4).get("interestOriginalDue")); } + private void verifyLoanRepaymentScheduleForEqualPrincipal(final ArrayList loanSchedule) { + System.out.println("--------------------VERIFYING THE PRINCIPAL DUES,INTEREST DUE AND DUE DATE--------------------------"); + + assertEquals("Checking for Due Date for 1st Month", new ArrayList(Arrays.asList(2014, 7, 2)), + loanSchedule.get(1).get("dueDate")); + assertEquals("Checking for Principal Due for 1st Month", new Float("416700"), loanSchedule.get(1).get("principalOriginalDue")); + assertEquals("Checking for Interest Due for 1st Month", new Float("200000"), loanSchedule.get(1).get("interestOriginalDue")); + + assertEquals("Checking for Due Date for 2nd Month", new ArrayList(Arrays.asList(2014, 8, 2)), + loanSchedule.get(2).get("dueDate")); + assertEquals("Checking for Principal Due for 2nd Month", new Float("416700"), loanSchedule.get(2).get("principalDue")); + assertEquals("Checking for Interest Due for 2nd Month", new Float("191700"), loanSchedule.get(2).get("interestOriginalDue")); + + assertEquals("Checking for Due Date for 3rd Month", new ArrayList(Arrays.asList(2014, 9, 2)), + loanSchedule.get(3).get("dueDate")); + assertEquals("Checking for Principal Due for 3rd Month", new Float("416700"), loanSchedule.get(3).get("principalDue")); + assertEquals("Checking for Interest Due for 3rd Month", new Float("183300"), loanSchedule.get(3).get("interestOriginalDue")); + + assertEquals("Checking for Due Date for 4th Month", new ArrayList(Arrays.asList(2014, 10, 2)), + loanSchedule.get(4).get("dueDate")); + assertEquals("Checking for Principal Due for 4th Month", new Float("416700"), loanSchedule.get(4).get("principalDue")); + assertEquals("Checking for Interest Due for 4th Month", new Float("175000"), loanSchedule.get(4).get("interestOriginalDue")); + + assertEquals("Checking for Due Date for 5th Month", new ArrayList(Arrays.asList(2014, 11, 2)), + loanSchedule.get(5).get("dueDate")); + assertEquals("Checking for Principal Due for 5th Month", new Float("416700"), loanSchedule.get(5).get("principalDue")); + assertEquals("Checking for Interest Due for 5th Month", new Float("166700"), loanSchedule.get(5).get("interestOriginalDue")); + + assertEquals("Checking for Due Date for 6th Month", new ArrayList(Arrays.asList(2014, 12, 2)), + loanSchedule.get(6).get("dueDate")); + assertEquals("Checking for Principal Due for 6th Month", new Float("416700"), loanSchedule.get(6).get("principalDue")); + assertEquals("Checking for Interest Due for 6th Month", new Float("158300"), loanSchedule.get(6).get("interestOriginalDue")); + + assertEquals("Checking for Due Date for 10th Month", new ArrayList(Arrays.asList(2015, 4, 2)), + loanSchedule.get(10).get("dueDate")); + assertEquals("Checking for Principal Due for 10th Month", new Float("416700"), loanSchedule.get(10).get("principalDue")); + assertEquals("Checking for Interest Due for 10th Month", new Float("125000"), loanSchedule.get(10).get("interestOriginalDue")); + + assertEquals("Checking for Due Date for 20th Month", new ArrayList(Arrays.asList(2016, 2, 2)), + loanSchedule.get(20).get("dueDate")); + assertEquals("Checking for Principal Due for 20th Month", new Float("416700"), loanSchedule.get(20).get("principalDue")); + assertEquals("Checking for Interest Due for 20th Month", new Float("41700"), loanSchedule.get(20).get("interestOriginalDue")); + + assertEquals("Checking for Due Date for 24th Month", new ArrayList(Arrays.asList(2016, 6, 2)), + loanSchedule.get(24).get("dueDate")); + assertEquals("Checking for Principal Due for 24th Month", new Float("415900"), loanSchedule.get(24).get("principalDue")); + assertEquals("Checking for Interest Due for 24th Month", new Float("8300"), loanSchedule.get(24).get("interestOriginalDue")); + + } + + private void verifyLoanRepaymentScheduleForEqualPrincipalWithGrace(final ArrayList loanSchedule) { + System.out.println("--------------------VERIFYING THE PRINCIPAL DUES,INTEREST DUE AND DUE DATE--------------------------"); + + assertEquals("Checking for Due Date for 1st Month", new ArrayList(Arrays.asList(2014, 7, 2)), + loanSchedule.get(1).get("dueDate")); + validateNumberForEqualWithMsg("Checking for Principal Due for 1st Month", "0.0", + String.valueOf(loanSchedule.get(1).get("principalOriginalDue"))); + assertEquals("Checking for Interest Due for 1st Month", new Float("200000"), loanSchedule.get(1).get("interestOriginalDue")); + + assertEquals("Checking for Due Date for 2nd Month", new ArrayList(Arrays.asList(2014, 8, 2)), + loanSchedule.get(2).get("dueDate")); + validateNumberForEqualWithMsg("Checking for Principal Due for 2nd Month", "0.0", + String.valueOf(loanSchedule.get(2).get("principalOriginalDue"))); + assertEquals("Checking for Interest Due for 2nd Month", new Float("200000"), loanSchedule.get(2).get("interestOriginalDue")); + + assertEquals("Checking for Due Date for 3rd Month", new ArrayList(Arrays.asList(2014, 9, 2)), + loanSchedule.get(3).get("dueDate")); + validateNumberForEqualWithMsg("Checking for Principal Due for 3rd Month", "0.0", String.valueOf(loanSchedule.get(3).get("principalDue"))); + assertEquals("Checking for Interest Due for 3rd Month", new Float("200000"), loanSchedule.get(3).get("interestOriginalDue")); + + assertEquals("Checking for Due Date for 4th Month", new ArrayList(Arrays.asList(2014, 10, 2)), + loanSchedule.get(4).get("dueDate")); + validateNumberForEqualWithMsg("Checking for Principal Due for 4th Month", "0", String.valueOf(loanSchedule.get(4).get("principalDue"))); + assertEquals("Checking for Interest Due for 4th Month", new Float("200000"), loanSchedule.get(4).get("interestOriginalDue")); + + assertEquals("Checking for Due Date for 5th Month", new ArrayList(Arrays.asList(2014, 11, 2)), + loanSchedule.get(5).get("dueDate")); + validateNumberForEqualWithMsg("Checking for Principal Due for 5th Month", "0", String.valueOf(loanSchedule.get(5).get("principalDue"))); + assertEquals("Checking for Interest Due for 5th Month", new Float("200000"), loanSchedule.get(5).get("interestOriginalDue")); + + assertEquals("Checking for Due Date for 6th Month", new ArrayList(Arrays.asList(2014, 12, 2)), + loanSchedule.get(6).get("dueDate")); + assertEquals("Checking for Principal Due for 6th Month", new Float("526300"), loanSchedule.get(6).get("principalDue")); + assertEquals("Checking for Interest Due for 6th Month", new Float("200000"), loanSchedule.get(6).get("interestOriginalDue")); + + assertEquals("Checking for Due Date for 7th Month", new ArrayList(Arrays.asList(2015, 1, 2)), + loanSchedule.get(7).get("dueDate")); + assertEquals("Checking for Principal Due for 7th Month", new Float("526300"), loanSchedule.get(7).get("principalDue")); + assertEquals("Checking for Interest Due for 7th Month", new Float("189500"), loanSchedule.get(7).get("interestOriginalDue")); + + assertEquals("Checking for Due Date for 10th Month", new ArrayList(Arrays.asList(2015, 4, 2)), + loanSchedule.get(10).get("dueDate")); + assertEquals("Checking for Principal Due for 10th Month", new Float("526300"), loanSchedule.get(10).get("principalDue")); + assertEquals("Checking for Interest Due for 10th Month", new Float("157900"), loanSchedule.get(10).get("interestOriginalDue")); + + assertEquals("Checking for Due Date for 20th Month", new ArrayList(Arrays.asList(2016, 2, 2)), + loanSchedule.get(20).get("dueDate")); + assertEquals("Checking for Principal Due for 20th Month", new Float("526300"), loanSchedule.get(20).get("principalDue")); + assertEquals("Checking for Interest Due for 20th Month", new Float("52600"), loanSchedule.get(20).get("interestOriginalDue")); + + assertEquals("Checking for Due Date for 24th Month", new ArrayList(Arrays.asList(2016, 6, 2)), + loanSchedule.get(24).get("dueDate")); + assertEquals("Checking for Principal Due for 24th Month", new Float("526600"), loanSchedule.get(24).get("principalDue")); + assertEquals("Checking for Interest Due for 24th Month", new Float("10500"), loanSchedule.get(24).get("interestOriginalDue")); + + } + private void addCharges(List charges, Integer chargeId, String amount, String duedate) { charges.add(charges(chargeId, amount, duedate)); } @@ -1151,7 +1296,7 @@ public class ClientLoanIntegrationTest { this.journalEntryHelper.checkJournalEntryForIncomeAccount(incomeAccount, "20 January 2012", new JournalEntry( Float.valueOf("50.00"), JournalEntry.TransactionType.CREDIT)); } - + /*** * Test case for checking CashBasedAccounting functionality adding charges * with calculation type percentage of amount @@ -1910,7 +2055,6 @@ public class ClientLoanIntegrationTest { LoanStatusChecker.verifyLoanAccountIsOverPaid(loanStatusHashMap); } - /*** * Test case for checking AccuralUpfrontAccounting functionality adding * charges with calculation type percentage of amount plus interest @@ -1984,19 +2128,19 @@ public class ClientLoanIntegrationTest { this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 September 2011", assetAccountInitialEntry); this.journalEntryHelper.checkJournalEntryForIncomeAccount(incomeAccount, "20 September 2011", new JournalEntry(Float.valueOf("605.94"), JournalEntry.TransactionType.CREDIT), new JournalEntry(Float.valueOf("126.06"), - JournalEntry.TransactionType.CREDIT), new JournalEntry(Float.valueOf("126.04"), - JournalEntry.TransactionType.CREDIT)); - + JournalEntry.TransactionType.CREDIT), + new JournalEntry(Float.valueOf("126.04"), JournalEntry.TransactionType.CREDIT)); + this.loanTransactionHelper.addChargesForLoan( loanID, LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON( String.valueOf(amountPlusInterestPercentageSpecifiedDueDateCharge), "29 September 2011", "1")); - + loanCharges.clear(); loanCharges = this.loanTransactionHelper.getLoanCharges(loanID); validateCharge(amountPlusInterestPercentageDisbursementCharge, loanCharges, "1", "0.0", "126.06", "0.0"); validateCharge(amountPlusInterestPercentageSpecifiedDueDateCharge, loanCharges, "1", "126.06", "0.0", "0.0"); - + this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "29 September 2011", new JournalEntry(Float.valueOf("126.06"), JournalEntry.TransactionType.DEBIT)); this.journalEntryHelper.checkJournalEntryForIncomeAccount(incomeAccount, "29 September 2011", @@ -2025,14 +2169,15 @@ public class ClientLoanIntegrationTest { secondInstallment = loanSchedule.get(2); validateNumberForEqual("157.57", String.valueOf(secondInstallment.get("feeChargesDue"))); System.out.println("----------- Waive installment charge for 2nd installment ---------"); - this.loanTransactionHelper.waiveChargesForLoan(loanID, (Integer) getloanCharge(amountPlusInterestPercentageInstallmentFee, loanCharges).get("id"), + this.loanTransactionHelper.waiveChargesForLoan(loanID, + (Integer) getloanCharge(amountPlusInterestPercentageInstallmentFee, loanCharges).get("id"), LoanTransactionHelper.getWaiveChargeJSON(String.valueOf(2))); loanCharges.clear(); loanCharges = this.loanTransactionHelper.getLoanCharges(loanID); validateCharge(amountPlusInterestPercentageInstallmentFee, loanCharges, "1", "63.02", "31.51", "31.51"); - this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 September 2011", new JournalEntry(Float.valueOf("31.51"), - JournalEntry.TransactionType.CREDIT)); + this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 September 2011", new JournalEntry( + Float.valueOf("31.51"), JournalEntry.TransactionType.CREDIT)); this.journalEntryHelper.checkJournalEntryForExpenseAccount(expenseAccount, "20 September 2011", new JournalEntry(Float.valueOf("31.51"), JournalEntry.TransactionType.DEBIT)); @@ -2119,6 +2264,7 @@ public class ClientLoanIntegrationTest { loanStatusHashMap = (HashMap) this.loanTransactionHelper.getLoanDetail(this.requestSpec, this.responseSpec, loanID, "status"); LoanStatusChecker.verifyLoanAccountIsOverPaid(loanStatusHashMap); } + /*** * Test case for checking AccuralPeriodicAccounting functionality adding * charges with calculation type flat @@ -2220,8 +2366,8 @@ public class ClientLoanIntegrationTest { loanCharges = this.loanTransactionHelper.getLoanCharges(loanID); validateCharge(flatInstallmentFee, loanCharges, "50", "100.00", "50.0", "50.0"); - this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 September 2011", new JournalEntry( - Float.valueOf("50.0"), JournalEntry.TransactionType.CREDIT)); + this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 September 2011", new JournalEntry(Float.valueOf("50.0"), + JournalEntry.TransactionType.CREDIT)); this.journalEntryHelper.checkJournalEntryForExpenseAccount(expenseAccount, "20 September 2011", new JournalEntry(Float.valueOf("50.0"), JournalEntry.TransactionType.DEBIT)); @@ -2316,7 +2462,7 @@ public class ClientLoanIntegrationTest { loanStatusHashMap = (HashMap) this.loanTransactionHelper.getLoanDetail(this.requestSpec, this.responseSpec, loanID, "status"); LoanStatusChecker.verifyLoanAccountIsClosed(loanStatusHashMap); } - + /** * Test case for checking AccuralPeriodicAccounting functionality adding * charges with calculation type percentage of amount @@ -2415,15 +2561,14 @@ public class ClientLoanIntegrationTest { secondInstallment = loanSchedule.get(2); validateNumberForEqual("149.70", String.valueOf(secondInstallment.get("feeChargesDue"))); System.out.println("----------- Waive installment charge for 2nd installment ---------"); - this.loanTransactionHelper.waiveChargesForLoan(loanID, - (Integer) getloanCharge(percentageInstallmentFee, loanCharges).get("id"), + this.loanTransactionHelper.waiveChargesForLoan(loanID, (Integer) getloanCharge(percentageInstallmentFee, loanCharges).get("id"), LoanTransactionHelper.getWaiveChargeJSON(String.valueOf(2))); loanCharges.clear(); loanCharges = this.loanTransactionHelper.getLoanCharges(loanID); validateCharge(percentageInstallmentFee, loanCharges, "1", "61.19", "29.11", "29.70"); - this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 September 2011", new JournalEntry( - Float.valueOf("29.7"), JournalEntry.TransactionType.CREDIT)); + this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 September 2011", new JournalEntry(Float.valueOf("29.7"), + JournalEntry.TransactionType.CREDIT)); this.journalEntryHelper.checkJournalEntryForExpenseAccount(expenseAccount, "20 September 2011", new JournalEntry(Float.valueOf("29.7"), JournalEntry.TransactionType.DEBIT)); @@ -2518,6 +2663,7 @@ public class ClientLoanIntegrationTest { loanStatusHashMap = (HashMap) this.loanTransactionHelper.getLoanDetail(this.requestSpec, this.responseSpec, loanID, "status"); LoanStatusChecker.verifyLoanAccountIsClosed(loanStatusHashMap); } + /*** * Test case for checking AccuralPeriodicAccounting functionality adding * charges with calculation type percentage of amount and interest @@ -2727,6 +2873,34 @@ public class ClientLoanIntegrationTest { LoanStatusChecker.verifyLoanAccountIsClosed(loanStatusHashMap); } + @Test + public void testClientLoanScheduleWithCurrencyDetails() { + this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec); + + final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec); + ClientHelper.verifyClientCreatedOnServer(this.requestSpec, this.responseSpec, clientID); + final Integer loanProductID = createLoanProduct("100", "0"); + final Integer loanID = applyForLoanApplication(clientID, loanProductID, null); + final ArrayList loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, + loanID); + verifyLoanRepaymentScheduleForEqualPrincipal(loanSchedule); + + } + + @Test + public void testClientLoanScheduleWithCurrencyDetails_with_grace() { + this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec); + + final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec); + ClientHelper.verifyClientCreatedOnServer(this.requestSpec, this.responseSpec, clientID); + final Integer loanProductID = createLoanProduct("100", "0"); + final Integer loanID = applyForLoanApplication(clientID, loanProductID, "5"); + final ArrayList loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, + loanID); + verifyLoanRepaymentScheduleForEqualPrincipalWithGrace(loanSchedule); + + } + private void checkAccrualTransactions(final ArrayList loanSchedule, final Integer loanID) { for (int i = 1; i < loanSchedule.size(); i++) { diff --git a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/loans/LoanApplicationTestBuilder.java b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/loans/LoanApplicationTestBuilder.java index 3c3a5fe03..a28978356 100644 --- a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/loans/LoanApplicationTestBuilder.java +++ b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/loans/LoanApplicationTestBuilder.java @@ -36,6 +36,7 @@ public class LoanApplicationTestBuilder { private String loanType = "individual"; private String fixedEmiAmount = "10000"; private String maxOutstandingLoanBalance = "36000"; + private String graceOnPrincipalPayment = null; private List disbursementData = null; private List charges = new ArrayList(); @@ -71,6 +72,10 @@ public class LoanApplicationTestBuilder { map.put("linkAccountId", savingsID); } + if (graceOnPrincipalPayment != null) { + map.put("graceOnPrincipalPayment", graceOnPrincipalPayment); + } + if (disbursementData != null) { map.put("disbursementData", disbursementData); map.put("fixedEmiAmount", fixedEmiAmount); @@ -191,6 +196,11 @@ public class LoanApplicationTestBuilder { return this; } + public LoanApplicationTestBuilder withPrincipalGrace(final String graceOnPrincipalPayment) { + this.graceOnPrincipalPayment = graceOnPrincipalPayment; + return this; + } + public LoanApplicationTestBuilder withTranches(final List disbursementData) { this.disbursementData = disbursementData; return this; diff --git a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/loans/LoanProductTestBuilder.java b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/loans/LoanProductTestBuilder.java index eb5ae8eb2..f068f8abb 100644 --- a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/loans/LoanProductTestBuilder.java +++ b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/loans/LoanProductTestBuilder.java @@ -13,7 +13,6 @@ import com.google.gson.Gson; public class LoanProductTestBuilder { private static final String LOCALE = "en_GB"; - private static final String DIGITS_AFTER_DECIMAL = "2"; private static final String USD = "USD"; private static final String DAYS = "0"; private static final String WEEK = "1"; @@ -33,6 +32,9 @@ public class LoanProductTestBuilder { private static final String ACCRUAL_PERIODIC = "3"; private static final String ACCRUAL_UPFRONT = "4"; + private String digitsAfterDecimal = "2"; + private String inMultiplesOf = "0"; + private String nameOfLoanProduct = Utils.randomNameGenerator("LOAN_PRODUCT_", 6); private String shortName = Utils.randomNameGenerator("", 4); private String principal = "10000.00"; @@ -50,7 +52,7 @@ public class LoanProductTestBuilder { private final String currencyCode = USD; private String amortizationType = EQUAL_INSTALLMENTS; private String minPrincipal = "1000.00"; - private String maxPrincipal = "100000.00"; + private String maxPrincipal = "10000000.00"; private Account[] accountList = null; private Boolean multiDisburseLoan = false; @@ -71,7 +73,8 @@ public class LoanProductTestBuilder { map.put("shortName", this.shortName); map.put("currencyCode", this.currencyCode); map.put("locale", LOCALE); - map.put("digitsAfterDecimal", DIGITS_AFTER_DECIMAL); + map.put("digitsAfterDecimal", digitsAfterDecimal); + map.put("inMultiplesOf", inMultiplesOf); map.put("principal", this.principal); map.put("numberOfRepayments", this.numberOfRepayments); map.put("repaymentEvery", this.repaymentPeriod); @@ -296,4 +299,10 @@ public class LoanProductTestBuilder { return this; } + public LoanProductTestBuilder currencyDetails(final String digitsAfterDecimal, final String inMultiplesOf) { + this.digitsAfterDecimal = digitsAfterDecimal; + this.inMultiplesOf = inMultiplesOf; + return this; + } + }