Language implements Serializable { public Language(String language) { this(language, null, null, language); } Language(String language); private  Language(String language, String script, String region, String tag); static Language fromString(String string); String getLanguage(); String getScript(); String getRegion(); String toLanguageTag(boolean script, boolean region); String toLanguageTag(); String toString(); boolean isEqualOrMoreGenericThan(Language other); boolean isLanguageOnly(); @Override boolean equals(Object o); @Override int hashCode(); static final String LATIN_SCRIPT; static final String CYRILLIC_SCRIPT; static final Language ARABIC; static final Language BULGARIAN; static final Language BRETON; static final Language CATALAN; static final Language CZECH; static final Language DANISH; static final Language GERMAN; static final Language GREEK; static final Language ENGLISH; static final Language ESPERANTO; static final Language SPANISH; static final Language BASQUE; static final Language PERSIAN; static final Language FINNISH; static final Language FRENCH; static final Language IRISH; static final Language GALICIAN; static final Language HEBREW; static final Language HINDI; static final Language HUNGARIAN; static final Language ARMENIAN; static final Language INDONESIAN; static final Language ICELANDIC; static final Language ITALIAN; static final Language JAPANESE; static final Language KHMER; static final Language KOREAN; static final Language LATVIAN; static final Language MALAYALAM; static final Language DUTCH; static final Language NORWEGIAN; static final Language POLISH; static final Language BRAZILIAN; static final Language PORTUGUESE; static final Language ROMANIAN; static final Language RUSSIAN; static final Language NORTHERN_SAMI; static final Language SERBIAN; static final Language SLOVAK; static final Language SLOVENE; static final Language SWEDISH; static final Language TAMIL; static final Language THAI; static final Language TAGALOG; static final Language TURKISH; static final Language UKRAINIAN; static final Language CHINESE; static final Language CHINESE_SIMPLIFIED; static final Language CHINESE_TRADITIONAL; }
@Test public void language() { for (String string : new String[]{"en", "EN", "En"}) { Language language = Language.fromString(string); assertEquals("en", language.getLanguage()); assertNull(language.getScript()); assertNull(language.getRegion()); assertEquals("en", language.toLanguageTag()); } }