Skip to content

Commit 7f8aace

Browse files
committed
Update and improve ordering language in documentation.
The intro to ordering didn't mention the order argument, likely it was written before the option was added. This CL moves all the language into the ordering section and improves the conciceness of the information.
1 parent ed47b7f commit 7f8aace

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

src/main/java/org/junit/Rule.java

+6-9
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,7 @@
1515
* The {@link org.junit.runners.model.Statement} passed
1616
* to the {@link org.junit.rules.TestRule} will run any {@link Before} methods,
1717
* then the {@link Test} method, and finally any {@link After} methods,
18-
* throwing an exception if any of these fail. If there are multiple
19-
* annotated {@link Rule}s on a class, they will be applied in order of methods first, then fields.
20-
* However, if there are multiple fields (or methods) they will be applied in an order
21-
* that depends on your JVM's implementation of the reflection API, which is
22-
* undefined, in general. Rules defined by fields will always be applied
23-
* after Rules defined by methods, i.e. the Statements returned by the former will
24-
* be executed around those returned by the latter.
18+
* throwing an exception if any of these fail.
2519
*
2620
* <h3>Usage</h3>
2721
* <p>
@@ -65,8 +59,11 @@
6559
*
6660
* <h3>Ordering</h3>
6761
* <p>
68-
* You can use {@link #order()} if you want to have control over the order in
69-
* which the Rules are applied.
62+
* You can use {@link #order()} (default = -1) if you want control over the order in which the
63+
* Rules are applied. Rules with the lowest {@link #order()} value will be applied first. If
64+
* multiple rules have the same {@link #order()} then those implemented as methods will be applied
65+
* before those implemented as fields, with the ordering within groups dependant on your JVM's
66+
* implementation of the reflection API (generally undefined).
7067
*
7168
* <pre>
7269
* public class ThreeRules {

0 commit comments

Comments
 (0)