DateUtil { static public boolean isPublicHoliday(Date date) { final Calendar calendar = GregorianCalendar.getInstance(); calendar.setTime(date); final int day = calendar.get(Calendar.DAY_OF_MONTH); final int month = calendar.get(Calendar.MONTH) + 1; final int year = calendar.get(Calendar.YEAR); String dateStr = String.valueOf(day) + "." + String.valueOf(month); String dateStrWithYear = dateStr + "." + String.valueOf(year); return FIXED_HOLIDAYS.contains(dateStr) || DYNAMIC_HOLIDAYS.contains(dateStrWithYear); }  static int getDayOfWeek(Date date); static boolean isPublicHoliday(Date date); static int inMinutes(int hours, int minutes); static Date addMinutesToDate(Date date, int minutes); static String formatTimeFromMinutes(int minutes); static final List<String> FIXED_HOLIDAYS; static final List<String> DYNAMIC_HOLIDAYS; static final int ONE_MINUTE_IN_MILLISECONDS; static final int HOURS_PER_DAY; static final int MINUTES_PER_HOUR; static final int MINUTES_PER_DAY; }
@Test public void testIsPublicHoliday() throws Exception { final Calendar calendar = GregorianCalendar.getInstance(); calendar.set(2015, 0, 1); assertTrue(DateUtil.isPublicHoliday(calendar.getTime())); calendar.set(2016, 2, 28); assertTrue(DateUtil.isPublicHoliday(calendar.getTime())); calendar.set(2015, 5, 5); assertFalse(DateUtil.isPublicHoliday(calendar.getTime())); }