use of org.mifos.domain.builders.ClientBuilder in project head by mifos.
the class EditStatusActionStrutsTest method createCenterGroupClientHierarchy.
private void createCenterGroupClientHierarchy() throws CustomerException {
meeting = new MeetingBuilder().customerMeeting().weekly().every(1).startingToday().build();
IntegrationTestObjectMother.saveMeeting(meeting);
center = new CenterBuilder().withName("Savings Center").with(meeting).with(sampleBranchOffice()).withLoanOfficer(testUser()).withActivationDate(mondayTwoWeeksAgo()).build();
IntegrationTestObjectMother.createCenter(center, meeting);
group = new GroupBuilder().withName("Group").withMeeting(meeting).withOffice(sampleBranchOffice()).withLoanOfficer(testUser()).withParentCustomer(center).build();
IntegrationTestObjectMother.createGroup(group, meeting);
client = new ClientBuilder().withName("Client 1").active().withMeeting(meeting).withOffice(sampleBranchOffice()).withLoanOfficer(testUser()).withParentCustomer(group).buildForIntegrationTests();
IntegrationTestObjectMother.createClient(client, meeting);
}
use of org.mifos.domain.builders.ClientBuilder in project head by mifos.
the class SavingsDaoHibernateIntegrationTest method setUp.
@Before
public void setUp() throws Exception {
enableCustomWorkingDays();
weeklyMeeting = new MeetingBuilder().customerMeeting().weekly().every(1).startingToday().build();
IntegrationTestObjectMother.saveMeeting(weeklyMeeting);
weeklyPeriodicFeeForCenterOnly = new FeeBuilder().appliesToCenterOnly().withFeeAmount("100.0").withName("Center Weekly Periodic Fee").withSameRecurrenceAs(weeklyMeeting).with(sampleBranchOffice()).build();
IntegrationTestObjectMother.saveFee(weeklyPeriodicFeeForCenterOnly);
center = new CenterBuilder().with(weeklyMeeting).withName("Center").with(sampleBranchOffice()).withLoanOfficer(testUser()).build();
IntegrationTestObjectMother.createCenter((CenterBO) center, weeklyMeeting);
weeklyPeriodicFeeForGroupOnly = new FeeBuilder().appliesToGroupsOnly().withFeeAmount("50.0").withName("Group Weekly Periodic Fee").withSameRecurrenceAs(weeklyMeeting).with(sampleBranchOffice()).build();
IntegrationTestObjectMother.saveFee(weeklyPeriodicFeeForGroupOnly);
group = new GroupBuilder().withMeeting(weeklyMeeting).withName("Group").withOffice(sampleBranchOffice()).withLoanOfficer(testUser()).withFee(weeklyPeriodicFeeForGroupOnly).withParentCustomer(center).build();
IntegrationTestObjectMother.createGroup(group, weeklyMeeting);
weeklyPeriodicFeeForClientsOnly = new FeeBuilder().appliesToClientsOnly().withFeeAmount("10.0").withName("Client Weekly Periodic Fee").withSameRecurrenceAs(weeklyMeeting).with(sampleBranchOffice()).build();
IntegrationTestObjectMother.saveFee(weeklyPeriodicFeeForClientsOnly);
client = new ClientBuilder().withMeeting(weeklyMeeting).withName("Client 1").withOffice(sampleBranchOffice()).withLoanOfficer(testUser()).withParentCustomer(group).buildForIntegrationTests();
IntegrationTestObjectMother.createClient(client, weeklyMeeting);
customerHierarchyParams = new CustomerHierarchyParams(center.getCustomerId(), center.getOffice().getOfficeId(), center.getSearchId() + ".%", new LocalDate());
baseDao = new GenericDaoHibernate();
savingsDao = new SavingsDaoHibernate(baseDao);
}
use of org.mifos.domain.builders.ClientBuilder in project head by mifos.
the class SavingsPostInterestTest method setupForEachTest.
@Before
public void setupForEachTest() {
client = new ClientBuilder().active().buildForUnitTests();
MeetingBO interestPostingMeeting = new MeetingBuilder().savingsInterestPostingSchedule().monthly().every(1).build();
savingsProduct = new SavingsProductBuilder().mandatory().withMandatoryAmount("33.0").appliesToClientsOnly().withInterestPostingSchedule(interestPostingMeeting).buildForUnitTests();
}
use of org.mifos.domain.builders.ClientBuilder in project head by mifos.
the class SavingsCloseTest method whenClosingAccountShouldWithdrawRemainingBalanceOnAccount.
@Test
public void whenClosingAccountShouldWithdrawRemainingBalanceOnAccount() {
Money remainingBalance = TestUtils.createMoney("100");
savingsAccount = new SavingsAccountBuilder().active().withSavingsProduct(savingsProduct).withCustomer(client).withBalanceOf(remainingBalance).build();
AccountPaymentEntity payment = new AccountPaymentEntityBuilder().with(savingsAccount).with(remainingBalance).build();
AccountNotesEntity notes = new AccountNotesEntityBuilder().build();
CustomerBO customer = new ClientBuilder().buildForUnitTests();
PersonnelBO loggedInUser = new PersonnelBuilder().build();
// pre verification
assertTrue(savingsAccount.getAccountPayments().isEmpty());
// exercise test
savingsAccount.closeAccount(payment, notes, customer, loggedInUser);
// verification
assertFalse(savingsAccount.getAccountPayments().isEmpty());
AccountPaymentEntity withdrawalPayment = savingsAccount.getAccountPayments().get(0);
assertThat(withdrawalPayment.getAmount(), is(TestUtils.createMoney("100")));
}
use of org.mifos.domain.builders.ClientBuilder in project head by mifos.
the class SavingsCloseTest method whenClosingAccountShouldSetClosedDate.
@Test
public void whenClosingAccountShouldSetClosedDate() {
Money remainingBalance = TestUtils.createMoney("100");
savingsAccount = new SavingsAccountBuilder().active().withSavingsProduct(savingsProduct).withCustomer(client).withBalanceOf(remainingBalance).build();
AccountPaymentEntity payment = new AccountPaymentEntityBuilder().with(savingsAccount).with(remainingBalance).build();
AccountNotesEntity notes = new AccountNotesEntityBuilder().build();
CustomerBO customer = new ClientBuilder().buildForUnitTests();
PersonnelBO loggedInUser = new PersonnelBuilder().build();
// exercise test
savingsAccount.closeAccount(payment, notes, customer, loggedInUser);
// verification
assertThat(new LocalDate(savingsAccount.getClosedDate()), is(new LocalDate()));
}
Aggregations