Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update and improve ordering language in documentation. #1779

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions src/main/java/org/junit/Rule.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,7 @@
* The {@link org.junit.runners.model.Statement} passed
* to the {@link org.junit.rules.TestRule} will run any {@link Before} methods,
* then the {@link Test} method, and finally any {@link After} methods,
* throwing an exception if any of these fail. If there are multiple
* annotated {@link Rule}s on a class, they will be applied in order of methods first, then fields.
* However, if there are multiple fields (or methods) they will be applied in an order
* that depends on your JVM's implementation of the reflection API, which is
* undefined, in general. Rules defined by fields will always be applied
* after Rules defined by methods, i.e. the Statements returned by the former will
* be executed around those returned by the latter.
* throwing an exception if any of these fail.
*
* <h3>Usage</h3>
* <p>
Expand Down Expand Up @@ -65,8 +59,11 @@
*
* <h3>Ordering</h3>
* <p>
* You can use {@link #order()} if you want to have control over the order in
* which the Rules are applied.
* You can use {@link #order()} (default = -1) if you want control over the order in which the
* Rules are applied. Rules with the lowest {@link #order()} value will be applied first. If
* multiple rules have the same {@link #order()} then those implemented as methods will be applied
* before those implemented as fields, with the ordering within those groups dependant on your JVM's
* implementation of the reflection API (generally undefined).
*
* <pre>
* public class ThreeRules {
Expand Down