@Test public void testConvertToKnownLocale() throws Exception { assertEquals(Optional.of("en"), Languages.convertToKnownLocale("en")); assertEquals(Optional.of("en"), Languages.convertToKnownLocale("en_US")); assertEquals(Optional.of("de"), Languages.convertToKnownLocale("de_DE")); assertEquals(Optional.empty(), Languages.convertToKnownLocale("WHATEVER")); }
@Test(expected = NullPointerException.class) public void testConvertToKnownLocaleNull() { Languages.convertToKnownLocale(null); }