Class BlockJUnit4ClassRunner

java.lang.Object
org.junit.runner.Runner
org.junit.runners.BlockJUnit4ClassRunner
Direct Known Subclasses:
JUnit4

public class BlockJUnit4ClassRunner extends Runner
Implements the JUnit 4 standard test case class model, as defined by the annotations in the org.junit package. Many users will never notice this class: it is now the default test class runner, but it should have exactly the same behavior as the old test class runner ( JUnit4ClassRunner).

BlockJUnit4ClassRunner has advantages for writers of custom JUnit runners that are slight changes to the default behavior, however:

  • It has a much simpler implementation based on Statements, allowing new operations to be inserted into the appropriate point in the execution flow.
  • It is published, and extension and reuse are encouraged, whereas JUnit4ClassRunner was in an internal package, and is now deprecated.

In turn, in 2009 we introduced Rules. In many cases where extending BlockJUnit4ClassRunner was necessary to add new behavior, Rules can be used, which makes the extension more reusable and composable.

Since:
4.5
  • Constructor Details

    • BlockJUnit4ClassRunner

      public BlockJUnit4ClassRunner(Class<?> klass)