Merge branch '6.2.x'
This commit is contained in:
commit
85855ec793
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2024 the original author or authors.
|
||||
* Copyright 2002-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -389,8 +389,8 @@ public class TestContextManager {
|
|||
* have executed, the first caught exception will be rethrown with any
|
||||
* subsequent exceptions {@linkplain Throwable#addSuppressed suppressed} in
|
||||
* the first exception.
|
||||
* <p>Note that registered listeners will be executed in the opposite
|
||||
* order in which they were registered.
|
||||
* <p>Note that listeners will be executed in the opposite order in which they
|
||||
* were registered.
|
||||
* @param testInstance the current test instance
|
||||
* @param testMethod the test method which has just been executed on the
|
||||
* test instance
|
||||
|
|
@ -459,7 +459,8 @@ public class TestContextManager {
|
|||
* have executed, the first caught exception will be rethrown with any
|
||||
* subsequent exceptions {@linkplain Throwable#addSuppressed suppressed} in
|
||||
* the first exception.
|
||||
* <p>Note that registered listeners will be executed in the opposite
|
||||
* <p>Note that listeners will be executed in the opposite order in which they
|
||||
* were registered.
|
||||
* @param testInstance the current test instance
|
||||
* @param testMethod the test method which has just been executed on the
|
||||
* test instance
|
||||
|
|
@ -517,7 +518,8 @@ public class TestContextManager {
|
|||
* have executed, the first caught exception will be rethrown with any
|
||||
* subsequent exceptions {@linkplain Throwable#addSuppressed suppressed} in
|
||||
* the first exception.
|
||||
* <p>Note that registered listeners will be executed in the opposite
|
||||
* <p>Note that listeners will be executed in the opposite order in which they
|
||||
* were registered.
|
||||
* @throws Exception if a registered TestExecutionListener throws an exception
|
||||
* @since 3.0
|
||||
* @see #getTestExecutionListeners()
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2024 the original author or authors.
|
||||
* Copyright 2002-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -37,15 +37,21 @@ import org.springframework.test.context.support.DependencyInjectionTestExecution
|
|||
public class BeanOverrideTestExecutionListener extends AbstractTestExecutionListener {
|
||||
|
||||
/**
|
||||
* Returns {@code 1950}, which ensures that the {@code BeanOverrideTestExecutionListener}
|
||||
* The {@link #getOrder() order} value for this listener: {@value}.
|
||||
* @since 6.2.3
|
||||
*/
|
||||
public static final int ORDER = 1950;
|
||||
|
||||
/**
|
||||
* Returns {@value #ORDER}, which ensures that the {@code BeanOverrideTestExecutionListener}
|
||||
* is ordered after the
|
||||
* {@link org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener
|
||||
* DirtiesContextBeforeModesTestExecutionListener} and just before the
|
||||
* DirtiesContextBeforeModesTestExecutionListener} and before the
|
||||
* {@link DependencyInjectionTestExecutionListener}.
|
||||
*/
|
||||
@Override
|
||||
public int getOrder() {
|
||||
return 1950;
|
||||
return ORDER;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -49,6 +49,13 @@ import org.springframework.util.ClassUtils;
|
|||
*/
|
||||
public class MockitoResetTestExecutionListener extends AbstractTestExecutionListener {
|
||||
|
||||
/**
|
||||
* The {@link #getOrder() order} value for this listener
|
||||
* ({@code Ordered.LOWEST_PRECEDENCE - 100}): {@value}.
|
||||
* @since 6.2.3
|
||||
*/
|
||||
public static final int ORDER = Ordered.LOWEST_PRECEDENCE - 100;
|
||||
|
||||
private static final Log logger = LogFactory.getLog(MockitoResetTestExecutionListener.class);
|
||||
|
||||
/**
|
||||
|
|
@ -73,7 +80,10 @@ public class MockitoResetTestExecutionListener extends AbstractTestExecutionList
|
|||
|
||||
|
||||
/**
|
||||
* Returns {@code Ordered.LOWEST_PRECEDENCE - 100}.
|
||||
* Returns {@value #ORDER}, which ensures that the
|
||||
* {@code MockitoResetTestExecutionListener} is ordered after all standard
|
||||
* {@code TestExecutionListener} implementations.
|
||||
* @see #ORDER
|
||||
*/
|
||||
@Override
|
||||
public int getOrder() {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
* Copyright 2002-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -48,6 +48,12 @@ import org.springframework.util.Assert;
|
|||
*/
|
||||
public class ApplicationEventsTestExecutionListener extends AbstractTestExecutionListener {
|
||||
|
||||
/**
|
||||
* The {@link #getOrder() order} value for this listener: {@value}.
|
||||
* @since 6.2.3
|
||||
*/
|
||||
public static final int ORDER = 1800;
|
||||
|
||||
/**
|
||||
* Attribute name for a {@link TestContext} attribute which indicates
|
||||
* whether the test class for the given test context is annotated with
|
||||
|
|
@ -61,11 +67,18 @@ public class ApplicationEventsTestExecutionListener extends AbstractTestExecutio
|
|||
|
||||
|
||||
/**
|
||||
* Returns {@code 1800}.
|
||||
* Returns {@value #ORDER}, which ensures that the {@code ApplicationEventsTestExecutionListener}
|
||||
* is ordered after the
|
||||
* {@link org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener
|
||||
* DirtiesContextBeforeModesTestExecutionListener} and before the
|
||||
* {@link org.springframework.test.context.bean.override.BeanOverrideTestExecutionListener
|
||||
* BeanOverrideTestExecutionListener} and the
|
||||
* {@link org.springframework.test.context.support.DependencyInjectionTestExecutionListener
|
||||
* DependencyInjectionTestExecutionListener}.
|
||||
*/
|
||||
@Override
|
||||
public final int getOrder() {
|
||||
return 1800;
|
||||
return ORDER;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
* Copyright 2002-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -98,11 +98,22 @@ import org.springframework.test.context.support.AbstractTestExecutionListener;
|
|||
public class EventPublishingTestExecutionListener extends AbstractTestExecutionListener {
|
||||
|
||||
/**
|
||||
* Returns {@code 10000}.
|
||||
* The {@link #getOrder() order} value for this listener: {@value}.
|
||||
* @since 6.2.3
|
||||
*/
|
||||
public static final int ORDER = 10_000;
|
||||
|
||||
/**
|
||||
* Returns {@value #ORDER}, which ensures that the {@code EventPublishingTestExecutionListener}
|
||||
* is ordered after the
|
||||
* {@link org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener
|
||||
* SqlScriptsTestExecutionListener} and before the
|
||||
* {@link org.springframework.test.context.bean.override.mockito.MockitoResetTestExecutionListener
|
||||
* MockitoResetTestExecutionListener}.
|
||||
*/
|
||||
@Override
|
||||
public final int getOrder() {
|
||||
return 10_000;
|
||||
return ORDER;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2024 the original author or authors.
|
||||
* Copyright 2002-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -117,6 +117,12 @@ import static org.springframework.util.ResourceUtils.CLASSPATH_URL_PREFIX;
|
|||
*/
|
||||
public class SqlScriptsTestExecutionListener extends AbstractTestExecutionListener implements AotTestExecutionListener {
|
||||
|
||||
/**
|
||||
* The {@link #getOrder() order} value for this listener: {@value}.
|
||||
* @since 6.2.3
|
||||
*/
|
||||
public static final int ORDER = 5000;
|
||||
|
||||
private static final String SLASH = "/";
|
||||
|
||||
private static final Log logger = LogFactory.getLog(SqlScriptsTestExecutionListener.class);
|
||||
|
|
@ -126,11 +132,16 @@ public class SqlScriptsTestExecutionListener extends AbstractTestExecutionListen
|
|||
|
||||
|
||||
/**
|
||||
* Returns {@code 5000}.
|
||||
* Returns {@value #ORDER}, which ensures that the {@code SqlScriptsTestExecutionListener}
|
||||
* is ordered after the
|
||||
* {@link org.springframework.test.context.transaction.TransactionalTestExecutionListener
|
||||
* TransactionalTestExecutionListener} and before the
|
||||
* {@link org.springframework.test.context.event.EventPublishingTestExecutionListener
|
||||
* EventPublishingTestExecutionListener}.
|
||||
*/
|
||||
@Override
|
||||
public final int getOrder() {
|
||||
return 5000;
|
||||
return ORDER;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2024 the original author or authors.
|
||||
* Copyright 2002-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -44,6 +44,12 @@ import org.springframework.util.ReflectionUtils;
|
|||
*/
|
||||
class MicrometerObservationRegistryTestExecutionListener extends AbstractTestExecutionListener {
|
||||
|
||||
/**
|
||||
* The {@link #getOrder() order} value for this listener: {@value}.
|
||||
* @since 6.2.3
|
||||
*/
|
||||
public static final int ORDER = 2500;
|
||||
|
||||
private static final Log logger = LogFactory.getLog(MicrometerObservationRegistryTestExecutionListener.class);
|
||||
|
||||
/**
|
||||
|
|
@ -106,11 +112,16 @@ class MicrometerObservationRegistryTestExecutionListener extends AbstractTestExe
|
|||
|
||||
|
||||
/**
|
||||
* Returns {@code 2500}.
|
||||
* Returns {@value #ORDER}, which ensures that the
|
||||
* {@code MicrometerObservationRegistryTestExecutionListener} is ordered after the
|
||||
* {@link org.springframework.test.context.support.DependencyInjectionTestExecutionListener
|
||||
* DependencyInjectionTestExecutionListener} and before the
|
||||
* {@link org.springframework.test.context.support.DirtiesContextTestExecutionListener
|
||||
* DirtiesContextTestExecutionListener}.
|
||||
*/
|
||||
@Override
|
||||
public final int getOrder() {
|
||||
return 2500;
|
||||
return ORDER;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2024 the original author or authors.
|
||||
* Copyright 2002-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -36,14 +36,24 @@ import org.springframework.test.context.TestContext;
|
|||
public class CommonCachesTestExecutionListener extends AbstractTestExecutionListener {
|
||||
|
||||
/**
|
||||
* Returns {@code 3005}.
|
||||
* The {@link #getOrder() order} value for this listener: {@value}.
|
||||
* @since 6.2.3
|
||||
*/
|
||||
public static final int ORDER = 3005;
|
||||
|
||||
|
||||
/**
|
||||
* Returns {@value #ORDER}, which ensures that the {@code CommonCachesTestExecutionListener}
|
||||
* is ordered after the
|
||||
* {@link DirtiesContextTestExecutionListener DirtiesContextTestExecutionListener} and before the
|
||||
* {@link org.springframework.test.context.transaction.TransactionalTestExecutionListener
|
||||
* TransactionalTestExecutionListener}.
|
||||
*/
|
||||
@Override
|
||||
public final int getOrder() {
|
||||
return 3005;
|
||||
return ORDER;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void afterTestClass(TestContext testContext) throws Exception {
|
||||
if (testContext.hasApplicationContext()) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2024 the original author or authors.
|
||||
* Copyright 2002-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -39,6 +39,12 @@ import org.springframework.test.context.aot.AotTestContextInitializers;
|
|||
*/
|
||||
public class DependencyInjectionTestExecutionListener extends AbstractTestExecutionListener {
|
||||
|
||||
/**
|
||||
* The {@link #getOrder() order} value for this listener: {@value}.
|
||||
* @since 6.2.3
|
||||
*/
|
||||
public static final int ORDER = 2000;
|
||||
|
||||
/**
|
||||
* Attribute name for a {@link TestContext} attribute which indicates
|
||||
* whether the dependencies of a test instance should be
|
||||
|
|
@ -63,11 +69,18 @@ public class DependencyInjectionTestExecutionListener extends AbstractTestExecut
|
|||
|
||||
|
||||
/**
|
||||
* Returns {@code 2000}.
|
||||
* Returns {@value #ORDER}, which ensures that the {@code DependencyInjectionTestExecutionListener}
|
||||
* is ordered after the
|
||||
* {@link DirtiesContextBeforeModesTestExecutionListener DirtiesContextBeforeModesTestExecutionListener}
|
||||
* and the {@link org.springframework.test.context.bean.override.BeanOverrideTestExecutionListener
|
||||
* BeanOverrideTestExecutionListener} and before the
|
||||
* {@link org.springframework.test.context.observation.MicrometerObservationRegistryTestExecutionListener
|
||||
* MicrometerObservationRegistryTestExecutionListener} and the
|
||||
* {@link DirtiesContextTestExecutionListener DirtiesContextTestExecutionListener}.
|
||||
*/
|
||||
@Override
|
||||
public final int getOrder() {
|
||||
return 2000;
|
||||
return ORDER;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
* Copyright 2002-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -55,11 +55,24 @@ import static org.springframework.test.annotation.DirtiesContext.MethodMode.BEFO
|
|||
public class DirtiesContextBeforeModesTestExecutionListener extends AbstractDirtiesContextTestExecutionListener {
|
||||
|
||||
/**
|
||||
* Returns {@code 1500}.
|
||||
* The {@link #getOrder() order} value for this listener: {@value}.
|
||||
* @since 6.2.3
|
||||
*/
|
||||
public static final int ORDER = 1500;
|
||||
|
||||
/**
|
||||
* Returns {@value #ORDER}, which ensures that the
|
||||
* {@code DirtiesContextBeforeModesTestExecutionListener} is ordered after the
|
||||
* {@link org.springframework.test.context.web.ServletTestExecutionListener
|
||||
* ServletTestExecutionListener} and before the
|
||||
* {@link org.springframework.test.context.event.ApplicationEventsTestExecutionListener
|
||||
* ApplicationEventsTestExecutionListener} and the
|
||||
* {@link org.springframework.test.context.bean.override.BeanOverrideTestExecutionListener
|
||||
* BeanOverrideTestExecutionListener}.
|
||||
*/
|
||||
@Override
|
||||
public final int getOrder() {
|
||||
return 1500;
|
||||
return ORDER;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
* Copyright 2002-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -55,11 +55,20 @@ import static org.springframework.test.annotation.DirtiesContext.MethodMode.AFTE
|
|||
public class DirtiesContextTestExecutionListener extends AbstractDirtiesContextTestExecutionListener {
|
||||
|
||||
/**
|
||||
* Returns {@code 3000}.
|
||||
* The {@link #getOrder() order} value for this listener: {@value}.
|
||||
* @since 6.2.3
|
||||
*/
|
||||
public static final int ORDER = 3000;
|
||||
|
||||
/**
|
||||
* Returns {@value #ORDER}, which ensures that the {@code DirtiesContextTestExecutionListener}
|
||||
* is ordered after the
|
||||
* {@link DependencyInjectionTestExecutionListener DependencyInjectionTestExecutionListener}
|
||||
* and before the {@link CommonCachesTestExecutionListener CommonCachesTestExecutionListener}.
|
||||
*/
|
||||
@Override
|
||||
public final int getOrder() {
|
||||
return 3000;
|
||||
return ORDER;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2023 the original author or authors.
|
||||
* Copyright 2002-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -148,6 +148,12 @@ import org.springframework.util.StringUtils;
|
|||
*/
|
||||
public class TransactionalTestExecutionListener extends AbstractTestExecutionListener {
|
||||
|
||||
/**
|
||||
* The {@link #getOrder() order} value for this listener: {@value}.
|
||||
* @since 6.2.3
|
||||
*/
|
||||
public static final int ORDER = 4000;
|
||||
|
||||
private static final Log logger = LogFactory.getLog(TransactionalTestExecutionListener.class);
|
||||
|
||||
// Do not require @Transactional test methods to be public.
|
||||
|
|
@ -175,11 +181,16 @@ public class TransactionalTestExecutionListener extends AbstractTestExecutionLis
|
|||
|
||||
|
||||
/**
|
||||
* Returns {@code 4000}.
|
||||
* Returns {@value #ORDER}, which ensures that the {@code TransactionalTestExecutionListener}
|
||||
* is ordered after the
|
||||
* {@link org.springframework.test.context.support.CommonCachesTestExecutionListener
|
||||
* CommonCachesTestExecutionListener} and before the
|
||||
* {@link org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener
|
||||
* SqlScriptsTestExecutionListener}.
|
||||
*/
|
||||
@Override
|
||||
public final int getOrder() {
|
||||
return 4000;
|
||||
return ORDER;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
* Copyright 2002-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -64,6 +64,12 @@ import org.springframework.web.context.request.ServletWebRequest;
|
|||
*/
|
||||
public class ServletTestExecutionListener extends AbstractTestExecutionListener {
|
||||
|
||||
/**
|
||||
* The {@link #getOrder() order} value for this listener: {@value}.
|
||||
* @since 6.2.3
|
||||
*/
|
||||
public static final int ORDER = 1000;
|
||||
|
||||
/**
|
||||
* Attribute name for a {@link TestContext} attribute which indicates
|
||||
* whether the {@code ServletTestExecutionListener} should {@linkplain
|
||||
|
|
@ -110,11 +116,14 @@ public class ServletTestExecutionListener extends AbstractTestExecutionListener
|
|||
|
||||
|
||||
/**
|
||||
* Returns {@code 1000}.
|
||||
* Returns {@value #ORDER}, which ensures that the {@code ServletTestExecutionListener}
|
||||
* is ordered before the
|
||||
* {@link org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener
|
||||
* DirtiesContextBeforeModesTestExecutionListener}.
|
||||
*/
|
||||
@Override
|
||||
public final int getOrder() {
|
||||
return 1000;
|
||||
return ORDER;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue