use of org.mifos.accounts.loan.business.LoanBO in project head by mifos.
the class LegacyLoanDaoIntegrationTest method testFindBySystemId.
@Test
public void testFindBySystemId() throws Exception {
LegacyLoanDao loanPersistance = legacyLoanDao;
LoanBO loanBO = loanPersistance.findBySystemId(loanAccount.getGlobalAccountNum());
Assert.assertEquals(loanAccount.getGlobalAccountNum(), loanBO.getGlobalAccountNum());
Assert.assertEquals(loanAccount.getAccountId(), loanBO.getAccountId());
}
use of org.mifos.accounts.loan.business.LoanBO in project head by mifos.
the class LegacyLoanDaoIntegrationTest method testFindByExternalId.
@Test
public void testFindByExternalId() throws Exception {
String externalId = "ABC";
StaticHibernateUtil.startTransaction();
loanAccount.setExternalId(externalId);
StaticHibernateUtil.flushSession();
LegacyLoanDao loanPersistance = legacyLoanDao;
LoanBO loanBO = loanPersistance.findByExternalId(loanAccount.getExternalId());
Assert.assertEquals(externalId, loanBO.getExternalId());
Assert.assertEquals(loanAccount.getAccountId(), loanBO.getAccountId());
}
use of org.mifos.accounts.loan.business.LoanBO in project head by mifos.
the class LegacyLoanDaoIntegrationTest method testGetAccount.
@Test
public void testGetAccount() throws Exception {
LoanBO loanBO = legacyLoanDao.getAccount(loanAccount.getAccountId());
Assert.assertEquals(loanBO.getAccountId(), loanAccount.getAccountId());
}
use of org.mifos.accounts.loan.business.LoanBO in project head by mifos.
the class LoanAccountActionIndividualLoansIntegrationTest method testShouldCallDeleteMethodIfExistingMembersRemoved.
@Test
public void testShouldCallDeleteMethodIfExistingMembersRemoved() throws Exception {
GlimLoanUpdater glimLoanUpdaterMock = createMock(GlimLoanUpdater.class);
LoanAccountAction loanAccountAction = new LoanAccountAction(ApplicationContextProvider.getBean(LoanBusinessService.class), new ConfigurationBusinessService(), glimLoanUpdaterMock);
LoanBO loanMock = createMock(LoanBO.class);
Locale locale = Locale.ENGLISH;
expect(loanMock.getAccountId()).andReturn(2).anyTimes();
ClientBO customerMock = createMock(ClientBO.class);
expect(loanMock.getCustomer()).andReturn(customerMock).anyTimes();
expect(customerMock.getGlobalCustNum()).andReturn("3").anyTimes();
LoanAccountActionForm loanAccountActionForm = new LoanAccountActionForm();
List<LoanAccountDetailsDto> clientDetails = new ArrayList<LoanAccountDetailsDto>();
List<LoanBO> loans = new ArrayList<LoanBO>();
loans.add(loanMock);
glimLoanUpdaterMock.delete(loanMock);
expectLastCall().atLeastOnce();
replay(glimLoanUpdaterMock, loanMock, customerMock);
loanAccountAction.handleIndividualLoans(loanMock, loanAccountActionForm, true, clientDetails, loans, locale);
verify(glimLoanUpdaterMock, loanMock, customerMock);
}
use of org.mifos.accounts.loan.business.LoanBO in project head by mifos.
the class LoanAccountActionIndividualLoansIntegrationTest method testShouldCallUpdateMethodIfExistingMembersChanged.
@Test
public void testShouldCallUpdateMethodIfExistingMembersChanged() throws Exception {
GlimLoanUpdater glimLoanUpdaterMock = createMock(GlimLoanUpdater.class);
LoanAccountAction loanAccountAction = new LoanAccountAction(ApplicationContextProvider.getBean(LoanBusinessService.class), new ConfigurationBusinessService(), glimLoanUpdaterMock);
LoanBO loanMock = createMock(LoanBO.class);
Locale locale = Locale.ENGLISH;
expect(loanMock.getAccountId()).andReturn(2).anyTimes();
ClientBO customerMock = createMock(ClientBO.class);
expect(loanMock.getCustomer()).andReturn(customerMock).anyTimes();
expect(customerMock.getCustomerId()).andReturn(3).anyTimes();
LoanAccountActionForm loanAccountActionForm = new LoanAccountActionForm();
List<LoanAccountDetailsDto> clientDetails = new ArrayList<LoanAccountDetailsDto>();
LoanAccountDetailsDto LOAN_ACCOUNT_DETAILS_WITH_LOAN_AMOUNT_300 = LoanAccountDetailsDto.createInstanceForTest("3", "2", "300.0", "2");
clientDetails.add(LOAN_ACCOUNT_DETAILS_WITH_LOAN_AMOUNT_300);
List<LoanBO> loans = new ArrayList<LoanBO>();
loans.add(loanMock);
glimLoanUpdaterMock.updateIndividualLoan(null, null, null, LOAN_ACCOUNT_DETAILS_WITH_LOAN_AMOUNT_300, loanMock);
expectLastCall().atLeastOnce();
replay(glimLoanUpdaterMock, loanMock, customerMock);
loanAccountAction.handleIndividualLoans(loanMock, loanAccountActionForm, true, clientDetails, loans, locale);
verify(glimLoanUpdaterMock, loanMock, customerMock);
}
Aggregations