IsDate extends TypeSafeMatcher<Date> { public static Matcher<Date> hasDay(final int day) { return new IsDate(null, null, day); } IsDate(final Integer year, final Integer month, final Integer day); static Matcher<Date> hasYear(final int year); static Matcher<Date> hasMonth(final int month); static Matcher<Date> hasDay(final int day); static Matcher<Date> hasYearAndMonth(final int year, final int month); static Matcher<Date> hasYearMonthAndDay(final int year, final int month, final int day); @Override void describeTo(final Description description);  }
@Test public void testGivenValidDayWhenMatchesIsCalledThenTrueIsReturned() throws Exception { isDateMatcher = IsDate.hasDay(dateDay); final boolean matches = isDateMatcher.matches(date); BaseMatcherTest.assertMatches(matches); }
@Test public void testGivenNonValidDayWhenMatchesIsCalledThenFalseIsReturned() throws Exception { isDateMatcher = IsDate.hasDay(dateWrongDay); final boolean matches = isDateMatcher.matches(date); BaseMatcherTest.assertDoesNotMatch(matches); }