Document `TestExecutionListener` implementations introduced in 6.2

Closes gh-33661
This commit is contained in:
Simon Baslé 2024-10-10 16:27:37 +02:00
parent 0e8316e704
commit 0f25c75b9e
3 changed files with 15 additions and 0 deletions

View File

@ -10,6 +10,7 @@ by default, exactly in the following order:
annotation for "`before`" modes. annotation for "`before`" modes.
* `ApplicationEventsTestExecutionListener`: Provides support for * `ApplicationEventsTestExecutionListener`: Provides support for
xref:testing/testcontext-framework/application-events.adoc[`ApplicationEvents`]. xref:testing/testcontext-framework/application-events.adoc[`ApplicationEvents`].
* `MockitoTestExecutionListener`: Initializes and closes mocks configured using `@MockitoBean` or `@MockitoSpyBean`.
* `DependencyInjectionTestExecutionListener`: Provides dependency injection for the test * `DependencyInjectionTestExecutionListener`: Provides dependency injection for the test
instance. instance.
* `MicrometerObservationRegistryTestExecutionListener`: Provides support for * `MicrometerObservationRegistryTestExecutionListener`: Provides support for
@ -24,6 +25,8 @@ by default, exactly in the following order:
annotation. annotation.
* `EventPublishingTestExecutionListener`: Publishes test execution events to the test's * `EventPublishingTestExecutionListener`: Publishes test execution events to the test's
`ApplicationContext` (see xref:testing/testcontext-framework/test-execution-events.adoc[Test Execution Events]). `ApplicationContext` (see xref:testing/testcontext-framework/test-execution-events.adoc[Test Execution Events]).
* `MockitoResetTestExecutionListener`: Resets mocks as configured by `@MockitoBean` or `@MockitoSpyBean`.
* `BeanOverrideTestExecutionListener`: Provides support for xref:testing/testcontext-framework/bean-overriding.adoc[] .
[[testcontext-tel-config-registering-tels]] [[testcontext-tel-config-registering-tels]]
== Registering `TestExecutionListener` Implementations == Registering `TestExecutionListener` Implementations

View File

@ -66,18 +66,26 @@ package org.springframework.test.context;
* DirtiesContextBeforeModesTestExecutionListener}</li> * DirtiesContextBeforeModesTestExecutionListener}</li>
* <li>{@link org.springframework.test.context.event.ApplicationEventsTestExecutionListener * <li>{@link org.springframework.test.context.event.ApplicationEventsTestExecutionListener
* ApplicationEventsTestExecutionListener}</li> * ApplicationEventsTestExecutionListener}</li>
* <li>{@link org.springframework.test.context.bean.override.mockito.MockitoTestExecutionListener
* MockitoTestExecutionListener}</li>
* <li>{@link org.springframework.test.context.support.DependencyInjectionTestExecutionListener * <li>{@link org.springframework.test.context.support.DependencyInjectionTestExecutionListener
* DependencyInjectionTestExecutionListener}</li> * DependencyInjectionTestExecutionListener}</li>
* <li>{@link org.springframework.test.context.observation.MicrometerObservationRegistryTestExecutionListener * <li>{@link org.springframework.test.context.observation.MicrometerObservationRegistryTestExecutionListener
* MicrometerObservationRegistryTestExecutionListener}</li> * MicrometerObservationRegistryTestExecutionListener}</li>
* <li>{@link org.springframework.test.context.support.DirtiesContextTestExecutionListener * <li>{@link org.springframework.test.context.support.DirtiesContextTestExecutionListener
* DirtiesContextTestExecutionListener}</li> * DirtiesContextTestExecutionListener}</li>
* <li>{@link org.springframework.test.context.support.CommonCachesTestExecutionListener
* CommonCachesTestExecutionListener}</li>
* <li>{@link org.springframework.test.context.transaction.TransactionalTestExecutionListener * <li>{@link org.springframework.test.context.transaction.TransactionalTestExecutionListener
* TransactionalTestExecutionListener}</li> * TransactionalTestExecutionListener}</li>
* <li>{@link org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener * <li>{@link org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener
* SqlScriptsTestExecutionListener}</li> * SqlScriptsTestExecutionListener}</li>
* <li>{@link org.springframework.test.context.event.EventPublishingTestExecutionListener * <li>{@link org.springframework.test.context.event.EventPublishingTestExecutionListener
* EventPublishingTestExecutionListener}</li> * EventPublishingTestExecutionListener}</li>
* <li>{@link org.springframework.test.context.bean.override.mockito.MockitoResetTestExecutionListener
* MockitoResetTestExecutionListener}</li>
* <li>{@link org.springframework.test.context.bean.override.BeanOverrideTestExecutionListener
* BeanOverrideTestExecutionListener}</li>
* </ul> * </ul>
* *
* @author Sam Brannen * @author Sam Brannen

View File

@ -82,11 +82,15 @@ public @interface TestExecutionListeners {
* @see org.springframework.test.context.web.ServletTestExecutionListener * @see org.springframework.test.context.web.ServletTestExecutionListener
* @see org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener * @see org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener
* @see org.springframework.test.context.event.ApplicationEventsTestExecutionListener * @see org.springframework.test.context.event.ApplicationEventsTestExecutionListener
* @see org.springframework.test.context.bean.override.mockito.MockitoTestExecutionListener
* @see org.springframework.test.context.support.DependencyInjectionTestExecutionListener * @see org.springframework.test.context.support.DependencyInjectionTestExecutionListener
* @see org.springframework.test.context.support.DirtiesContextTestExecutionListener * @see org.springframework.test.context.support.DirtiesContextTestExecutionListener
* @see org.springframework.test.context.support.CommonCachesTestExecutionListener
* @see org.springframework.test.context.transaction.TransactionalTestExecutionListener * @see org.springframework.test.context.transaction.TransactionalTestExecutionListener
* @see org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener * @see org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener
* @see org.springframework.test.context.event.EventPublishingTestExecutionListener * @see org.springframework.test.context.event.EventPublishingTestExecutionListener
* @see org.springframework.test.context.bean.override.mockito.MockitoResetTestExecutionListener
* @see org.springframework.test.context.bean.override.BeanOverrideTestExecutionListener
*/ */
@AliasFor("value") @AliasFor("value")
Class<? extends TestExecutionListener>[] listeners() default {}; Class<? extends TestExecutionListener>[] listeners() default {};