1 package com.lexicalscope.fluentreflection;
2
3 import static com.lexicalscope.fluentreflection.ReflectionMatchers.reflectingOn;
4
5 import java.lang.annotation.Annotation;
6
7 import org.hamcrest.Description;
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25 final class MatcherCallableAnnotatedWith extends ReflectionMatcher<FluentAnnotated> {
26 private final Class<? extends Annotation> annotation;
27
28 public MatcherCallableAnnotatedWith(final Class<? extends Annotation> annotation) {
29 this.annotation = annotation;
30 }
31
32 @Override
33 protected boolean matchesSafely(final FluentAnnotated item) {
34 return item.annotation(reflectingOn(annotation)) != null;
35 }
36
37 @Override
38 public void describeTo(final Description description) {
39 description.appendText("callable annotated with ").appendValue(annotation);
40 }
41 }