diff options
Diffstat (limited to 'src/main/java/org/junit/rules/TestRule.java')
-rw-r--r-- | src/main/java/org/junit/rules/TestRule.java | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/src/main/java/org/junit/rules/TestRule.java b/src/main/java/org/junit/rules/TestRule.java index b7760c4..53e2f70 100644 --- a/src/main/java/org/junit/rules/TestRule.java +++ b/src/main/java/org/junit/rules/TestRule.java @@ -9,16 +9,16 @@ import org.junit.runners.model.Statement; * a test that would otherwise fail to pass, or it may perform necessary setup or * cleanup for tests, or it may observe test execution to report it elsewhere. * {@link TestRule}s can do everything that could be done previously with - * methods annotated with {@link org.junit.Before}, - * {@link org.junit.After}, {@link org.junit.BeforeClass}, or - * {@link org.junit.AfterClass}, but they are more powerful, and more easily + * methods annotated with {@link org.junit.Before}, + * {@link org.junit.After}, {@link org.junit.BeforeClass}, or + * {@link org.junit.AfterClass}, but they are more powerful, and more easily * shared * between projects and classes. - * + * * The default JUnit test runners for suites and * individual test cases recognize {@link TestRule}s introduced in two different - * ways. {@link org.junit.Rule} annotates method-level - * {@link TestRule}s, and {@link org.junit.ClassRule} + * ways. {@link org.junit.Rule} annotates method-level + * {@link TestRule}s, and {@link org.junit.ClassRule} * annotates class-level {@link TestRule}s. See Javadoc for those annotations * for more information. * @@ -28,7 +28,7 @@ import org.junit.runners.model.Statement; * {@link Statement}, which is passed to the next {@link org.junit.Rule}, if any. For * examples of how this can be useful, see these provided TestRules, * or write your own: - * + * * <ul> * <li>{@link ErrorCollector}: collect multiple errors in one test method</li> * <li>{@link ExpectedException}: make flexible assertions about thrown exceptions</li> @@ -39,16 +39,18 @@ import org.junit.runners.model.Statement; * <li>{@link Timeout}: cause test to fail after a set time</li> * <li>{@link Verifier}: fail test if object state ends up incorrect</li> * </ul> + * + * @since 4.9 */ public interface TestRule { - /** - * Modifies the method-running {@link Statement} to implement this - * test-running rule. - * - * @param base The {@link Statement} to be modified - * @param description A {@link Description} of the test implemented in {@code base} - * @return a new statement, which may be the same as {@code base}, - * a wrapper around {@code base}, or a completely new Statement. - */ - Statement apply(Statement base, Description description); + /** + * Modifies the method-running {@link Statement} to implement this + * test-running rule. + * + * @param base The {@link Statement} to be modified + * @param description A {@link Description} of the test implemented in {@code base} + * @return a new statement, which may be the same as {@code base}, + * a wrapper around {@code base}, or a completely new Statement. + */ + Statement apply(Statement base, Description description); } |