IsDateInMonth extends TypeSafeMatcher<Date> { public static Matcher<Date> september() { return new IsDateInMonth(9); } IsDateInMonth(final int month); static Matcher<Date> january(); static Matcher<Date> february(); static Matcher<Date> march(); static Matcher<Date> april(); static Matcher<Date> may(); static Matcher<Date> june(); static Matcher<Date> july(); static Matcher<Date> august(); static Matcher<Date> september(); static Matcher<Date> october(); static Matcher<Date> november(); static Matcher<Date> december(); @Override void describeTo(final Description description);  }
@Test public void testSeptember() throws Exception { final boolean matchesRightMonth = septemberMatcher.matches(september); final boolean matchesWrongMonth = septemberMatcher.matches(february); BaseMatcherTest.assertMatches(matchesRightMonth); BaseMatcherTest.assertDoesNotMatch(matchesWrongMonth); }