use of org.mifos.domain.builders.CalendarEventBuilder in project head by mifos.
the class GroupCreationTest method createsGroupWithCustomerAccount.
@Test
public void createsGroupWithCustomerAccount() throws Exception {
// setup
OfficeBO withOffice = new OfficeBO(new Short("1"), "testOffice", new Integer("1"), new Short("1"));
CenterBO parent = new CenterBuilder().withLoanOfficer(anyLoanOfficer()).with(withOffice).build();
GroupBO stubbedGroup = new GroupBuilder().withName("group").withParentCustomer(parent).formedBy(anyLoanOfficer()).build();
List<AccountFeesEntity> accountFees = new ArrayList<AccountFeesEntity>();
// stub
CalendarEvent upcomingCalendarEvents = new CalendarEventBuilder().build();
when(holidayDao.findCalendarEventsForThisYearAndNext((short) 1)).thenReturn(upcomingCalendarEvents);
when(customerAccountFactory.create(stubbedGroup, accountFees, meeting, upcomingCalendarEvents)).thenReturn(customerAccount);
when(customerAccount.getType()).thenReturn(AccountTypes.CUSTOMER_ACCOUNT);
// exercise test
customerService.createGroup(stubbedGroup, meeting, accountFees);
// verification
assertThat(stubbedGroup.getCustomerAccount(), is(customerAccount));
}
use of org.mifos.domain.builders.CalendarEventBuilder 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