JUnit @Before vs @Rule
In order to use @Rule, you require a class that implements TestRule(preferred) or MethodRule, as can be read here. Whereas @Before and @After require a new method to be written in every test case, @Rule does not because it is only an instantiation of already existing code. So, if you would use @Before and @After … Read more