Search in sources :

Example 1 with CollectionSheetCustomerSavingsAccountDto

use of org.mifos.application.servicefacade.CollectionSheetCustomerSavingsAccountDto in project head by mifos.

the class CollectionSheetDaoHibernateIntegrationTest method testShouldFindSavingsDepositsforCustomerHierarchy.

@Test
public void testShouldFindSavingsDepositsforCustomerHierarchy() {
    // setup
    savingsProduct = new SavingsProductBuilder().mandatory().appliesToCentersOnly().withShortName("SP1").buildForIntegrationTests();
    savingsAccount = new SavingsAccountBuilder().withSavingsProduct(savingsProduct).withCreatedBy(IntegrationTestObjectMother.testUser()).withCustomer(center).build();
    IntegrationTestObjectMother.saveSavingsProductAndAssociatedSavingsAccounts(savingsProduct, savingsAccount);
    savingsProduct2 = new SavingsProductBuilder().withName("product2").withShortName("SP2").mandatory().appliesToCentersOnly().buildForIntegrationTests();
    savingsAccount2 = new SavingsAccountBuilder().withSavingsProduct(savingsProduct2).withCustomer(center).withCreatedBy(IntegrationTestObjectMother.testUser()).build();
    IntegrationTestObjectMother.saveSavingsProductAndAssociatedSavingsAccounts(savingsProduct2, savingsAccount2);
    final Integer customerAtTopOfHierarchyId = center.getCustomerId();
    final Short branchId = center.getOffice().getOfficeId();
    final String searchId = center.getSearchId() + ".%";
    final LocalDate transactionDate = new LocalDate();
    final CustomerHierarchyParams customerHierarchyParams = new CustomerHierarchyParams(customerAtTopOfHierarchyId, branchId, searchId, transactionDate);
    // exercise test
    final List<CollectionSheetCustomerSavingsAccountDto> allSavingsDeposits = collectionSheetDao.findAllSavingAccountsForCustomerHierarchy(customerHierarchyParams);
    // verification
    Assert.assertThat(allSavingsDeposits.size(), is(2));
}
Also used : SavingsProductBuilder(org.mifos.domain.builders.SavingsProductBuilder) CustomerHierarchyParams(org.mifos.application.servicefacade.CustomerHierarchyParams) CollectionSheetCustomerSavingsAccountDto(org.mifos.application.servicefacade.CollectionSheetCustomerSavingsAccountDto) SavingsAccountBuilder(org.mifos.domain.builders.SavingsAccountBuilder) LocalDate(org.joda.time.LocalDate) Test(org.junit.Test)

Aggregations

LocalDate (org.joda.time.LocalDate)1 Test (org.junit.Test)1 CollectionSheetCustomerSavingsAccountDto (org.mifos.application.servicefacade.CollectionSheetCustomerSavingsAccountDto)1 CustomerHierarchyParams (org.mifos.application.servicefacade.CustomerHierarchyParams)1 SavingsAccountBuilder (org.mifos.domain.builders.SavingsAccountBuilder)1 SavingsProductBuilder (org.mifos.domain.builders.SavingsProductBuilder)1