### Question:
TokenSimilarity extends AbstractStringMetric { @Override public double getSimilarity(String s1, String s2) { Validate.notNull(s1, "s1 must not be null"); Validate.notNull(s2, "s2 must not be null"); String s1lower = s1.toLowerCase().trim(); String s2lower = s2.toLowerCase().trim(); if (s1lower.equals(s2lower)) { return 1; } Set<String> split1 = new HashSet<>(); split1.addAll(Arrays.asList(s1lower.split("\\s"))); Set<String> split2 = new HashSet<>(); split2.addAll(Arrays.asList(s2lower.split("\\s"))); return similarity.getSimilarity(split1, split2); } TokenSimilarity();  TokenSimilarity(SetSimilarity similarity); @Override double getSimilarity(String s1, String s2); @Override String toString();  }### Answer:
@Test public void testJaccardSimilarity() { StringMetric similarity = new TokenSimilarity(SetSimilarities.JACCARD); double sim12 = similarity.getSimilarity(S1, S2); assertEquals(0.4286, sim12, DELTA); double sim23 = similarity.getSimilarity(S2, S3); assertEquals(0.1111, sim23, DELTA); double sim13 = similarity.getSimilarity(S1, S3); assertEquals(0.1429, sim13, DELTA); double sim14 = similarity.getSimilarity(S1, S4); assertEquals(0, sim14, DELTA); double sim15 = similarity.getSimilarity(S1, S5); assertEquals(0, sim15, DELTA); double sim16 = similarity.getSimilarity(S1, S6); assertEquals(0.0033, sim16, DELTA); double sim46 = similarity.getSimilarity(S4, S6); assertEquals(0.0132, sim46, DELTA); }