IsMultimapWithKeySet extends TypeSafeMatcher<Multimap<K, ?>> { @Override public void describeTo(final Description description) { description.appendText("a Multimap containing same key set as ").appendValueList("[", ", ", "]", comparisonSet); } IsMultimapWithKeySet(final Set<K> comparisonSet); static Matcher<Multimap<K, ?>> hasSameKeySet(final Multimap<K, ?> comparison); static Matcher<Multimap<K, ?>> hasSameKeySet(final Set<K> comparison); @Override boolean matchesSafely(final Multimap<K, ?> actual); @Override void describeMismatchSafely(final Multimap<K, ?> multimap, final Description mismatchDescription); @Override void describeTo(final Description description);  }
@Test public void testDescribeTo() throws Exception { BaseMatcherTest.assertIsDescribedTo("a Multimap containing same key set as [\"A\", \"B\", \"C\"]", isMultimapWithKeySetByMultimapMatcher); BaseMatcherTest.assertIsDescribedTo("a Multimap containing same key set as [\"A\", \"B\", \"C\"]", isMultimapWithKeySetBySetMatcher); }