### Question:
Levenshtein implements Comparator { public double compare(String s1, String s2) { int len = Math.min(s1.length(), s2.length()); int maxlen = Math.max(s1.length(), s2.length()); if ((double) len / (double) maxlen <= 0.5) return 0.0; if (len == maxlen && s1.equals(s2)) return 1.0; int dist = Math.min(compactDistance(s1, s2), len); return 1.0 - (((double) dist) / ((double) len)); }  double compare(String s1, String s2); boolean isTokenized(); static int distance(String s1, String s2); static int compactDistance(String s1, String s2);  }### Answer:
@Test public void testComparatorEqual() { assertEquals(1.0, comp.compare("foo", "foo")); }
@Test public void testComparatorTotallyDifferent() { assertTrue(comp.compare("foo", "bar") < 0.5); }
@Test public void testComparatorOneInFour() { assertEquals(0.75, comp.compare("fooz", "foos")); }