### Question:
JaccardIndexComparator implements Comparator { public double compare(String s1, String s2) { if (s1.equals(s2)) return 1.0; String[] t1 = StringUtils.split(s1); String[] t2 = StringUtils.split(s2); if (t1.length > t2.length) { String[] tmp = t2; t2 = t1; t1 = tmp; } double intersection = 0; double union = t1.length + t2.length; for (int ix1 = 0; ix1 < t1.length; ix1++) { double highest = 0; for (int ix2 = 0; ix2 < t2.length; ix2++) highest = Math.max(highest, subcomp.compare(t1[ix1], t2[ix2])); intersection += highest; union -= highest; } return intersection / union; } JaccardIndexComparator(); void setComparator(Comparator comp); boolean isTokenized(); double compare(String s1, String s2);  }### Answer:
@Test public void testEmpty() { assertEquals(1.0, comp.compare("", "")); }
@Test public void testOneIsEmpty() { assertEquals(0.0, comp.compare("", "abc")); }
@Test public void testOneIsDifferent() { assertEquals((1.0 / 3.0), comp.compare("abc def", "cba def")); }
@Test public void testSameSets() { assertEquals(1.0, comp.compare("abc def", "def abc")); }