use of org.mifos.test.acceptance.framework.loan.PerformanceHistoryAtributes in project head by mifos.
the class LoanAccountPerformanceHistoryTest method repayMultipleLoansAndVerifyPerformanceHistory.
// http://mifosforge.jira.com/browse/MIFOSTEST-359
@Test(enabled = true)
// one of the dependent methods throws Exception
@SuppressWarnings("PMD.SignatureDeclareThrowsException")
public void repayMultipleLoansAndVerifyPerformanceHistory() throws Exception {
//Given
CreateLoanAccountSearchParameters searchParameters = new CreateLoanAccountSearchParameters();
CreateLoanAccountSubmitParameters submitAccountParameters = new CreateLoanAccountSubmitParameters();
searchParameters.setLoanProduct("WeeklyClientFlatLoanWithNoFee");
searchParameters.setSearchString("WeeklyOld Monday");
submitAccountParameters.setInterestRate("24.0");
submitAccountParameters.setNumberOfInstallments("10");
submitAccountParameters.setLoanPurpose("0008-Animal Trading");
DisburseLoanParameters disburseParameters = new DisburseLoanParameters();
disburseParameters.setDisbursalDateDD("04");
disburseParameters.setDisbursalDateMM("03");
disburseParameters.setDisbursalDateYYYY("2011");
disburseParameters.setPaymentType(PaymentParameters.CASH);
PerformanceHistoryAtributes performanceHistoryAtributes = new PerformanceHistoryAtributes();
performanceHistoryAtributes.setDelinquentPortfolio(0.0);
//When
Map<String, String> loanIds = new HashMap<String, String>();
submitAccountParameters.setAmount("2000.0");
loanIds.put(submitAccountParameters.getAmount(), loanTestHelper.createLoanAccount(searchParameters, submitAccountParameters).getAccountId());
performanceHistoryAtributes.incrementLoanCycle();
performanceHistoryAtributes.incrementLoanCycleForProduct(searchParameters.getLoanProduct());
submitAccountParameters.setAmount("3000.0");
loanIds.put(submitAccountParameters.getAmount(), loanTestHelper.createLoanAccount(searchParameters, submitAccountParameters).getAccountId());
performanceHistoryAtributes.incrementLoanCycle();
performanceHistoryAtributes.incrementLoanCycleForProduct(searchParameters.getLoanProduct());
submitAccountParameters.setAmount("5000.0");
searchParameters.setLoanProduct("AnotherWeeklyClientFlatLoanWithNoFee");
loanIds.put(submitAccountParameters.getAmount(), loanTestHelper.createLoanAccount(searchParameters, submitAccountParameters).getAccountId());
performanceHistoryAtributes.incrementLoanCycle();
performanceHistoryAtributes.incrementLoanCycleForProduct(searchParameters.getLoanProduct());
EditLoanAccountStatusParameters params = new EditLoanAccountStatusParameters();
params.setStatus(EditLoanAccountStatusParameters.APPROVED);
params.setNote("Approved.");
Set<String> amounts = loanIds.keySet();
for (String accountid : loanIds.values()) {
loanTestHelper.changeLoanAccountStatus(accountid, params);
loanTestHelper.disburseLoan(accountid, disburseParameters);
performanceHistoryAtributes.incrementNoOfActiveLoan();
}
//Then
for (String amount : amounts) {
loanTestHelper.repayLoan(loanIds.get(amount));
String lastLoan = amount.substring(0, amount.length() - 2);
lastLoan = lastLoan.substring(0, 1) + "," + lastLoan.substring(1);
performanceHistoryAtributes.setAmountOfLastLoan(lastLoan);
performanceHistoryAtributes.decrementNoOfActiveLoan();
loanTestHelper.verifyPerformenceHistory(searchParameters.getSearchString(), performanceHistoryAtributes);
}
}
Aggregations