@@ -159,15 +159,24 @@ public void resolveDependencyPreconditionsForParameter() {
159
159
}
160
160
161
161
@ Test
162
- public void resolveDependencyPreconditionsForBeanFactory () throws Exception {
163
- Method method = getClass ().getDeclaredMethod ("autowirableMethod" , String .class , String .class , String .class , String .class );
164
- Parameter parameter = method .getParameters ()[0 ];
162
+ public void resolveDependencyPreconditionsForContainingClass () throws Exception {
163
+ exception .expect (IllegalArgumentException .class );
164
+ exception .expectMessage ("Containing class must not be null" );
165
+ AutowireUtils .resolveDependency (getParameter (), 0 , null , null );
166
+ }
165
167
168
+ @ Test
169
+ public void resolveDependencyPreconditionsForBeanFactory () throws Exception {
166
170
exception .expect (IllegalArgumentException .class );
167
171
exception .expectMessage ("AutowireCapableBeanFactory must not be null" );
168
- AutowireUtils .resolveDependency (parameter , 0 , null , null );
172
+ AutowireUtils .resolveDependency (getParameter () , 0 , getClass () , null );
169
173
}
170
174
175
+ private Parameter getParameter () throws NoSuchMethodException {
176
+ Method method = getClass ().getDeclaredMethod ("autowirableMethod" , String .class , String .class , String .class , String .class );
177
+ return method .getParameters ()[0 ];
178
+ }
179
+
171
180
@ Test
172
181
public void resolveDependencyForAnnotatedParametersInTopLevelClassConstructor () throws Exception {
173
182
Constructor <?> constructor = AutowirableClass .class .getConstructor (String .class , String .class , String .class , String .class );
0 commit comments