DateUtil { public static String getDatePattern() { Locale locale = LocaleContextHolder.getLocale(); String defaultDatePattern; try { defaultDatePattern = ResourceBundle.getBundle(Constants.BUNDLE_KEY, locale) .getString("date.format"); } catch (MissingResourceException mse) { defaultDatePattern = "MM/dd/yyyy"; } return defaultDatePattern; } private  DateUtil(); static String getDatePattern(); static String getDateTimePattern(); static String getDate(Date aDate); static Date convertStringToDate(String aMask, String strDate); static String getTimeNow(Date theTime); static Calendar getToday(); static String getDateTime(String aMask, Date aDate); static String convertDateToString(Date aDate); static Date convertStringToDate(final String strDate);  }
@Test public void testGetInternationalDatePattern() { LocaleContextHolder.setLocale(new Locale("nl")); assertEquals("dd-MMM-yyyy", DateUtil.getDatePattern()); LocaleContextHolder.setLocale(Locale.FRANCE); assertEquals("dd/MM/yyyy", DateUtil.getDatePattern()); LocaleContextHolder.setLocale(Locale.GERMANY); assertEquals("dd.MM.yyyy", DateUtil.getDatePattern()); LocaleContextHolder.setLocale(new Locale("fi")); String fiPattern = DateUtil.getDatePattern(); LocaleContextHolder.setLocale(Locale.getDefault()); String defaultPattern = DateUtil.getDatePattern(); assertEquals(defaultPattern, fiPattern); }