@Test public void testMonthlyOnDayOfMonthMeetingInterval() throws MeetingException { MeetingBO meeting = new MeetingBuilder().monthly().every(1).buildMonthlyForDayNumber(20); meeting.setFiscalCalendarRules(fiscalCalendarRules); when(fiscalCalendarRules.getStartOfWeekWeekDay()).thenReturn(WeekDay.MONDAY); LocalDate paymentDate = new LocalDate(2010, 2, 3); assertThat( meeting.queryDateIsInMeetingIntervalForFixedDate(new LocalDate(2010, 1, 31), paymentDate), is(false)); assertThat( meeting.queryDateIsInMeetingIntervalForFixedDate(new LocalDate(2010, 2, 1), paymentDate), is(true)); assertThat( meeting.queryDateIsInMeetingIntervalForFixedDate(new LocalDate(2010, 2, 28), paymentDate), is(true)); assertThat( meeting.queryDateIsInMeetingIntervalForFixedDate(new LocalDate(2010, 3, 1), paymentDate), is(false)); }
@Test public void testWeeklyMeetingInterval() { MeetingBO meeting = new MeetingBuilder().weekly().every(1).occuringOnA(WeekDay.THURSDAY).build(); meeting.setFiscalCalendarRules(fiscalCalendarRules); when(fiscalCalendarRules.getStartOfWeekWeekDay()).thenReturn(WeekDay.MONDAY); LocalDate paymentDate = new LocalDate(2010, 2, 4); assertThat( meeting.queryDateIsInMeetingIntervalForFixedDate(new LocalDate(2010, 1, 31), paymentDate), is(false)); assertThat( meeting.queryDateIsInMeetingIntervalForFixedDate(new LocalDate(2010, 2, 1), paymentDate), is(true)); assertThat( meeting.queryDateIsInMeetingIntervalForFixedDate(new LocalDate(2010, 2, 7), paymentDate), is(true)); assertThat( meeting.queryDateIsInMeetingIntervalForFixedDate(new LocalDate(2010, 2, 8), paymentDate), is(false)); }
@Test public void testBiMonthlyMeetingInterval() throws MeetingException { MeetingBO meeting = new MeetingBuilder().monthly().every(2).buildMonthlyFor(RankOfDay.THIRD, WeekDay.FRIDAY); meeting.setFiscalCalendarRules(fiscalCalendarRules); when(fiscalCalendarRules.getStartOfWeekWeekDay()).thenReturn(WeekDay.MONDAY); LocalDate paymentDate = new LocalDate(2010, 2, 19); assertThat( meeting.queryDateIsInMeetingIntervalForFixedDate(new LocalDate(2010, 1, 31), paymentDate), is(false)); assertThat( meeting.queryDateIsInMeetingIntervalForFixedDate(new LocalDate(2010, 2, 1), paymentDate), is(true)); assertThat( meeting.queryDateIsInMeetingIntervalForFixedDate(new LocalDate(2010, 3, 31), paymentDate), is(true)); assertThat( meeting.queryDateIsInMeetingIntervalForFixedDate(new LocalDate(2010, 4, 1), paymentDate), is(false)); }