@Rule
or @ClassRule
annotation usages.
Tests with malformed rules cannot be run.
@Rule
annotated member must be public
and a subtype of
org.junit.rules.TestRule
or org.junit.rules.MethodRule
@ClassRule
annotated member must be public
and static
and a subtype of
org.junit.rules.TestRule
For example:
public class MomentousTest {
@Rule
private final TemporaryFolder tempFolder =
new TemporaryFolder();
// ... tests go here
}
A quick fix is provided to fix the modifiers:
public class MomentousTest {
@Rule
public final TemporaryFolder tempFolder =
new TemporaryFolder();
// ... tests go here
}