use of org.mifos.domain.builders.MeetingBuilder 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.MeetingBuilder 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();
}
use of org.mifos.domain.builders.MeetingBuilder in project head by mifos.
the class UpdateCustomerMeetingScheduleTest method throwsCheckedExceptionWhenUserDoesNotHavePermissionToEditMeetingSchedule.
@Test(expected = BusinessRuleException.class)
public void throwsCheckedExceptionWhenUserDoesNotHavePermissionToEditMeetingSchedule() throws Exception {
// setup
UserContext userContext = TestUtils.makeUser();
MeetingBO newMeeting = new MeetingBuilder().build();
newMeeting.updateDetails(userContext);
// stubbing
when(mockedCenter.getUserContext()).thenReturn(TestUtils.makeUser());
doThrow(new BusinessRuleException(SecurityConstants.KEY_ACTIVITY_NOT_ALLOWED)).when(customerDao).checkPermissionForEditMeetingSchedule(userContext, mockedCenter);
// exercise test
customerService.updateCustomerMeetingSchedule(newMeeting, mockedCenter);
// verification
verify(customerDao).checkPermissionForEditMeetingSchedule(userContext, mockedCenter);
}
use of org.mifos.domain.builders.MeetingBuilder in project head by mifos.
the class CustomerAccountBOIntegrationTest method createInitialObjects.
private void createInitialObjects() {
MeetingBO weeklyMeeting = new MeetingBuilder().customerMeeting().weekly().every(1).startingToday().build();
IntegrationTestObjectMother.saveMeeting(weeklyMeeting);
center = new CenterBuilder().withNumberOfExistingCustomersInOffice(3).with(weeklyMeeting).withName("Center_Active_test").with(sampleBranchOffice()).withLoanOfficer(testUser()).build();
IntegrationTestObjectMother.createCenter((CenterBO) center, weeklyMeeting);
group = TestObjectFactory.createWeeklyFeeGroupUnderCenter("Group_Active_test", CustomerStatus.GROUP_ACTIVE, center);
}
use of org.mifos.domain.builders.MeetingBuilder in project head by mifos.
the class CustomerAccountCreationTest method firstCustomerScheduleIsAlwaysTheClosestMatchingDayOfWeekAndDoesNotTakeIntoAccountMonthlyMeetingFrequency.
@Test
public void firstCustomerScheduleIsAlwaysTheClosestMatchingDayOfWeekAndDoesNotTakeIntoAccountMonthlyMeetingFrequency() throws Exception {
// setup
applicableCalendarEvents = new CalendarEventBuilder().build();
DateTime tue19thOfApril = new DateTime().withDate(2011, 4, 19);
accountFees = new ArrayList<AccountFeesEntity>();
MeetingBO centerMeeting = new MeetingBuilder().customerMeeting().monthly().every(2).occuringOnA(WeekDay.MONDAY).startingFrom(tue19thOfApril.minusDays(1).toDate()).onDayOfMonth(18).build();
CenterBO center = new CenterBuilder().active().withActivationDate(tue19thOfApril).with(centerMeeting).build();
// exercise test
CustomerAccountBO centerAccount = CustomerAccountBO.createNew(center, accountFees, centerMeeting, applicableCalendarEvents);
// verification
List<AccountActionDateEntity> centerSchedules = new ArrayList<AccountActionDateEntity>(centerAccount.getAccountActionDates());
LocalDate firstCenterDate = new LocalDate(centerSchedules.get(0).getActionDate());
LocalDate mon18thOfMay = new DateTime().withDate(2011, 5, 18).toLocalDate();
assertThat(firstCenterDate, is(mon18thOfMay));
}
Aggregations