@Test public void testGetPattern() { assertThat(DateFormats.getPattern(GERMAN), is(DateFormats.PATTERN_DE)); assertThat(DateFormats.getPattern(GERMANY), is(DateFormats.PATTERN_DE)); assertThat(DateFormats.getPattern(AUSTRIA), is(DateFormats.PATTERN_DE)); assertThat(DateFormats.getPattern(ENGLISH), is(not(nullValue()))); assertThat(DateFormats.getPattern(ENGLISH), is(not(DateFormats.PATTERN_DE))); assertThat(DateFormats.getPattern(ENGLISH), is(not(DateFormats.PATTERN_ISO))); assertThat(DateFormats.getPattern(ENGLISH), is("M/d/yy")); assertThat(DateFormats.getPattern(US), is(not(nullValue()))); assertThat(DateFormats.getPattern(US), is(not(DateFormats.PATTERN_DE))); assertThat(DateFormats.getPattern(US), is(not(DateFormats.PATTERN_ISO))); assertThat(DateFormats.getPattern(US), is("M/d/yy")); assertThat(DateFormats.getPattern(UK), is(oneOf("dd/MM/yy", "dd/MM/y"))); }
public static String getPattern(Locale locale) { requireNonNull(locale, "locale must not be null"); String registeredPattern = LANGUAGE_PATTERNS.get(locale.getLanguage()); if (registeredPattern != null) { return registeredPattern; } else { return defaultLocalePattern(locale); } }
DateFormats { public static String getPattern(Locale locale) { requireNonNull(locale, "locale must not be null"); String registeredPattern = LANGUAGE_PATTERNS.get(locale.getLanguage()); if (registeredPattern != null) { return registeredPattern; } else { return defaultLocalePattern(locale); } } }
DateFormats { public static String getPattern(Locale locale) { requireNonNull(locale, "locale must not be null"); String registeredPattern = LANGUAGE_PATTERNS.get(locale.getLanguage()); if (registeredPattern != null) { return registeredPattern; } else { return defaultLocalePattern(locale); } } private  DateFormats(); }
DateFormats { public static String getPattern(Locale locale) { requireNonNull(locale, "locale must not be null"); String registeredPattern = LANGUAGE_PATTERNS.get(locale.getLanguage()); if (registeredPattern != null) { return registeredPattern; } else { return defaultLocalePattern(locale); } } private  DateFormats(); static void register(String languageCode, String pattern); static String getPattern(Locale locale); }
DateFormats { public static String getPattern(Locale locale) { requireNonNull(locale, "locale must not be null"); String registeredPattern = LANGUAGE_PATTERNS.get(locale.getLanguage()); if (registeredPattern != null) { return registeredPattern; } else { return defaultLocalePattern(locale); } } private  DateFormats(); static void register(String languageCode, String pattern); static String getPattern(Locale locale); static final String PATTERN_ISO; static final String PATTERN_DE; }