MIFOSX-865 update test case to use UPFRONT_ACCRUALS

This commit is contained in:
Vishwas Babu A J
2014-04-13 10:59:01 -07:00
parent b30aa2839e
commit e82bffa944
2 changed files with 16 additions and 7 deletions
@@ -86,7 +86,8 @@ public class AccountingScenarioIntegrationTest {
final Account expenseAccount = this.accountHelper.createExpenseAccount();
final Account overpaymentAccount = this.accountHelper.createLiabilityAccount();
final Integer loanProductID = createLoanProduct(assetAccount, incomeAccount, expenseAccount, overpaymentAccount);
final Integer loanProductID = createLoanProductWithUpfrontAccrualAccountingEnabled(assetAccount, incomeAccount, expenseAccount,
overpaymentAccount);
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec, this.DATE_OF_JOINING);
final Integer loanID = applyForLoanApplication(clientID, loanProductID);
@@ -181,12 +182,13 @@ public class AccountingScenarioIntegrationTest {
System.out.println("Repayment 5 Done ......");
}
private Integer createLoanProduct(final Account... accounts) {
private Integer createLoanProductWithUpfrontAccrualAccountingEnabled(final Account... accounts) {
System.out.println("------------------------------CREATING NEW LOAN PRODUCT ---------------------------------------");
final String loanProductJSON = new LoanProductTestBuilder().withPrincipal(this.LP_PRINCIPAL.toString()).withRepaymentTypeAsMonth()
.withRepaymentAfterEvery(this.LP_REPAYMENT_PERIOD).withNumberOfRepayments(this.LP_REPAYMENTS).withRepaymentTypeAsMonth()
.withinterestRatePerPeriod(this.LP_INTEREST_RATE).withInterestRateFrequencyTypeAsMonths()
.withAmortizationTypeAsEqualPrincipalPayment().withInterestTypeAsFlat().withAccountingRuleAsAccrualBased(accounts).build(null);
.withAmortizationTypeAsEqualPrincipalPayment().withInterestTypeAsFlat().withAccountingRuleUpfrontAccrual(accounts)
.build(null);
return this.loanTransactionHelper.getLoanProductId(loanProductJSON);
}
@@ -30,7 +30,8 @@ public class LoanProductTestBuilder {
// private static final String RBI_INDIA_STRATEGY ="4";
private static final String NONE = "1";
private static final String CASH_BASED = "2";
private static final String ACCRUAL_BASED = "3";
private static final String ACCRUAL_PERIODIC = "3";
private static final String ACCRUAL_UPFRONT = "4";
private String nameOfLoanProduct = Utils.randomNameGenerator("LOAN_PRODUCT_", 6);
private String shortName = Utils.randomNameGenerator("", 4);
@@ -81,7 +82,7 @@ public class LoanProductTestBuilder {
map.put("minPrincipal", this.minPrincipal);
map.put("maxPrincipal", this.maxPrincipal);
if (this.accountingRule.equals(ACCRUAL_BASED)) {
if (this.accountingRule.equals(ACCRUAL_UPFRONT) || this.accountingRule.equals(ACCRUAL_PERIODIC)) {
map.putAll(getAccountMappingForAccrualBased());
} else if (this.accountingRule.equals(CASH_BASED)) {
map.putAll(getAccountMappingForCashBased());
@@ -195,8 +196,14 @@ public class LoanProductTestBuilder {
return this;
}
public LoanProductTestBuilder withAccountingRuleAsAccrualBased(final Account[] account_list) {
this.accountingRule = ACCRUAL_BASED;
public LoanProductTestBuilder withAccountingRuleUpfrontAccrual(final Account[] account_list) {
this.accountingRule = ACCRUAL_UPFRONT;
this.accountList = account_list;
return this;
}
public LoanProductTestBuilder withAccountingRulePeriodicAccrual(final Account[] account_list) {
this.accountingRule = ACCRUAL_PERIODIC;
this.accountList = account_list;
return this;
}