use of org.mifos.accounts.savings.business.SavingsBO in project head by mifos.
the class SavingsAccountSchedulesIntegrationTest method shouldNotGenerateSavingsAccountSchedulesForCenterWithoutActiveClients.
@Test
public void shouldNotGenerateSavingsAccountSchedulesForCenterWithoutActiveClients() throws Exception {
createCenterAndGroupHierarchyWithNoClients(aWeeklyMeeting);
SavingsOfferingBO savingsProduct = new SavingsProductBuilder().mandatory().withMandatoryAmount("33.0").appliesToCentersOnly().buildForIntegrationTests();
SavingsBO savingsAccount = new SavingsAccountBuilder().active().withActivationDate(mondayTwoWeeksAgo()).withSavingsProduct(savingsProduct).withCustomer(center).withCreatedBy(IntegrationTestObjectMother.testUser()).buildJointSavingsAccount();
IntegrationTestObjectMother.saveSavingsProductAndAssociatedSavingsAccounts(savingsProduct, savingsAccount);
List<AccountActionDateEntity> savingSchedules = savingsAccount.getAccountActionDatesSortedByInstallmentId();
assertTrue(savingSchedules.isEmpty());
}
use of org.mifos.accounts.savings.business.SavingsBO in project head by mifos.
the class SavingsAccountSchedulesIntegrationTest method shouldGenerateSavingsAccountSchedulesForGroupOnlyWhenUsingCompleteGroupSetting.
@Test
public void shouldGenerateSavingsAccountSchedulesForGroupOnlyWhenUsingCompleteGroupSetting() throws Exception {
createCenterGroupClientHierarchy(aWeeklyMeeting);
SavingsOfferingBO savingsProduct = new SavingsProductBuilder().mandatory().withMandatoryAmount("33.0").appliesToGroupsOnly().trackedOnCompleteGroup().buildForIntegrationTests();
SavingsBO savingsAccount = new SavingsAccountBuilder().active().withActivationDate(mondayTwoWeeksAgo()).withSavingsProduct(savingsProduct).withCustomer(group).withCreatedBy(IntegrationTestObjectMother.testUser()).build();
IntegrationTestObjectMother.saveSavingsProductAndAssociatedSavingsAccounts(savingsProduct, savingsAccount);
List<AccountActionDateEntity> savingSchedules = savingsAccount.getAccountActionDatesSortedByInstallmentId();
for (AccountActionDateEntity savingSchedule : savingSchedules) {
assertThat("saving schedule should be generated for group only and not any of its clients", savingSchedule.getCustomer().getCustomerId(), is(group.getCustomerId()));
}
}
use of org.mifos.accounts.savings.business.SavingsBO in project head by mifos.
the class SavingsAccountSchedulesIntegrationTest method shouldGenerateSavingsAccountSchedulesForClient.
@Test
public void shouldGenerateSavingsAccountSchedulesForClient() throws Exception {
createCenterGroupClientHierarchy(aWeeklyMeeting);
SavingsOfferingBO savingsProduct = new SavingsProductBuilder().mandatory().withMandatoryAmount("33.0").appliesToClientsOnly().buildForIntegrationTests();
SavingsBO savingsAccount = new SavingsAccountBuilder().active().withActivationDate(mondayTwoWeeksAgo()).withSavingsProduct(savingsProduct).withCustomer(client).withCreatedBy(IntegrationTestObjectMother.testUser()).build();
IntegrationTestObjectMother.saveSavingsProductAndAssociatedSavingsAccounts(savingsProduct, savingsAccount);
List<AccountActionDateEntity> savingSchedules = savingsAccount.getAccountActionDatesSortedByInstallmentId();
for (AccountActionDateEntity savingSchedule : savingSchedules) {
assertThat("saving schedule should be generated for individual client savings account", savingSchedule.getCustomer().getCustomerId(), is(client.getCustomerId()));
}
}
use of org.mifos.accounts.savings.business.SavingsBO in project head by mifos.
the class SavingsPersistenceIntegrationTest method testFindBySystemId.
@Test
public void testFindBySystemId() throws Exception {
createInitialObjects();
Date currentDate = new Date(System.currentTimeMillis());
savingsOffering = TestObjectFactory.createSavingsProduct("SavingPrd1", "v1ws", currentDate, RecommendedAmountUnit.COMPLETE_GROUP);
savings = createSavingsAccount("kkk", savingsOffering);
SavingsBO savings1 = savingsDao.findBySystemId(savings.getGlobalAccountNum());
Assert.assertEquals(savings.getAccountId(), savings1.getAccountId());
Assert.assertEquals(savingsOffering.getRecommendedAmount(), savings1.getRecommendedAmount());
}
use of org.mifos.accounts.savings.business.SavingsBO in project head by mifos.
the class SavingsPersistenceIntegrationTest method testFindById.
@Test
public void testFindById() throws Exception {
createInitialObjects();
Date currentDate = new Date(System.currentTimeMillis());
savingsOffering = TestObjectFactory.createSavingsProduct("SavingPrd1", "xdsa", currentDate, RecommendedAmountUnit.COMPLETE_GROUP);
savings = createSavingsAccount("FFFF", savingsOffering);
SavingsBO savings1 = savingsDao.findById(savings.getAccountId());
Assert.assertEquals(savingsOffering.getRecommendedAmount(), savings1.getRecommendedAmount());
}
Aggregations