JUnit4ClassAnnotationNonStatic
This method should be static

Severity
ERROR
Has Fix?
REQUIRES_HUMAN_ATTENTION

The problem

JUnit4 provides two annotations (@BeforeClass and @AfterClass) that are applied to methods that are run once per test class. These complement the more-often used @Before and @After which are applied to methods that are run once per test method.

JUnit4 runs @BeforeClass and @AfterClass methods without making an instance of the test class, meaning that the methods must be static. JUnit4 will fail to run any @BeforeClass or @AfterClass method that isn’t also static.

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("JUnit4ClassAnnotationNonStatic") to the enclosing element.