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));
}
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));
}
Aggregations