use of org.mifos.schedule.internal.HolidayAndWorkingDaysScheduledDateGeneration in project head by mifos.
the class HolidayAndWorkingDaysScheduledDateGenerationTest method givenAHolidayFallsOnScheduledDateAndAdjustmentRuleForHolidayIsNextMeetingShouldGenerateScheduledDatesThatTakeIntoAccountHolidaysAndDuplicateAnyScheduledDatesThatOccurOnHoliday.
@Test
public void givenAHolidayFallsOnScheduledDateAndAdjustmentRuleForHolidayIsNextMeetingShouldGenerateScheduledDatesThatTakeIntoAccountHolidaysAndDuplicateAnyScheduledDatesThatOccurOnHoliday() {
// setup
DateTime fourthOfJuly = new DateTime().plusYears(1).withMonthOfYear(7).withDayOfMonth(4).toDateMidnight().toDateTime();
Holiday independenceDay = new HolidayBuilder().from(fourthOfJuly).to(fourthOfJuly.plusDays(3)).withNextMeetingRule().build();
List<Holiday> upcomingHolidays = Arrays.asList(independenceDay);
scheduleGeneration = new HolidayAndWorkingDaysScheduledDateGeneration(workingDays, upcomingHolidays);
DateTime june29thNextYear = new DateTime().plusYears(1).withMonthOfYear(6).withDayOfMonth(29).toDateMidnight().toDateTime();
DateTime startingFrom = june29thNextYear.minusDays(1);
ScheduledEvent scheduleEvent = new ScheduledEventBuilder().every(1).weeks().on(june29thNextYear.getDayOfWeek()).build();
// exercise test
List<DateTime> scheduledDates = scheduleGeneration.generateScheduledDates(10, startingFrom, scheduleEvent, false);
assertThat(scheduledDates.get(0), is(june29thNextYear));
assertThat(scheduledDates.get(1), is(june29thNextYear.plusWeeks(2)));
assertThat(scheduledDates.get(2), is(june29thNextYear.plusWeeks(2)));
}
use of org.mifos.schedule.internal.HolidayAndWorkingDaysScheduledDateGeneration in project head by mifos.
the class HolidayAndWorkingDaysScheduledDateGenerationTest method setupAndInjectDependencies.
@Before
public void setupAndInjectDependencies() {
workingDays = Arrays.asList(DayOfWeek.mondayAsDay(), DayOfWeek.tuesdayAsDay(), DayOfWeek.wednesdayAsDay(), DayOfWeek.thursdayAsDay(), DayOfWeek.fridayAsDay());
List<Holiday> upcomingHolidays = new ArrayList<Holiday>();
scheduleGeneration = new HolidayAndWorkingDaysScheduledDateGeneration(workingDays, upcomingHolidays);
}
Aggregations