|
8 | 8 | /** |
9 | 9 | * Annotates static fields that reference rules or methods that return them. A field must be public, |
10 | 10 | * static, and a subtype of {@link org.junit.rules.TestRule}. A method must be public static, and return |
11 | | - * a subtype of {@link org.junit.rules.TestRule}.<p> |
12 | | - * |
| 11 | + * a subtype of {@link org.junit.rules.TestRule}. |
| 12 | + * <p> |
13 | 13 | * The {@link org.junit.runners.model.Statement} passed |
14 | 14 | * to the {@link org.junit.rules.TestRule} will run any {@link BeforeClass} methods, |
15 | 15 | * then the entire body of the test class (all contained methods, if it is |
16 | 16 | * a standard JUnit test class, or all contained classes, if it is a |
17 | 17 | * {@link org.junit.runners.Suite}), and finally any {@link AfterClass} methods. |
18 | | - * |
| 18 | + * <p> |
19 | 19 | * The statement passed to the {@link org.junit.rules.TestRule} will never throw an exception, |
20 | 20 | * and throwing an exception from the {@link org.junit.rules.TestRule} will result in undefined |
21 | 21 | * behavior. This means that some {@link org.junit.rules.TestRule}s, such as |
22 | 22 | * {@link org.junit.rules.ErrorCollector}, |
23 | 23 | * {@link org.junit.rules.ExpectedException}, |
24 | 24 | * and {@link org.junit.rules.Timeout}, |
25 | 25 | * have undefined behavior when used as {@link ClassRule}s. |
26 | | - * |
| 26 | + * <p> |
27 | 27 | * If there are multiple |
28 | 28 | * annotated {@link ClassRule}s on a class, they will be applied in an order |
29 | 29 | * that depends on your JVM's implementation of the reflection API, which is |
30 | 30 | * undefined, in general. However, Rules defined by fields will always be applied |
31 | 31 | * before Rules defined by methods. |
32 | | - * |
| 32 | + * <p> |
33 | 33 | * For example, here is a test suite that connects to a server once before |
34 | 34 | * all the test classes run, and disconnects after they are finished: |
35 | | - * |
36 | 35 | * <pre> |
37 | 36 | * @RunWith(Suite.class) |
38 | 37 | * @SuiteClasses({A.class, B.class, C.class}) |
|
53 | 52 | * }; |
54 | 53 | * } |
55 | 54 | * </pre> |
56 | | - * |
| 55 | + * <p> |
57 | 56 | * and the same using a method |
58 | | - * |
59 | 57 | * <pre> |
60 | 58 | * @RunWith(Suite.class) |
61 | 59 | * @SuiteClasses({A.class, B.class, C.class}) |
|
78 | 76 | * } |
79 | 77 | * } |
80 | 78 | * </pre> |
81 | | - * |
| 79 | + * <p> |
82 | 80 | * For more information and more examples, see {@link org.junit.rules.TestRule}. |
83 | 81 | * |
84 | 82 | * @since 4.9 |
|
0 commit comments