MatcherOr extends ReflectionMatcher<T> { @Override public void describeTo(final Description description) { for (int i = 0; i < matchers.size(); i++) { description.appendDescriptionOf(matchers.get(i)); if (i + 1 < matchers.size()) { description.appendText(" or "); } } } private  MatcherOr(final List<? extends Matcher<? super T>> matchers); @Override boolean matchesSafely(final T item); @Override void describeTo(final Description description); @Factory static MatcherOr<T> orOf(final List<? extends Matcher<? super T>> matchers);  }
@Test public void descriptionDescribesBothMatchers() throws Exception { final Description description = context.mock(Description.class); context.checking(new Expectations() { { oneOf(description).appendDescriptionOf(matcherA); oneOf(description).appendText(" or "); oneOf(description).appendDescriptionOf(matcherB); } }); matcher.describeTo(description); }