Open cpovirk opened 2 years ago
Since 4.13 the recommended way is using the order
attribute of the @Rule
annotation.
It's described in the Ordering section in bottom of the javadoc.
The sentence you linked is quite old and potentially needs an update :-)
My understanding is that https://github.com/junit-team/junit4/commit/c75dcc28810aeb1c918ee7430981b31f41742ea7#diff-f35409420f2540415a9878beaf5a537248f301b6c683bb87a11016be3c9dc8b8R55 caused JUnit to begin processing
@Rule
fields in a defined order. The@Rule
Javadoc, however, still states that the order is defined by the JVM's reflection API.It would be good to know whether the intent is to commit to this order or not. I suppose that the current doc is technically wrong either way, since the current order is not dependent on the JVM reflection API :) But mainly I want to know how safe this is to rely on. Thanks.
(Sorry if I missed some past discussion in my searching or if I've misunderstood something.)