### Question:
CollectionComparator implements Comparator<Collection<T>>, Serializable { @Override public int compare(final Collection<T> c1, final Collection<T> c2) { if (c1 == c2) { return 0; } for (final T elem1 : c1) { if (!c2.contains(elem1)) { return -1; } } return c2.size() - c1.size(); }  @Override int compare(final Collection<T> c1, final Collection<T> c2);  }### Answer:
@Test public void testEqual() { final SortedSet<String> ss1 = new TreeSet<>(asList("1", "2", "3")); final SortedSet<String> ss2 = new TreeSet<>(asList("1", "2", "3")); assertThat(comparator.compare(ss1, ss2), is(0)); }
@Test public void testEqualNull() { assertThat(comparator.compare(null, null), is(0)); }
@Test public void testEqualSameCollection() { final SortedSet<String> ss1 = new TreeSet<>(asList("1", "2", "3")); assertThat(comparator.compare(ss1, ss1), is(0)); }
@Test public void testEqualEmpty() { final SortedSet<String> ss1 = new TreeSet<>(); final SortedSet<String> ss2 = new TreeSet<>(); assertThat(comparator.compare(ss1, ss2), is(0)); }
@Test public void testNonEqual() { final SortedSet<String> ss1 = new TreeSet<>(asList("1", "2")); final SortedSet<String> ss2 = new TreeSet<>(asList("1")); assertThat(comparator.compare(ss1, ss2) < 0, is(true)); }
@Test public void testNonEqualReversed() { final SortedSet<String> ss1 = new TreeSet<>(asList("1")); final SortedSet<String> ss2 = new TreeSet<>(asList("1", "2")); assertThat(comparator.compare(ss1, ss2) > 0, is(true)); }
@Test public void testNonEqualDifferent() { final SortedSet<String> ss1 = new TreeSet<>(asList("1")); final SortedSet<String> ss2 = new TreeSet<>(asList("2")); assertThat(comparator.compare(ss1, ss2) < 0, is(true)); }