FingerprintKeyer implements Serializable { public String key(String str) { String s = str.trim(); s = s.toLowerCase(); s = alphanum.matcher(s).replaceAll(""); String[] frags = StringUtils.split(s); TreeSet<String> set = new TreeSet<String>(); for (String ss : frags) { set.add(ss); } StringBuilder b = new StringBuilder(); Iterator<String> i = set.iterator(); while (i.hasNext()) { b.append(i.next()); b.append(' '); } return asciify(b.toString().trim()); }  String key(String str);  }
@Test public void testKey() { FingerprintKeyer keyer = new FingerprintKeyer(); for (String[] element : testStr) { assertEquals(element[1], keyer.key(element[0])); } }