@Test public void test() throws Exception { assertThat(results(DateTime.parse("20180101"), 10), AllOf.<Matcher<RecurrenceRule>>allOf( matches(new RecurrenceRule("FREQ=DAILY;COUNT=10")), mismatches(new RecurrenceRule("FREQ=DAILY;COUNT=9"), "number of instances was <9>"), mismatches(new RecurrenceRule("FREQ=DAILY;COUNT=12"), "number of instances was <12>"), describesAs("number of instances is <10>") )); assertThat(results(DateTime.parse("20180101"), lessThan(20)), AllOf.<Matcher<RecurrenceRule>>allOf( matches(new RecurrenceRule("FREQ=DAILY;COUNT=1")), matches(new RecurrenceRule("FREQ=DAILY;COUNT=19")), mismatches(new RecurrenceRule("FREQ=DAILY;COUNT=20"), "number of instances <20> was equal to <20>"), mismatches(new RecurrenceRule("FREQ=DAILY;COUNT=21"), "number of instances <21> was greater than <20>"), describesAs("number of instances is a value less than <20>") )); }
public static Matcher<RecurrenceRule> results(DateTime start, Matcher<Integer> count) { return new ResultsMatcher(start, is(count)); }
ResultsMatcher extends TypeSafeDiagnosingMatcher<RecurrenceRule> { public static Matcher<RecurrenceRule> results(DateTime start, Matcher<Integer> count) { return new ResultsMatcher(start, is(count)); } }
ResultsMatcher extends TypeSafeDiagnosingMatcher<RecurrenceRule> { public static Matcher<RecurrenceRule> results(DateTime start, Matcher<Integer> count) { return new ResultsMatcher(start, is(count)); } ResultsMatcher(DateTime start, Matcher<Integer> countMatcher); }
ResultsMatcher extends TypeSafeDiagnosingMatcher<RecurrenceRule> { public static Matcher<RecurrenceRule> results(DateTime start, Matcher<Integer> count) { return new ResultsMatcher(start, is(count)); } ResultsMatcher(DateTime start, Matcher<Integer> countMatcher); static Matcher<RecurrenceRule> results(DateTime start, Matcher<Integer> count); static Matcher<RecurrenceRule> results(DateTime start, int count); @Override void describeTo(Description description); }
ResultsMatcher extends TypeSafeDiagnosingMatcher<RecurrenceRule> { public static Matcher<RecurrenceRule> results(DateTime start, Matcher<Integer> count) { return new ResultsMatcher(start, is(count)); } ResultsMatcher(DateTime start, Matcher<Integer> countMatcher); static Matcher<RecurrenceRule> results(DateTime start, Matcher<Integer> count); static Matcher<RecurrenceRule> results(DateTime start, int count); @Override void describeTo(Description description);  }