Class BlockJUnit4ClassRunner

  • All Implemented Interfaces:
    Describable, Filterable, Sortable
    Direct Known Subclasses:
    BlockJUnit4ClassRunnerWithParameters, JUnit4, Theories

    public class BlockJUnit4ClassRunner
    extends ParentRunner<FrameworkMethod>
    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