@@ -302,18 +302,19 @@ public void afterEach(ExtensionContext context) throws Exception {
302302 @ Override
303303 public boolean supportsParameter (ParameterContext parameterContext , ExtensionContext extensionContext ) {
304304 Parameter parameter = parameterContext .getParameter ();
305+ Class <?> parameterType = parameter .getType ();
305306 Executable executable = parameter .getDeclaringExecutable ();
306307 PropertyProvider junitPropertyProvider = propertyName ->
307308 extensionContext .getConfigurationParameter (propertyName ).orElse (null );
308309 return (TestConstructorUtils .isAutowirableConstructor (executable , junitPropertyProvider ) ||
309- ApplicationContext .class .isAssignableFrom (parameter . getType () ) ||
310- supportsApplicationEvents (parameterContext ) ||
310+ ApplicationContext .class .isAssignableFrom (parameterType ) ||
311+ supportsApplicationEvents (parameterType , executable ) ||
311312 ParameterResolutionDelegate .isAutowirable (parameter , parameterContext .getIndex ()));
312313 }
313314
314- private boolean supportsApplicationEvents (ParameterContext parameterContext ) {
315- if (ApplicationEvents .class .isAssignableFrom (parameterContext . getParameter (). getType () )) {
316- Assert .isTrue (parameterContext . getDeclaringExecutable () instanceof Method ,
315+ private boolean supportsApplicationEvents (Class <?> parameterType , Executable executable ) {
316+ if (ApplicationEvents .class .isAssignableFrom (parameterType )) {
317+ Assert .isTrue (executable instanceof Method ,
317318 "ApplicationEvents can only be injected into test and lifecycle methods" );
318319 return true ;
319320 }
0 commit comments