1 | 160 | 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 | 24 | public MatcherCallableAnnotatedWith(final Class<? extends Annotation> annotation) { |
29 | 24 | this.annotation = annotation; |
30 | 24 | } |
31 | |
|
32 | |
@Override |
33 | |
protected boolean matchesSafely(final FluentAnnotated item) { |
34 | 160 | return item.annotation(reflectingOn(annotation)) != null; |
35 | |
} |
36 | |
|
37 | |
@Override |
38 | |
public void describeTo(final Description description) { |
39 | 0 | description.appendText("callable annotated with ").appendValue(annotation); |
40 | 0 | } |
41 | |
} |