From fd008405a1f9bd1fef755d7e0aa5bb48895f0c73 Mon Sep 17 00:00:00 2001 From: Sam Brannen Date: Thu, 14 Jul 2016 15:46:54 +0200 Subject: [PATCH] Note in TEL: before/after test exec. callbacks don't work w/ JUnit 4 rules Issue: SPR-4365 --- .../test/context/TestExecutionListener.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/spring-test/src/main/java/org/springframework/test/context/TestExecutionListener.java b/spring-test/src/main/java/org/springframework/test/context/TestExecutionListener.java index c2c7153700..7c0b64426e 100644 --- a/spring-test/src/main/java/org/springframework/test/context/TestExecutionListener.java +++ b/spring-test/src/main/java/org/springframework/test/context/TestExecutionListener.java @@ -21,6 +21,12 @@ package org.springframework.test.context; * test execution events published by the {@link TestContextManager} with which * the listener is registered. * + *

Note that not all testing frameworks support all lifecycle callbacks defined + * in this API. For example, {@link #beforeTestExecution} and + * {@link #afterTestExecution} are not supported in conjunction with JUnit 4 when + * using the {@link org.springframework.test.context.junit4.rules.SpringMethodRule + * SpringMethodRule}. + * *

This interface provides empty {@code default} implementations for all methods. * Concrete implementations can therefore choose to override only those methods * suitable for the task at hand. @@ -65,8 +71,6 @@ public interface TestExecutionListener { * the class. *

This method should be called immediately before framework-specific * before class lifecycle callbacks. - *

If a given testing framework does not support before class - * lifecycle callbacks, this method will not be called for that framework. *

The default implementation is empty. Can be overridden by * concrete classes as necessary. * @param testContext the test context for the test; never {@code null} @@ -186,8 +190,6 @@ public interface TestExecutionListener { * the class. *

This method should be called immediately after framework-specific * after class lifecycle callbacks. - *

If a given testing framework does not support after class - * lifecycle callbacks, this method will not be called for that framework. *

The default implementation is empty. Can be overridden by * concrete classes as necessary. * @param testContext the test context for the test; never {@code null}