24
24
import java .lang .reflect .Method ;
25
25
26
26
import org .junit .Before ;
27
- import org .junit .Ignore ;
28
27
import org .junit .Test ;
29
28
30
29
import static org .junit .Assert .*;
@@ -46,7 +45,7 @@ public class MethodParameterTests {
46
45
47
46
48
47
@ Before
49
- public void setUp () throws NoSuchMethodException {
48
+ public void setup () throws NoSuchMethodException {
50
49
method = getClass ().getMethod ("method" , String .class , Long .TYPE );
51
50
stringParameter = new MethodParameter (method , 0 );
52
51
longParameter = new MethodParameter (method , 1 );
@@ -114,15 +113,22 @@ public void annotatedConstructorParameterInStaticNestedClass() throws Exception
114
113
assertNotNull (methodParameter .getParameterAnnotation (Param .class ));
115
114
}
116
115
117
- @ Test
118
- @ Ignore ("Disabled until SPR-16652 is resolved" )
116
+ @ Test // SPR-16652
119
117
public void annotatedConstructorParameterInInnerClass () throws Exception {
120
- Constructor <?> constructor = InnerClass .class .getDeclaredConstructor (getClass (), String .class );
121
- MethodParameter methodParameter = MethodParameter .forExecutable (constructor , 1 );
118
+ Constructor <?> constructor = InnerClass .class .getConstructor (getClass (), String .class , Integer .class );
119
+
120
+ MethodParameter methodParameter = MethodParameter .forExecutable (constructor , 0 );
121
+ assertEquals (getClass (), methodParameter .getParameterType ());
122
+ assertNull (methodParameter .getParameterAnnotation (Param .class ));
123
+
124
+ methodParameter = MethodParameter .forExecutable (constructor , 1 );
122
125
assertEquals (String .class , methodParameter .getParameterType ());
123
- assertNull (methodParameter .getParameterAnnotation (Override .class ));
124
126
// The following assertion currently fails if this test class is compiled using JDK 8.
125
127
assertNotNull ("Failed to find @Param annotation" , methodParameter .getParameterAnnotation (Param .class ));
128
+
129
+ methodParameter = MethodParameter .forExecutable (constructor , 2 );
130
+ assertEquals (Integer .class , methodParameter .getParameterType ());
131
+ assertNull (methodParameter .getParameterAnnotation (Param .class ));
126
132
}
127
133
128
134
@@ -140,7 +146,7 @@ private static class NestedClass {
140
146
@ SuppressWarnings ("unused" )
141
147
private class InnerClass {
142
148
143
- InnerClass (@ Param String s ) {
149
+ public InnerClass (@ Param String s , Integer i ) {
144
150
}
145
151
}
146
152
0 commit comments