I want to write test cases for a bulk of code, I would like to know details of JUnit
Rules are used to add additional functionality which applies to all tests within a test class, but in a more generic way.
For instance, ExternalResource executes code before and after a test method, without having to use
@After. Using an
ExternalResource rather than
@After gives opportunities for better code reuse; the same rule can be used from two different test classes.
The design was based upon: Interceptors in JUnit
For more information see JUnit wiki : Rules.