@Test public void testLevel2() throws Exception { final IHolidayManager m = HolidayManagerFactory.getHolidayManager("test"); final HolidayMap holidays = m.getHolidays(2010, "level1", "level2"); assertNotNull(holidays); assertEquals("Wrong number of dates.", test_days_l2.size(), holidays.size()); assertDates(test_days_l2, holidays); }
@Test public void testParserSecondBefore() { final HolidayMap aHolidays = new HolidayMap(); final Holidays config = new Holidays(); final FixedWeekdayRelativeToFixed rule = new FixedWeekdayRelativeToFixed(); rule.setWhich(Which.SECOND); rule.setWeekday(Weekday.MONDAY); rule.setWhen(When.BEFORE); final Fixed fixed = new Fixed(); fixed.setDay(Integer.valueOf(29)); fixed.setMonth(Month.JANUARY); rule.setDay(fixed); config.getFixedWeekdayRelativeToFixed().add(rule); s_aParser.parse(2011, aHolidays, config); assertEquals("Wrong number of dates.", 1, aHolidays.size()); assertEquals( "Wrong date.", PDTFactory.createLocalDate(2011, 1, 17), ContainerHelper.getFirstElement(aHolidays.getAllDates())); }
@Test public void testParserFourthAfter() { final HolidayMap aHolidays = new HolidayMap(); final Holidays config = new Holidays(); final FixedWeekdayRelativeToFixed rule = new FixedWeekdayRelativeToFixed(); rule.setWhich(Which.FOURTH); rule.setWeekday(Weekday.TUESDAY); rule.setWhen(When.AFTER); final Fixed fixed = new Fixed(); fixed.setDay(Integer.valueOf(15)); fixed.setMonth(Month.MARCH); rule.setDay(fixed); config.getFixedWeekdayRelativeToFixed().add(rule); s_aParser.parse(2011, aHolidays, config); assertEquals("Wrong number of dates.", 1, aHolidays.size()); assertEquals( "Wrong date.", PDTFactory.createLocalDate(2011, 4, 12), ContainerHelper.getFirstElement(aHolidays.getAllDates())); }