IsPresentOptionalAnd extends TypeSafeMatcher<Optional<T>> { @Override public void describeTo(final Description description) { description.appendText("is present and "); description.appendDescriptionOf(innerMatcher); } private  IsPresentOptionalAnd(final Matcher<? super T> innerMatcher); static TypeSafeMatcher<Optional<T>> presentAnd(final Matcher<? super T> innerMatcher); @Override void describeTo(final Description description);  }
@Test public void testDescribeTo() throws Exception { assertIsDescribedTo("is present and " + isEqualMatcher.toString(), isPresentOptionalAndMatcher); }