From c9eb3920d9b2f1e781aa6fa49c1c8ef2b4ae74a8 Mon Sep 17 00:00:00 2001 From: Vishwas Babu A J Date: Sun, 6 Oct 2013 00:46:38 +0530 Subject: [PATCH] fixing failing unit tests after accounting changes --- .../AccountingScenarioIntegrationTest.java | 3 ++- .../integrationtests/common/accounting/AccountHelper.java | 7 +++++++ .../common/loans/LoanProductTestBuilder.java | 8 ++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/AccountingScenarioIntegrationTest.java b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/AccountingScenarioIntegrationTest.java index 7792f3bb3..7c979b510 100644 --- a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/AccountingScenarioIntegrationTest.java +++ b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/AccountingScenarioIntegrationTest.java @@ -63,8 +63,9 @@ public class AccountingScenarioIntegrationTest { final Account assetAccount = this.accountHelper.createAssetAccount(); final Account incomeAccount = this.accountHelper.createIncomeAccount(); final Account expenseAccount = this.accountHelper.createExpenseAccount(); + final Account overpaymentAccount = this.accountHelper.createLiabilityAccount(); - final Integer loanProductID = createLoanProduct(assetAccount, incomeAccount, expenseAccount); + final Integer loanProductID = createLoanProduct(assetAccount, incomeAccount, expenseAccount, overpaymentAccount); final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec, this.DATE_OF_JOINING); final Integer loanID = applyForLoanApplication(clientID, loanProductID); diff --git a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/accounting/AccountHelper.java b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/accounting/AccountHelper.java index f356aac50..2b97d22d7 100644 --- a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/accounting/AccountHelper.java +++ b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/accounting/AccountHelper.java @@ -39,4 +39,11 @@ public class AccountHelper { return new Account(accountID, Account.AccountType.EXPENSE); } + public Account createLiabilityAccount() { + final String assetAccountJSON = new GLAccountBuilder().withAccountTypeAsLiability().build(); + final Integer accountID = Utils.performServerPost(this.requestSpec, this.responseSpec, this.CREATE_GL_ACCOUNT_URL, + assetAccountJSON, this.GL_ACCOUNT_ID_RESPONSE); + return new Account(accountID, Account.AccountType.LIABILITY); + } + } 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 11520b81b..48ea45fd1 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 @@ -209,6 +209,10 @@ public class LoanProductTestBuilder { final String ID = this.accountList[i].getAccountID().toString(); map.put("writeOffAccountId", ID); } + if (this.accountList[i].getAccountType().equals(Account.AccountType.LIABILITY)) { + final String ID = this.accountList[i].getAccountID().toString(); + map.put("overpaymentLiabilityAccountId", ID); + } } return map; } @@ -236,6 +240,10 @@ public class LoanProductTestBuilder { final String ID = this.accountList[i].getAccountID().toString(); map.put("writeOffAccountId", ID); } + if (this.accountList[i].getAccountType().equals(Account.AccountType.LIABILITY)) { + final String ID = this.accountList[i].getAccountID().toString(); + map.put("overpaymentLiabilityAccountId", ID); + } } return map;