Skip to content

Commit 005e3cf

Browse files
committed
Factor out more common test code
AnnotationConfig is always the same in TestParameterAnnotations.
1 parent 77c847c commit 005e3cf

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/test/java/com/fasterxml/classmate/TestParameterAnnotations.java

+5-6
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,13 @@ public class TestParameterAnnotations {
1717

1818
TypeResolver types;
1919
MemberResolver members;
20+
AnnotationConfiguration annotations;
2021

2122
@Before
2223
public void setup() {
2324
types = new TypeResolver();
2425
members = new MemberResolver(types);
26+
annotations = new AnnotationConfiguration.StdConfiguration(AnnotationInclusion.INCLUDE_AND_INHERIT_IF_INHERITED);
2527
}
2628

2729
@Retention(RetentionPolicy.RUNTIME)
@@ -63,8 +65,7 @@ static interface ExtendedMixIn extends MixIn {
6365
// note: most of the above is unimplemented currently
6466

6567
@Test
66-
public void testIncludesUninheritableAnnotationsDirectly() throws NoSuchMethodException {
67-
AnnotationConfiguration annotations = new AnnotationConfiguration.StdConfiguration(AnnotationInclusion.INCLUDE_AND_INHERIT_IF_INHERITED);
68+
public void testIncludesUninheritableAnnotationsDirectly() {
6869
ResolvedTypeWithMembers type = members.resolve(types.resolve(BaseInterface.class), annotations, null);
6970
ResolvedMethod[] methods = type.getMemberMethods();
7071

@@ -76,8 +77,7 @@ public void testIncludesUninheritableAnnotationsDirectly() throws NoSuchMethodEx
7677
}
7778

7879
@Test
79-
public void testInheritsOnlyMarkedAnnotations() throws NoSuchMethodException {
80-
AnnotationConfiguration annotations = new AnnotationConfiguration.StdConfiguration(AnnotationInclusion.INCLUDE_AND_INHERIT_IF_INHERITED);
80+
public void testInheritsOnlyMarkedAnnotations() {
8181
ResolvedTypeWithMembers type = members.resolve(types.resolve(ExtendedInterface.class), annotations, null);
8282
ResolvedMethod[] methods = type.getMemberMethods();
8383

@@ -93,8 +93,7 @@ public void testInheritsOnlyMarkedAnnotations() throws NoSuchMethodException {
9393
}
9494

9595
@Test
96-
public void testMixInAnnotations() throws NoSuchMethodException {
97-
AnnotationConfiguration annotations = new AnnotationConfiguration.StdConfiguration(AnnotationInclusion.INCLUDE_AND_INHERIT_IF_INHERITED);
96+
public void testMixInAnnotations() {
9897
ResolvedTypeWithMembers type = members.resolve(types.resolve(TargetInterface.class), annotations, AnnotationOverrides.builder().add(TargetInterface.class, ExtendedMixIn.class).build());
9998
ResolvedMethod[] methods = type.getMemberMethods();
10099

0 commit comments

Comments
 (0)