Skip to content

Commit 128e900

Browse files
remeiosbrannen
authored andcommitted
Document order values for TestExecutionListener implementations
Closes gh-34265 Signed-off-by: Mengqi Xu <[email protected]>
1 parent 16e3973 commit 128e900

10 files changed

+56
-10
lines changed

Diff for: spring-test/src/main/java/org/springframework/test/context/event/ApplicationEventsTestExecutionListener.java

+6-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,12 @@ public class ApplicationEventsTestExecutionListener extends AbstractTestExecutio
6161

6262

6363
/**
64-
* Returns {@code 1800}.
64+
* Returns {@code 1800}, which ensures that the {@code ApplicationEventsTestExecutionListener}
65+
* is ordered after the
66+
* {@link org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener
67+
* DirtiesContextBeforeModesTestExecutionListener} and just before the
68+
* {@link org.springframework.test.context.bean.override.BeanOverrideTestExecutionListener
69+
* BeanOverrideTestExecutionListener}.
6570
*/
6671
@Override
6772
public final int getOrder() {

Diff for: spring-test/src/main/java/org/springframework/test/context/event/EventPublishingTestExecutionListener.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,10 @@
9898
public class EventPublishingTestExecutionListener extends AbstractTestExecutionListener {
9999

100100
/**
101-
* Returns {@code 10000}.
101+
* Returns {@code 10000}, which ensures that the {@code EventPublishingTestExecutionListener}
102+
* is ordered after the
103+
* {@link org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener
104+
* SqlScriptsTestExecutionListener}.
102105
*/
103106
@Override
104107
public final int getOrder() {

Diff for: spring-test/src/main/java/org/springframework/test/context/jdbc/SqlScriptsTestExecutionListener.java

+6-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,12 @@ public class SqlScriptsTestExecutionListener extends AbstractTestExecutionListen
126126

127127

128128
/**
129-
* Returns {@code 5000}.
129+
* Returns {@code 5000}, which ensures that the {@code SqlScriptsTestExecutionListener}
130+
* is ordered after the
131+
* {@link org.springframework.test.context.transaction.TransactionalTestExecutionListener
132+
* TransactionalTestExecutionListener} and just before the
133+
* {@link org.springframework.test.context.event.EventPublishingTestExecutionListener
134+
* EventPublishingTestExecutionListener}.
130135
*/
131136
@Override
132137
public final int getOrder() {

Diff for: spring-test/src/main/java/org/springframework/test/context/observation/MicrometerObservationRegistryTestExecutionListener.java

+6-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,12 @@ public MicrometerObservationRegistryTestExecutionListener() {
107107

108108

109109
/**
110-
* Returns {@code 2500}.
110+
* Returns {@code 2500}, which ensures that the {@code MicrometerObservationRegistryTestExecutionListener}
111+
* is ordered after the
112+
* {@link org.springframework.test.context.support.DependencyInjectionTestExecutionListener
113+
* DependencyInjectionTestExecutionListener} and just before the
114+
* {@link org.springframework.test.context.support.DirtiesContextTestExecutionListener
115+
* DirtiesContextTestExecutionListener}.
111116
*/
112117
@Override
113118
public final int getOrder() {

Diff for: spring-test/src/main/java/org/springframework/test/context/support/CommonCachesTestExecutionListener.java

+6-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,12 @@
3636
public class CommonCachesTestExecutionListener extends AbstractTestExecutionListener {
3737

3838
/**
39-
* Returns {@code 3005}.
39+
* Returns {@code 3005}, which ensures that the {@code CommonCachesTestExecutionListener}
40+
* is ordered after the
41+
* {@link org.springframework.test.context.support.DirtiesContextTestExecutionListener
42+
* DirtiesContextTestExecutionListener} and just before the
43+
* {@link org.springframework.test.context.transaction.TransactionalTestExecutionListener
44+
* TransactionalTestExecutionListener}.
4045
*/
4146
@Override
4247
public final int getOrder() {

Diff for: spring-test/src/main/java/org/springframework/test/context/support/DependencyInjectionTestExecutionListener.java

+6-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,12 @@ public class DependencyInjectionTestExecutionListener extends AbstractTestExecut
6363

6464

6565
/**
66-
* Returns {@code 2000}.
66+
* Returns {@code 2000}, which ensures that the {@code ApplicationEventsTestExecutionListener}
67+
* is ordered after the
68+
* {@link org.springframework.test.context.bean.override.BeanOverrideTestExecutionListener
69+
* BeanOverrideTestExecutionListener} and just before the
70+
* {@link org.springframework.test.context.support.DirtiesContextTestExecutionListener
71+
* DirtiesContextTestExecutionListener}.
6772
*/
6873
@Override
6974
public final int getOrder() {

Diff for: spring-test/src/main/java/org/springframework/test/context/support/DirtiesContextBeforeModesTestExecutionListener.java

+6-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,12 @@
5555
public class DirtiesContextBeforeModesTestExecutionListener extends AbstractDirtiesContextTestExecutionListener {
5656

5757
/**
58-
* Returns {@code 1500}.
58+
* Returns {@code 1500}, which ensures that the {@code DirtiesContextBeforeModesTestExecutionListener}
59+
* is ordered after the
60+
* {@link org.springframework.test.context.web.ServletTestExecutionListener
61+
* ServletTestExecutionListener} and just before the
62+
* {@link org.springframework.test.context.bean.override.BeanOverrideTestExecutionListener
63+
* BeanOverrideTestExecutionListener}.
5964
*/
6065
@Override
6166
public final int getOrder() {

Diff for: spring-test/src/main/java/org/springframework/test/context/support/DirtiesContextTestExecutionListener.java

+6-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,12 @@
5555
public class DirtiesContextTestExecutionListener extends AbstractDirtiesContextTestExecutionListener {
5656

5757
/**
58-
* Returns {@code 3000}.
58+
* Returns {@code 3000}, which ensures that the {@code DirtiesContextTestExecutionListener}
59+
* is ordered after the
60+
* {@link org.springframework.test.context.support.DependencyInjectionTestExecutionListener
61+
* DependencyInjectionTestExecutionListener} and just before the
62+
* {@link org.springframework.test.context.support.CommonCachesTestExecutionListener
63+
* CommonCachesTestExecutionListener}.
5964
*/
6065
@Override
6166
public final int getOrder() {

Diff for: spring-test/src/main/java/org/springframework/test/context/transaction/TransactionalTestExecutionListener.java

+6-1
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,12 @@ private TransactionAttribute findTransactionAttributeInEnclosingClassHierarchy(C
177177

178178

179179
/**
180-
* Returns {@code 4000}.
180+
* Returns {@code 4000}, which ensures that the {@code TransactionalTestExecutionListener}
181+
* is ordered after the
182+
* {@link org.springframework.test.context.support.CommonCachesTestExecutionListener
183+
* CommonCachesTestExecutionListener} and just before the
184+
* {@link org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener
185+
* SqlScriptsTestExecutionListener}.
181186
*/
182187
@Override
183188
public final int getOrder() {

Diff for: spring-test/src/main/java/org/springframework/test/context/web/ServletTestExecutionListener.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,10 @@ public class ServletTestExecutionListener extends AbstractTestExecutionListener
110110

111111

112112
/**
113-
* Returns {@code 1000}.
113+
* Returns {@code 1000}, which ensures that the {@code ServletTestExecutionListener}
114+
* is ordered before the
115+
* {@link org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener
116+
* DirtiesContextBeforeModesTestExecutionListener}.
114117
*/
115118
@Override
116119
public final int getOrder() {

0 commit comments

Comments
 (0)