Ordering your JUnit Rules using a RuleChain
Tuesday, February 21st, 2012JUnit Rules are a handy solution if one needs to alter test methods or wants to share common functionality between several test cases. JUnit 4.10 introduced a new class to order several rules according to our needs using a so called rule-chain.
In the following example, we’re going to create a simple custom rule and afterwards bind several instances of it in a specified order to a test method.