What is a rule in JUnit 4?

What is @Rule in JUnit?

JUnit’s @Rule is based on AOP (aspect oriented programming). It intercepts the test method, giving the opportunity to do something before or after the execution of a specific test method.