KeywordSort { public static String normalizeDesc(String rawDesc) { if (rawDesc == null) { return ""; } String lowercase = rawDesc.toLowerCase(); StringBuilder builder = new StringBuilder(); for (int i = 0; i < lowercase.length(); i++) { char currChar = lowercase.charAt(i); switch (currChar) { case '\u00f6': case '\u00f2': case '\u00f4': builder.append('o'); break; case '\u00fc': case '\u00f9': case '\u00fb': builder.append('u'); break; case '\u00e9': case '\u00ea': case '\u00e8': builder.append('e'); break; case '\u00e4': case '\u00e0': case '\u00e2': case '\u00e1': builder.append('a'); break; case '\u00e7': builder.append('c'); break; case '\u00ec': case '\u00ee': builder.append('i'); break; default: if (Character.isAlphabetic(currChar) || Character.isDigit(currChar)) { builder.append(currChar); } break; } } return builder.toString().trim(); } private  KeywordSort(); static Comparator<KeywordBean> defaultLabelSorter(final SortDirection direction); static Comparator<KeywordBean> defaultDefinitionSorter(final SortDirection direction); static Comparator<KeywordBean> searchResultsSorter(final String searchTerm, final SortDirection direction); static String normalizeDesc(String rawDesc);  }
@Test public void testNormalizeDesc() throws Exception { assertEquals("aoeᶚ能", KeywordSort.normalizeDesc("{(aöÈᶚ能͓}")); assertEquals("", KeywordSort.normalizeDesc(null)); assertEquals("", KeywordSort.normalizeDesc("")); assertEquals("", KeywordSort.normalizeDesc(" ")); assertEquals("", KeywordSort.normalizeDesc("'")); assertEquals("1", KeywordSort.normalizeDesc(".[{#$£)( assertEquals("o", KeywordSort.normalizeDesc("\u00F6")); }