IsDateInWeekOfYear extends TypeSafeMatcher<Date> { @Override public void describeTo(final Description description) { description.appendText("a date in week of the year ").appendValue(weekOfYear); } IsDateInWeekOfYear(final int weekOfYear); static Matcher<Date> inWeekOfYear(final int week); @Override void describeTo(final Description description);  }
@Test public void testDescribeTo() throws Exception { assertIsDescribedTo(format("a date in week of the year <%d>", 1), isWeek1Matcher); assertIsDescribedTo(format("a date in week of the year <%d>", 52), isWeek52Matcher); assertIsDescribedTo(format("a date in week of the year <%d>", 53), isWeek53Matcher); }