@Test
@Config(sdk = Config.ALL_SDKS)
public void normalizeLanguageCode_normalizesCodeToTwoLetterISOAndLowerCase_keepingAllSubtags() {

  assertThat(Util.normalizeLanguageCode("es")).isEqualTo("es");
  assertThat(Util.normalizeLanguageCode("spa")).isEqualTo("es");
  assertThat(Util.normalizeLanguageCode("es-AR")).isEqualTo("es-ar");
  assertThat(Util.normalizeLanguageCode("SpA-ar")).isEqualTo("es-ar");
  assertThat(Util.normalizeLanguageCode("es_AR")).isEqualTo("es-ar");
  assertThat(Util.normalizeLanguageCode("spa_ar")).isEqualTo("es-ar");
  assertThat(Util.normalizeLanguageCode("es-AR-dialect")).isEqualTo("es-ar-dialect");
  // Regional subtag (South America)
  assertThat(Util.normalizeLanguageCode("ES-419")).isEqualTo("es-419");
  // Script subtag (Simplified Taiwanese)
  assertThat(Util.normalizeLanguageCode("zh-hans-tw")).isEqualTo("zh-hans-tw");
  assertThat(Util.normalizeLanguageCode("zho-hans-tw")).isEqualTo("zh-hans-tw");
  // Non-spec compliant subtags.
  assertThat(Util.normalizeLanguageCode("sv-illegalSubtag")).isEqualTo("sv-illegalsubtag");
}