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