IsBetweenUpperBoundInclusive extends TypeSafeMatcher<T> { @Override public void describeTo(final Description description) { description.appendText("a value between ").appendValue(from).appendText(" excluded and ").appendValue(to) .appendText(" included"); } IsBetweenUpperBoundInclusive(final T from, final T to); static Matcher<T> betweenUpperBoundInclusive(final T from, final T to); @Override void describeTo(final Description description);  }
@Test public void testDescribeTo() throws Exception { assertIsDescribedTo("a value between <10> excluded and <12> included", isBetweenUpperBoundInclusiveMatcher); }