DateHelper { public static String[] getWeekdays() { String[] days = new DateFormatSymbols(Locale.getDefault()).getWeekdays(); return getSortWeekdays(days, Calendar.getInstance().getFirstDayOfWeek()); } private  DateHelper(); static String format(Date dt); static String format(Date dt, String pattern); static String formatShortDate(Date dt); static String formatShortTime(Date dt); static String formatISO8601(Date dt); static Calendar getEmptyCalendar(); static Calendar calendar(int year, int month, int day); static Date date(int year, int month, int day); static Date beginOfDay(Date dt); static Date endOfDay(Date dt); static int diffDays(Date dtEnd, Date dtBegin); static Date setTime(Date date, Date time); static Date getTime(Date datetime); static boolean isOnlyTime(Date dt); static boolean isOnlyDate(Date dt); static Date addDays(Date date, int count); static boolean isEmpty(Date date); static String[] getWeekdays(); static String[] getShortWeekdays(); static int[] getIndexWeekdays(); static final String DATE_FORMAT_ISO8601; }
@Test public void testGetWeekdays() throws Exception { final String lang = Locale.getDefault().getLanguage(); String[] weekdays = DateHelper.getWeekdays(); if (lang.equals("ru")) { assertEquals("понедельник", weekdays[0]); assertEquals("вторник", weekdays[1]); assertEquals("среда", weekdays[2]); assertEquals("четверг", weekdays[3]); assertEquals("пятница", weekdays[4]); assertEquals("суббота", weekdays[5]); assertEquals("воскресенье", weekdays[6]); } else if (lang.equals("en")) { assertEquals("Sunday", weekdays[0]); assertEquals("Monday", weekdays[1]); assertEquals("Tuesday", weekdays[2]); assertEquals("Wednesday", weekdays[3]); assertEquals("Thursday", weekdays[4]); assertEquals("Friday", weekdays[5]); assertEquals("Saturday", weekdays[6]); } else { fail("No test, set unknown locale"); } }