IsDateInLeapYear extends TypeSafeMatcher<Date> { @Override protected void describeMismatchSafely(final Date date, final Description mismatchDescription) { mismatchDescription.appendValue(date).appendText(" is not a leap year"); }  static Matcher<Date> leapYear(); @Override void describeTo(final Description description);  }
@Test public void testDescribeMismatchSafely() throws Exception { BaseMatcherTest.assertHasMismatchDescription(String.format("<%s> is not a leap year", nonLeapYear), isLeapYearMatcher, nonLeapYear); }