use of org.mifos.domain.builders.CenterBuilder in project head by mifos.
the class GroupTransferToCenterServiceTest method validatesReceivingCenterWhenTransferingGroup.
@Test(expected = CustomerException.class)
public void validatesReceivingCenterWhenTransferingGroup() throws Exception {
// setup
CenterBO toCenter = new CenterBuilder().build();
// stubbing
doThrow(new CustomerException(CustomerConstants.INVALID_PARENT)).when(group).validateReceivingCenter(toCenter);
// exercise test
customerService.transferGroupTo(group, toCenter);
// verification
verify(group).validateReceivingCenter(toCenter);
}
use of org.mifos.domain.builders.CenterBuilder in project head by mifos.
the class GroupTransferToCenterServiceTest method validatesNoActiveAccountExistWhenTransferingGroup.
@Test(expected = CustomerException.class)
public void validatesNoActiveAccountExistWhenTransferingGroup() throws Exception {
// setup
CenterBO toCenter = new CenterBuilder().build();
// stubbing
doThrow(new CustomerException(CustomerConstants.ERRORS_HAS_ACTIVE_ACCOUNT)).when(group).validateNoActiveAccountsExist();
// exercise test
customerService.transferGroupTo(group, toCenter);
// verification
verify(group).validateNoActiveAccountsExist();
}
use of org.mifos.domain.builders.CenterBuilder in project head by mifos.
the class CenterValidationTest method cannotCreateCenterWithMultipleInstancesOfSamePeriodFee.
@Test
public void cannotCreateCenterWithMultipleInstancesOfSamePeriodFee() {
// setup
DateTime today = new DateTime();
MeetingBuilder aWeeklyMeeting = new MeetingBuilder().customerMeeting().weekly();
CenterBO center = new CenterBuilder().withName("center1").withLoanOfficer(anyLoanOfficer()).with(aWeeklyMeeting).withMfiJoiningDate(today).build();
MeetingBuilder aWeeklyFeeMeeting = new MeetingBuilder().periodicFeeMeeting().weekly();
AmountFeeBO montlyPeriodicFee = new FeeBuilder().appliesToCenterOnly().with(aWeeklyFeeMeeting).build();
AccountFeesEntity accountFee = new AccountFeesEntity(null, montlyPeriodicFee, montlyPeriodicFee.getFeeAmount().getAmountDoubleValue());
List<AccountFeesEntity> centerAccountFees = new ArrayList<AccountFeesEntity>();
centerAccountFees.add(accountFee);
centerAccountFees.add(accountFee);
// exercise test
try {
center.validateMeetingAndFees(centerAccountFees);
fail("cannotCreateCenterWithFeeThatHasDifferentPeriod");
} catch (ApplicationException e) {
assertThat(e.getKey(), is(CustomerConstants.ERRORS_DUPLICATE_PERIODIC_FEE));
}
}
use of org.mifos.domain.builders.CenterBuilder in project head by mifos.
the class CenterValidationTest method cannotCreateCenterWithoutAMfiJoiningDate.
@Test
public void cannotCreateCenterWithoutAMfiJoiningDate() {
// setup
DateTime noJoiningDate = null;
MeetingBuilder customerMeeting = new MeetingBuilder().customerMeeting();
center = new CenterBuilder().withName("center1").withLoanOfficer(anyLoanOfficer()).with(customerMeeting).withMfiJoiningDate(noJoiningDate).build();
// exercise test
try {
center.validate();
fail("cannotCreateCenterWithoutAMfiJoiningDate");
} catch (ApplicationException e) {
assertThat(e.getKey(), is(CustomerConstants.MFI_JOINING_DATE_MANDATORY));
}
}
use of org.mifos.domain.builders.CenterBuilder in project head by mifos.
the class CenterValidationTest method setupDependencies.
@Before
public void setupDependencies() {
OfficeBO office = new OfficeBuilder().build();
PersonnelBO loanOfficer = new PersonnelBuilder().asLoanOfficer().build();
MeetingBO meeting = new MeetingBuilder().customerMeeting().build();
center = new CenterBuilder().with(office).withLoanOfficer(loanOfficer).with(meeting).build();
}
Aggregations