Skip to content

Commit 0fd94f1

Browse files
committed
Polishing
1 parent 2472126 commit 0fd94f1

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

framework-docs/modules/ROOT/pages/testing/testcontext-framework/tel-config.adoc

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,17 @@ by default, exactly in the following order:
77
* `ServletTestExecutionListener`: Configures Servlet API mocks for a
88
`WebApplicationContext`.
99
* `DirtiesContextBeforeModesTestExecutionListener`: Handles the `@DirtiesContext`
10-
annotation for "`before`" modes.
10+
annotation for "before" modes.
1111
* `ApplicationEventsTestExecutionListener`: Provides support for
1212
xref:testing/testcontext-framework/application-events.adoc[`ApplicationEvents`].
13-
* `BeanOverrideTestExecutionListener`: Provides support for xref:testing/testcontext-framework/bean-overriding.adoc[] .
13+
* `BeanOverrideTestExecutionListener`: Provides support for
14+
xref:testing/testcontext-framework/bean-overriding.adoc[].
1415
* `DependencyInjectionTestExecutionListener`: Provides dependency injection for the test
1516
instance.
1617
* `MicrometerObservationRegistryTestExecutionListener`: Provides support for
1718
Micrometer's `ObservationRegistry`.
1819
* `DirtiesContextTestExecutionListener`: Handles the `@DirtiesContext` annotation for
19-
"`after`" modes.
20+
"after" modes.
2021
* `CommonCachesTestExecutionListener`: Clears resource caches in the test's
2122
`ApplicationContext` if necessary.
2223
* `TransactionalTestExecutionListener`: Provides transactional test execution with
@@ -161,15 +162,16 @@ change from release to release -- for example, `SqlScriptsTestExecutionListener`
161162
introduced in Spring Framework 4.1, and `DirtiesContextBeforeModesTestExecutionListener`
162163
was introduced in Spring Framework 4.2. Furthermore, third-party frameworks like Spring
163164
Boot and Spring Security register their own default `TestExecutionListener`
164-
implementations by using the aforementioned xref:testing/testcontext-framework/tel-config.adoc#testcontext-tel-config-automatic-discovery[automatic discovery mechanism]
165-
.
165+
implementations by using the aforementioned
166+
xref:testing/testcontext-framework/tel-config.adoc#testcontext-tel-config-automatic-discovery[automatic discovery mechanism].
166167

167168
To avoid having to be aware of and re-declare all default listeners, you can set the
168169
`mergeMode` attribute of `@TestExecutionListeners` to `MergeMode.MERGE_WITH_DEFAULTS`.
169170
`MERGE_WITH_DEFAULTS` indicates that locally declared listeners should be merged with the
170171
default listeners. The merging algorithm ensures that duplicates are removed from the
171172
list and that the resulting set of merged listeners is sorted according to the semantics
172-
of `AnnotationAwareOrderComparator`, as described in xref:testing/testcontext-framework/tel-config.adoc#testcontext-tel-config-ordering[Ordering `TestExecutionListener` Implementations].
173+
of `AnnotationAwareOrderComparator`, as described in
174+
xref:testing/testcontext-framework/tel-config.adoc#testcontext-tel-config-ordering[Ordering `TestExecutionListener` Implementations].
173175
If a listener implements `Ordered` or is annotated with `@Order`, it can influence the
174176
position in which it is merged with the defaults. Otherwise, locally declared listeners
175177
are appended to the list of default listeners when merged.

spring-test/src/main/java/org/springframework/test/context/TestExecutionListener.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2023 the original author or authors.
2+
* Copyright 2002-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -22,8 +22,9 @@
2222
* the listener is registered.
2323
*
2424
* <p>Note that not all testing frameworks support all lifecycle callbacks defined
25-
* in this API. For example, {@link #beforeTestExecution} and
26-
* {@link #afterTestExecution} are not supported in conjunction with JUnit 4 when
25+
* in this API. For example, the {@link #beforeTestExecution(TestContext)
26+
* beforeTestExecution} and {@link #afterTestExecution(TestContext)
27+
* afterTestExecution} callbacks are not supported in conjunction with JUnit 4 when
2728
* using the {@link org.springframework.test.context.junit4.rules.SpringMethodRule
2829
* SpringMethodRule}.
2930
*

0 commit comments

Comments
 (0)