I want to write test cases for a bulk of code, I would like to know details of JUnit @Rule
annotation feature, so that I can use it for writing test cases. Please provide some good answers or links, which give detailed description of its functionality through a simple example.