Class JUnit4SetUpNotRun

    • Constructor Detail

      • JUnit4SetUpNotRun

        public JUnit4SetUpNotRun()
    • Method Detail

      • methodMatcher

        protected Matcher<com.sun.source.tree.MethodTree> methodMatcher()
        Returns a matcher that selects which methods this matcher applies to (e.g. public void setUp() without @Before/@BeforeClass annotation)
      • correctAnnotation

        protected String correctAnnotation()
        Returns the fully qualified class name of the annotation this bugpattern should apply to matched methods.

        If another annotation is on the method that has the same name, the import will be replaced with the appropriate one (e.g.: com.example.Before becomes org.junit.Before)

      • matchMethod

        public Description matchMethod​(com.sun.source.tree.MethodTree methodTree,
                                       VisitorState state)
        Matches if all of the following conditions are true: 1) The method matches methodMatcher(), (looks like setUp() or tearDown(), and none of the overrides in the hierarchy of the method have the appropriate @Before or @After annotations) 2) The method is not annotated with @Test 3) The enclosing class has an @RunWith annotation and does not extend TestCase. This marks that the test is intended to run with JUnit 4.
        Specified by:
        matchMethod in interface BugChecker.MethodTreeMatcher