Class InvalidJUnitTest

All Implemented Interfaces:
Detector, Priorities, org.apache.bcel.classfile.Visitor

public class InvalidJUnitTest extends BytecodeScanningDetector
  • Field Details

    • SEEN_NOTHING

      private static final int SEEN_NOTHING
      See Also:
    • SEEN_ALOAD_0

      private static final int SEEN_ALOAD_0
      See Also:
    • bugReporter

      private final BugReporter bugReporter
    • state

      private int state
    • directChildOfTestCase

      boolean directChildOfTestCase
    • sawSuperCall

      private boolean sawSuperCall
  • Constructor Details

    • InvalidJUnitTest

      public InvalidJUnitTest(BugReporter bugReporter)
  • Method Details

    • visitClassContext

      public void visitClassContext(ClassContext classContext)
      Description copied from interface: Detector
      Visit the ClassContext for a class which should be analyzed for instances of bug patterns.
      Specified by:
      visitClassContext in interface Detector
      Overrides:
      visitClassContext in class BytecodeScanningDetector
      Parameters:
      classContext - the ClassContext
    • isJunit3TestCase

      private boolean isJunit3TestCase(XClass jClass) throws ClassNotFoundException
      Throws:
      ClassNotFoundException
    • hasTestMethods

      private boolean hasTestMethods(org.apache.bcel.classfile.JavaClass jClass)
    • hasSuite

      private boolean hasSuite(org.apache.bcel.classfile.Method[] methods)
      is there a JUnit3TestSuite
    • enabled

      private boolean enabled()
      Check whether or not this detector should be enabled. The detector is disabled if the TestCase class cannot be found (meaning we don't have junit.jar on the aux classpath).
      Returns:
      true if it should be enabled, false if not
    • visit

      public void visit(org.apache.bcel.classfile.Method obj)
      Overrides:
      visit in class BetterVisitor
    • visit

      public void visit(org.apache.bcel.classfile.Code obj)
      Overrides:
      visit in class DismantleBytecode
    • sawOpcode

      public void sawOpcode(int seen)
      Overrides:
      sawOpcode in class DismantleBytecode