public static class SpringInjectRulesAndExtensions.SpringInjectRulesAndExtensionsTestExecutionListener
extends org.springframework.test.context.support.AbstractTestExecutionListener
TestExecutionListener finds all fields in the test class instance which is annotated with JUnit
Rule or JUnit 5 Jupiter RegisterExtension, and runs
beanFactory.autowireBean(fieldValue) on them.| Constructor and Description |
|---|
SpringInjectRulesAndExtensionsTestExecutionListener() |
| Modifier and Type | Method and Description |
|---|---|
protected static java.util.Set<java.lang.reflect.Field> |
findFields(java.lang.Class<?> clazz,
java.lang.String annotationClassName)
Find all fields in class with given annotation.
|
void |
prepareTestInstance(org.springframework.test.context.TestContext testContext)
Performs dependency injection on
Rule and @RegisterExtension fields in test-class
as supplied by testContext. |
public SpringInjectRulesAndExtensionsTestExecutionListener()
public void prepareTestInstance(org.springframework.test.context.TestContext testContext)
Rule and @RegisterExtension fields in test-class
as supplied by testContext.prepareTestInstance in interface org.springframework.test.context.TestExecutionListenerprepareTestInstance in class org.springframework.test.context.support.AbstractTestExecutionListenerprotected static java.util.Set<java.lang.reflect.Field> findFields(java.lang.Class<?> clazz,
java.lang.String annotationClassName)