Search in sources :

Example 51 with LoanBO

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());
}
Also used : LoanBO(org.mifos.accounts.loan.business.LoanBO) LegacyLoanDao(org.mifos.accounts.loan.persistance.LegacyLoanDao) Test(org.junit.Test)

Example 52 with LoanBO

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());
}
Also used : LoanBO(org.mifos.accounts.loan.business.LoanBO) LegacyLoanDao(org.mifos.accounts.loan.persistance.LegacyLoanDao) Test(org.junit.Test)

Example 53 with LoanBO

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());
}
Also used : LoanBO(org.mifos.accounts.loan.business.LoanBO) Test(org.junit.Test)

Example 54 with LoanBO

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);
}
Also used : Locale(java.util.Locale) LoanAccountActionForm(org.mifos.accounts.loan.struts.actionforms.LoanAccountActionForm) LoanBusinessService(org.mifos.accounts.loan.business.service.LoanBusinessService) LoanBO(org.mifos.accounts.loan.business.LoanBO) ClientBO(org.mifos.customers.client.business.ClientBO) ConfigurationBusinessService(org.mifos.config.business.service.ConfigurationBusinessService) ArrayList(java.util.ArrayList) LoanAccountDetailsDto(org.mifos.dto.domain.LoanAccountDetailsDto) Test(org.junit.Test)

Example 55 with LoanBO

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);
}
Also used : Locale(java.util.Locale) LoanAccountActionForm(org.mifos.accounts.loan.struts.actionforms.LoanAccountActionForm) LoanBusinessService(org.mifos.accounts.loan.business.service.LoanBusinessService) LoanBO(org.mifos.accounts.loan.business.LoanBO) ClientBO(org.mifos.customers.client.business.ClientBO) ConfigurationBusinessService(org.mifos.config.business.service.ConfigurationBusinessService) ArrayList(java.util.ArrayList) LoanAccountDetailsDto(org.mifos.dto.domain.LoanAccountDetailsDto) Test(org.junit.Test)

Aggregations

LoanBO (org.mifos.accounts.loan.business.LoanBO)215 ArrayList (java.util.ArrayList)76 Test (org.junit.Test)62 Money (org.mifos.framework.util.helpers.Money)60 UserContext (org.mifos.security.util.UserContext)45 MifosRuntimeException (org.mifos.core.MifosRuntimeException)42 Date (java.util.Date)37 AccountException (org.mifos.accounts.exceptions.AccountException)35 AccountBO (org.mifos.accounts.business.AccountBO)34 MifosUser (org.mifos.security.MifosUser)33 BigDecimal (java.math.BigDecimal)30 HashMap (java.util.HashMap)28 TransactionDemarcate (org.mifos.framework.util.helpers.TransactionDemarcate)26 LocalDate (org.joda.time.LocalDate)23 PaymentData (org.mifos.accounts.util.helpers.PaymentData)22 PersonnelBO (org.mifos.customers.personnel.business.PersonnelBO)22 PersistenceException (org.mifos.framework.exceptions.PersistenceException)21 ServiceException (org.mifos.framework.exceptions.ServiceException)19 BusinessRuleException (org.mifos.service.BusinessRuleException)19 LoanOfferingBO (org.mifos.accounts.productdefinition.business.LoanOfferingBO)18