Stringi18nUtils { public static void sortAlphabetically(String[] arrays, Collator collator) { Arrays.sort(arrays, collator); } private  Stringi18nUtils(); static void sortAlphabetically(String[] arrays, Collator collator); static void sortAlphabetically(List<String> list, Collator collator);  }
@Test public void testSpecialCharacterSort_ES() { String[] arr = new String[]{"Ácido araquidónico", "Ácido", "Zinc", "Almidón", "Acido"}; Stringi18nUtils.sortAlphabetically(arr, Collator.getInstance(Locale.US)); assertThat(arr).isEqualTo(new String[]{"Acido", "Ácido", "Ácido araquidónico", "Almidón", "Zinc"}); }
@Test public void testSpecialCharacterSort_FR() { String[] arr = new String[]{"oléique", "oleique", "acide", "Acide"}; Stringi18nUtils.sortAlphabetically(arr, Collator.getInstance(Locale.FRENCH)); assertThat(arr).isEqualTo(new String[]{"acide", "Acide", "oleique", "oléique"}); }
@Test public void testSpecialCharacterSort_FR2() { String[] arr = new String[]{"Molybdène", "manganèse", "molybdene", "Manganèse"}; Stringi18nUtils.sortAlphabetically(arr, Collator.getInstance(Locale.FRENCH)); assertThat(arr).isEqualTo(new String[]{"manganèse", "Manganèse", "molybdene", "Molybdène"}); }
@Test public void testSpecialCharacterSort_RU() { String[] arr = new String[]{"Кофеин", "Каприновая кислота", "Кальций"}; Stringi18nUtils.sortAlphabetically(arr, Collator.getInstance(Locale.US)); String[] expectedResult = new String[]{"Кальций", "Каприновая кислота", "Кофеин"}; assertThat(arr).isEqualTo(expectedResult); }