diff --git a/spring-test/src/main/java/org/springframework/test/context/junit4/AbstractJUnit4SpringContextTests.java b/spring-test/src/main/java/org/springframework/test/context/junit4/AbstractJUnit4SpringContextTests.java index 3b88316825..a80ae973ff 100644 --- a/spring-test/src/main/java/org/springframework/test/context/junit4/AbstractJUnit4SpringContextTests.java +++ b/spring-test/src/main/java/org/springframework/test/context/junit4/AbstractJUnit4SpringContextTests.java @@ -27,6 +27,7 @@ import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.TestContext; import org.springframework.test.context.TestContextManager; import org.springframework.test.context.TestExecutionListeners; +import org.springframework.test.context.event.EventPublishingTestExecutionListener; import org.springframework.test.context.support.DependencyInjectionTestExecutionListener; import org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener; import org.springframework.test.context.support.DirtiesContextTestExecutionListener; @@ -55,6 +56,7 @@ import org.springframework.test.context.web.ServletTestExecutionListener; *
This class serves only as a convenience for extension. @@ -82,12 +84,14 @@ import org.springframework.test.context.web.ServletTestExecutionListener; * @see DirtiesContextBeforeModesTestExecutionListener * @see DependencyInjectionTestExecutionListener * @see DirtiesContextTestExecutionListener + * @see EventPublishingTestExecutionListener * @see AbstractTransactionalJUnit4SpringContextTests * @see org.springframework.test.context.testng.AbstractTestNGSpringContextTests */ @RunWith(SpringRunner.class) @TestExecutionListeners({ ServletTestExecutionListener.class, DirtiesContextBeforeModesTestExecutionListener.class, - DependencyInjectionTestExecutionListener.class, DirtiesContextTestExecutionListener.class }) + DependencyInjectionTestExecutionListener.class, DirtiesContextTestExecutionListener.class, + EventPublishingTestExecutionListener.class }) public abstract class AbstractJUnit4SpringContextTests implements ApplicationContextAware { /** diff --git a/spring-test/src/main/java/org/springframework/test/context/junit4/AbstractTransactionalJUnit4SpringContextTests.java b/spring-test/src/main/java/org/springframework/test/context/junit4/AbstractTransactionalJUnit4SpringContextTests.java index 5dc4b817a1..4e4f9faf6d 100644 --- a/spring-test/src/main/java/org/springframework/test/context/junit4/AbstractTransactionalJUnit4SpringContextTests.java +++ b/spring-test/src/main/java/org/springframework/test/context/junit4/AbstractTransactionalJUnit4SpringContextTests.java @@ -27,8 +27,13 @@ import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator; import org.springframework.lang.Nullable; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.TestExecutionListeners; +import org.springframework.test.context.event.EventPublishingTestExecutionListener; import org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener; +import org.springframework.test.context.support.DependencyInjectionTestExecutionListener; +import org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener; +import org.springframework.test.context.support.DirtiesContextTestExecutionListener; import org.springframework.test.context.transaction.TransactionalTestExecutionListener; +import org.springframework.test.context.web.ServletTestExecutionListener; import org.springframework.test.jdbc.JdbcTestUtils; import org.springframework.transaction.PlatformTransactionManager; import org.springframework.transaction.annotation.Transactional; @@ -61,6 +66,7 @@ import org.springframework.util.Assert; *
This class serves only as a convenience for extension. @@ -94,7 +100,10 @@ import org.springframework.util.Assert; * @see org.springframework.test.jdbc.JdbcTestUtils * @see org.springframework.test.context.testng.AbstractTransactionalTestNGSpringContextTests */ -@TestExecutionListeners({TransactionalTestExecutionListener.class, SqlScriptsTestExecutionListener.class}) +@TestExecutionListeners(listeners = { ServletTestExecutionListener.class, + DirtiesContextBeforeModesTestExecutionListener.class, DependencyInjectionTestExecutionListener.class, + DirtiesContextTestExecutionListener.class, TransactionalTestExecutionListener.class, + SqlScriptsTestExecutionListener.class, EventPublishingTestExecutionListener.class }, inheritListeners = false) @Transactional public abstract class AbstractTransactionalJUnit4SpringContextTests extends AbstractJUnit4SpringContextTests { diff --git a/spring-test/src/main/java/org/springframework/test/context/testng/AbstractTestNGSpringContextTests.java b/spring-test/src/main/java/org/springframework/test/context/testng/AbstractTestNGSpringContextTests.java index bc3609c966..ac9e1592bb 100644 --- a/spring-test/src/main/java/org/springframework/test/context/testng/AbstractTestNGSpringContextTests.java +++ b/spring-test/src/main/java/org/springframework/test/context/testng/AbstractTestNGSpringContextTests.java @@ -36,6 +36,7 @@ import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.TestContext; import org.springframework.test.context.TestContextManager; import org.springframework.test.context.TestExecutionListeners; +import org.springframework.test.context.event.EventPublishingTestExecutionListener; import org.springframework.test.context.support.DependencyInjectionTestExecutionListener; import org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener; import org.springframework.test.context.support.DirtiesContextTestExecutionListener; @@ -65,6 +66,7 @@ import org.springframework.test.context.web.ServletTestExecutionListener; *