IsClassWithAnnotation extends TypeSafeMatcher<Class> { @Override public void describeTo(final Description description) { description.appendText("a Class with annotation ").appendValue(annotation.toString()); } private  IsClassWithAnnotation(final Class<? extends Annotation> annotation); static Matcher<Class> hasRuntimeAnnotation(final Class<? extends Annotation> annotation); @Override void describeTo(final Description description);  }
@Test public void testDescribeTo() throws Exception { assertIsDescribedTo(String.format("a Class with annotation \"%s\"", runtimeAnnotation.toString()), isClassWithAnnotationMatcher); }