use of org.mifos.customers.center.business.CenterBO in project head by mifos.
the class GroupValidationTest method givenReceivingCenterIsNullShouldFailValidation.
@Test
public void givenReceivingCenterIsNullShouldFailValidation() {
PersonnelBO formedBy = new PersonnelBuilder().build();
group = new GroupBuilder().withName("group-On-center").withParentCustomer(center).formedBy(formedBy).build();
CenterBO toCenter = null;
try {
group.validateReceivingCenter(toCenter);
fail("givenReceivingCenterIsNullShouldThrowCustomerException");
} catch (CustomerException e) {
assertThat(e.getKey(), is(CustomerConstants.INVALID_PARENT));
}
}
use of org.mifos.customers.center.business.CenterBO in project head by mifos.
the class GroupValidationTest method givenAnActiveLoanAccountExistsGroupTransferToCenterShouldFailValidation.
@Test
public void givenAnActiveLoanAccountExistsGroupTransferToCenterShouldFailValidation() {
// setup
CenterBO center = new CenterBuilder().build();
GroupBO group = new GroupBuilder().withParentCustomer(center).build();
LoanBO loan = new LoanAccountBuilder().activeInGoodStanding().build();
group.addAccount(loan);
// exercise test
try {
group.validateNoActiveAccountsExist();
fail("should fail validation");
} catch (CustomerException e) {
assertThat(e.getKey(), is(CustomerConstants.ERRORS_HAS_ACTIVE_ACCOUNT));
}
}
use of org.mifos.customers.center.business.CenterBO in project head by mifos.
the class GroupValidationTest method givenCenterIsInActiveGroupTransferToCenterShouldFailValidation.
@Test
public void givenCenterIsInActiveGroupTransferToCenterShouldFailValidation() {
// setup
CenterBO center = new CenterBuilder().withName("newCenter").inActive().build();
GroupBO group = new GroupBuilder().build();
// exercise test
try {
group.validateReceivingCenter(center);
fail("should fail validation");
} catch (CustomerException e) {
assertThat(e.getKey(), is(CustomerConstants.ERRORS_INTRANSFER_PARENT_INACTIVE));
}
}
use of org.mifos.customers.center.business.CenterBO in project head by mifos.
the class GroupValidationTest method givenAnActiveSavingsAccountExistsGroupTransferToCenterShouldFailValidation.
@Test
public void givenAnActiveSavingsAccountExistsGroupTransferToCenterShouldFailValidation() {
// setup
CenterBO center = new CenterBuilder().build();
GroupBO group = new GroupBuilder().withParentCustomer(center).build();
SavingsBO savings = new SavingsAccountBuilder().active().withCustomer(group).build();
group.addAccount(savings);
// exercise test
try {
group.validateNoActiveAccountsExist();
fail("should fail validation");
} catch (CustomerException e) {
assertThat(e.getKey(), is(CustomerConstants.ERRORS_HAS_ACTIVE_ACCOUNT));
}
}
use of org.mifos.customers.center.business.CenterBO in project head by mifos.
the class UpdateCustomerMeetingScheduleTest method givenDayOfWeekRemainsUnchangedShouldNotRegenerateSchedules.
@Test
public void givenDayOfWeekRemainsUnchangedShouldNotRegenerateSchedules() throws Exception {
// setup
UserContext userContext = TestUtils.makeUser();
MeetingBO weeklyMondayMeeting = new MeetingBuilder().customerMeeting().weekly().every(1).occuringOnA(WeekDay.MONDAY).build();
weeklyMondayMeeting.updateDetails(userContext);
CustomerAccountBuilder accountBuilder = new CustomerAccountBuilder();
CenterBO center = new CenterBuilder().active().with(weeklyMondayMeeting).withAccount(accountBuilder).build();
// pre - verification
assertThatAllCustomerSchedulesOccuringBeforeOrOnCurrentInstallmentPeriodRemainUnchanged(center, WeekDay.MONDAY);
assertThatAllCustomerSchedulesOccuringAfterCurrentInstallmentPeriodFallOnDayOfWeek(center, WeekDay.MONDAY);
// exercise test
customerService.updateCustomerMeetingSchedule(weeklyMondayMeeting, mockedCenter);
// verification
assertThatAllCustomerSchedulesOccuringBeforeOrOnCurrentInstallmentPeriodRemainUnchanged(center, WeekDay.MONDAY);
assertThatAllCustomerSchedulesOccuringAfterCurrentInstallmentPeriodFallOnDayOfWeek(center, WeekDay.MONDAY);
}
Aggregations