@UseDataProvider("forTestToString") @Test public void testToString(Locale locale, String expectedResult) { String header = localeHeaderDelegate.toString(locale); assertEquals(expectedResult, header); }
@Override public String toString(Locale locale) { if (locale == null) { throw new IllegalArgumentException(); } String language = locale.getLanguage(); if (language.isEmpty() || "*".equals(language)) { return null; } String country = locale.getCountry(); if (country.isEmpty()) { return language.toLowerCase(); } return language.toLowerCase() + "-" + country.toLowerCase(); }
LocaleHeaderDelegate implements RuntimeDelegate.HeaderDelegate<Locale> { @Override public String toString(Locale locale) { if (locale == null) { throw new IllegalArgumentException(); } String language = locale.getLanguage(); if (language.isEmpty() || "*".equals(language)) { return null; } String country = locale.getCountry(); if (country.isEmpty()) { return language.toLowerCase(); } return language.toLowerCase() + "-" + country.toLowerCase(); } }
LocaleHeaderDelegate implements RuntimeDelegate.HeaderDelegate<Locale> { @Override public String toString(Locale locale) { if (locale == null) { throw new IllegalArgumentException(); } String language = locale.getLanguage(); if (language.isEmpty() || "*".equals(language)) { return null; } String country = locale.getCountry(); if (country.isEmpty()) { return language.toLowerCase(); } return language.toLowerCase() + "-" + country.toLowerCase(); }  }
LocaleHeaderDelegate implements RuntimeDelegate.HeaderDelegate<Locale> { @Override public String toString(Locale locale) { if (locale == null) { throw new IllegalArgumentException(); } String language = locale.getLanguage(); if (language.isEmpty() || "*".equals(language)) { return null; } String country = locale.getCountry(); if (country.isEmpty()) { return language.toLowerCase(); } return language.toLowerCase() + "-" + country.toLowerCase(); }  @Override Locale fromString(String header); @Override String toString(Locale locale); }
LocaleHeaderDelegate implements RuntimeDelegate.HeaderDelegate<Locale> { @Override public String toString(Locale locale) { if (locale == null) { throw new IllegalArgumentException(); } String language = locale.getLanguage(); if (language.isEmpty() || "*".equals(language)) { return null; } String country = locale.getCountry(); if (country.isEmpty()) { return language.toLowerCase(); } return language.toLowerCase() + "-" + country.toLowerCase(); }  @Override Locale fromString(String header); @Override String toString(Locale locale);  }