mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-05-02 20:09:31 +01:00
Polishing
This commit is contained in:
+8
-7
@@ -45,8 +45,8 @@ class ParameterResolutionTests {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void isAutowirablePreconditions() {
|
void isAutowirablePreconditions() {
|
||||||
assertThatIllegalArgumentException().isThrownBy(() ->
|
assertThatIllegalArgumentException()
|
||||||
ParameterResolutionDelegate.isAutowirable(null, 0))
|
.isThrownBy(() -> ParameterResolutionDelegate.isAutowirable(null, 0))
|
||||||
.withMessageContaining("Parameter must not be null");
|
.withMessageContaining("Parameter must not be null");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -87,7 +87,8 @@ class ParameterResolutionTests {
|
|||||||
Parameter[] parameters = notAutowirableConstructor.getParameters();
|
Parameter[] parameters = notAutowirableConstructor.getParameters();
|
||||||
for (int parameterIndex = 0; parameterIndex < parameters.length; parameterIndex++) {
|
for (int parameterIndex = 0; parameterIndex < parameters.length; parameterIndex++) {
|
||||||
Parameter parameter = parameters[parameterIndex];
|
Parameter parameter = parameters[parameterIndex];
|
||||||
assertThat(ParameterResolutionDelegate.isAutowirable(parameter, parameterIndex)).as("Parameter " + parameter + " must not be autowirable").isFalse();
|
assertThat(ParameterResolutionDelegate.isAutowirable(parameter, parameterIndex))
|
||||||
|
.as("Parameter " + parameter + " must not be autowirable").isFalse();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -100,15 +101,15 @@ class ParameterResolutionTests {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void resolveDependencyPreconditionsForContainingClass() {
|
void resolveDependencyPreconditionsForContainingClass() {
|
||||||
assertThatIllegalArgumentException().isThrownBy(() ->
|
assertThatIllegalArgumentException()
|
||||||
ParameterResolutionDelegate.resolveDependency(getParameter(), 0, null, null))
|
.isThrownBy(() -> ParameterResolutionDelegate.resolveDependency(getParameter(), 0, null, null))
|
||||||
.withMessageContaining("Containing class must not be null");
|
.withMessageContaining("Containing class must not be null");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void resolveDependencyPreconditionsForBeanFactory() {
|
void resolveDependencyPreconditionsForBeanFactory() {
|
||||||
assertThatIllegalArgumentException().isThrownBy(() ->
|
assertThatIllegalArgumentException()
|
||||||
ParameterResolutionDelegate.resolveDependency(getParameter(), 0, getClass(), null))
|
.isThrownBy(() -> ParameterResolutionDelegate.resolveDependency(getParameter(), 0, getClass(), null))
|
||||||
.withMessageContaining("AutowireCapableBeanFactory must not be null");
|
.withMessageContaining("AutowireCapableBeanFactory must not be null");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -400,7 +400,7 @@ public class SpringExtension implements BeforeAllCallback, AfterAllCallback, Tes
|
|||||||
ParameterResolutionDelegate.isAutowirable(parameter, parameterContext.getIndex()));
|
ParameterResolutionDelegate.isAutowirable(parameter, parameterContext.getIndex()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean supportsApplicationEvents(Class<?> parameterType, Executable executable) {
|
private static boolean supportsApplicationEvents(Class<?> parameterType, Executable executable) {
|
||||||
if (ApplicationEvents.class.isAssignableFrom(parameterType)) {
|
if (ApplicationEvents.class.isAssignableFrom(parameterType)) {
|
||||||
Assert.isTrue(executable instanceof Method,
|
Assert.isTrue(executable instanceof Method,
|
||||||
"ApplicationEvents can only be injected into test and lifecycle methods");
|
"ApplicationEvents can only be injected into test and lifecycle methods");
|
||||||
|
|||||||
Reference in New Issue
Block a user