Search in sources :

Example 31 with SavingsProductBuilder

use of org.mifos.domain.builders.SavingsProductBuilder in project head by mifos.

the class SavingsDaoHibernateIntegrationTest method testShouldFindExistingMandatorySavingsAccountsForClientsWhenCenterIsTopOfCustomerHierarchy.

@Test
public void testShouldFindExistingMandatorySavingsAccountsForClientsWhenCenterIsTopOfCustomerHierarchy() {
    // setup
    savingsProduct = new SavingsProductBuilder().mandatory().appliesToClientsOnly().buildForIntegrationTests();
    savingsAccount = new SavingsAccountBuilder().withSavingsProduct(savingsProduct).withCustomer(client).withCreatedBy(IntegrationTestObjectMother.testUser()).build();
    IntegrationTestObjectMother.saveSavingsProductAndAssociatedSavingsAccounts(savingsProduct, savingsAccount);
    // exercise test
    List<CollectionSheetCustomerSavingDto> mandatorySavingAccounts = savingsDao.findAllMandatorySavingAccountsForClientsOrGroupsWithCompleteGroupStatusForCustomerHierarchy(customerHierarchyParams);
    // verification
    assertThat(mandatorySavingAccounts.size(), is(1));
}
Also used : SavingsProductBuilder(org.mifos.domain.builders.SavingsProductBuilder) SavingsAccountBuilder(org.mifos.domain.builders.SavingsAccountBuilder) CollectionSheetCustomerSavingDto(org.mifos.application.servicefacade.CollectionSheetCustomerSavingDto) Test(org.junit.Test)

Example 32 with SavingsProductBuilder

use of org.mifos.domain.builders.SavingsProductBuilder in project head by mifos.

the class GroupPerformanceHistoryUsingCustomerServiceIntegrationTest method shouldGetTotalSavingsBalance.

@Test
public void shouldGetTotalSavingsBalance() throws Exception {
    // setup
    SavingsOfferingBO groupSavingsProduct = new SavingsProductBuilder().appliesToGroupsOnly().voluntary().withName("groupSavings").withShortName("GSP").buildForIntegrationTests();
    IntegrationTestObjectMother.createProduct(groupSavingsProduct);
    SavingsBO groupSavingsAccount = new SavingsAccountBuilder().withSavingsProduct(groupSavingsProduct).withCustomer(existingActiveClient).withCreatedBy(IntegrationTestObjectMother.testUser()).withSavingsOfficer(existingLoanOfficer).withBalanceOf(new Money(Money.getDefaultCurrency(), "200.0")).build();
    IntegrationTestObjectMother.saveSavingsAccount(groupSavingsAccount);
    SavingsOfferingBO clientSavingsProduct = new SavingsProductBuilder().appliesToClientsOnly().voluntary().withName("clientSavings").withShortName("CSP").buildForIntegrationTests();
    IntegrationTestObjectMother.createProduct(clientSavingsProduct);
    SavingsBO clientSavingsAccount = new SavingsAccountBuilder().withSavingsProduct(clientSavingsProduct).withCustomer(existingActiveClient).withCreatedBy(IntegrationTestObjectMother.testUser()).withSavingsOfficer(existingLoanOfficer).withBalanceOf(new Money(Money.getDefaultCurrency(), "550.0")).build();
    IntegrationTestObjectMother.saveSavingsAccount(clientSavingsAccount);
    existingGroup = customerDao.findGroupBySystemId(existingGroup.getGlobalCustNum());
    // exercise test
    Money savingsAmount = existingGroup.getGroupPerformanceHistory().getTotalSavingsAmount();
    // verification
    assertThat(savingsAmount.getAmountDoubleValue(), is(750.0));
}
Also used : Money(org.mifos.framework.util.helpers.Money) SavingsProductBuilder(org.mifos.domain.builders.SavingsProductBuilder) SavingsOfferingBO(org.mifos.accounts.productdefinition.business.SavingsOfferingBO) SavingsBO(org.mifos.accounts.savings.business.SavingsBO) SavingsAccountBuilder(org.mifos.domain.builders.SavingsAccountBuilder) Test(org.junit.Test)

Aggregations

SavingsProductBuilder (org.mifos.domain.builders.SavingsProductBuilder)32 Test (org.junit.Test)26 SavingsAccountBuilder (org.mifos.domain.builders.SavingsAccountBuilder)19 SavingsOfferingBO (org.mifos.accounts.productdefinition.business.SavingsOfferingBO)14 Money (org.mifos.framework.util.helpers.Money)14 SavingsBO (org.mifos.accounts.savings.business.SavingsBO)9 LocalDate (org.joda.time.LocalDate)6 AccountActionDateEntity (org.mifos.accounts.business.AccountActionDateEntity)6 DateTime (org.joda.time.DateTime)5 Before (org.junit.Before)4 CollectionSheetCustomerSavingDto (org.mifos.application.servicefacade.CollectionSheetCustomerSavingDto)4 ClientBuilder (org.mifos.domain.builders.ClientBuilder)4 Date (java.util.Date)3 Ignore (org.junit.Ignore)3 SavingsScheduleEntity (org.mifos.accounts.savings.business.SavingsScheduleEntity)3 MeetingBuilder (org.mifos.domain.builders.MeetingBuilder)3 SavingsScheduleBuilder (org.mifos.domain.builders.SavingsScheduleBuilder)3 MeetingBO (org.mifos.application.meeting.business.MeetingBO)2 RecommendedAmntUnitEntity (org.mifos.accounts.productdefinition.business.RecommendedAmntUnitEntity)1 Holiday (org.mifos.application.holiday.business.Holiday)1