BlockJUnit4ClassRunnerWithParameters (JUnit API)
Date: 2018-08-04

org.junit.runners.parameterized

## Class BlockJUnit4ClassRunnerWithParameters

- java.lang.Object
- - org.junit.runner.Runner
  - - org.junit.runners.ParentRunner<FrameworkMethod>
    - - org.junit.runners.BlockJUnit4ClassRunner
      - - org.junit.runners.parameterized.BlockJUnit4ClassRunnerWithParameters

- All Implemented Interfaces:
    Describable, Filterable, Sortable

      public class BlockJUnit4ClassRunnerWithParameters
      extends BlockJUnit4ClassRunner

  A `BlockJUnit4ClassRunner` with parameters support. Parameters can be injected via constructor or into annotated fields.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `BlockJUnit4ClassRunnerWithParameters(TestWithParameters test)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected Statement` | `classBlock(RunNotifier notifier)` Constructs a `Statement` to run all of the tests in the test class.
    `java.lang.Object` | `createTest()` Returns a new fixture for running a test.
    `protected java.lang.String` | `getName()` Returns a name used to describe this Runner
    `protected java.lang.annotation.Annotation[]` | `getRunnerAnnotations()`
    `protected java.lang.String` | `testName(FrameworkMethod method)` Returns the name that describes `method` for `Description`s.
    `protected void` | `validateConstructor(java.util.List<java.lang.Throwable> errors)` Adds to `errors` if the test class has more than one constructor, or if the constructor takes parameters.
    `protected void` | `validateFields(java.util.List<java.lang.Throwable> errors)`

    - ### Methods inherited from class org.junit.runners.BlockJUnit4ClassRunner

      `collectInitializationErrors, computeTestMethods, describeChild, getChildren, getTestRules, isIgnored, methodBlock, methodInvoker, possiblyExpectingExceptions, rules, runChild, validateInstanceMethods, validateNoNonStaticInnerClass, validateOnlyOneConstructor, validateTestMethods, validateZeroArgConstructor, withAfters, withBefores, withPotentialTimeout`

    - ### Methods inherited from class org.junit.runners.ParentRunner

      `childrenInvoker, classRules, createTestClass, filter, getDescription, getTestClass, run, runLeaf, setScheduler, sort, validatePublicVoidNoArgMethods, withAfterClasses, withBeforeClasses`

    - ### Methods inherited from class org.junit.runner.Runner

      `testCount`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### BlockJUnit4ClassRunnerWithParameters

          public BlockJUnit4ClassRunnerWithParameters(TestWithParameters test)
                                               throws InitializationError

      Throws:
        `InitializationError`

  - ### Method Detail

    - #### createTest

          public java.lang.Object createTest()
                                      throws java.lang.Exception

      Description copied from class: `BlockJUnit4ClassRunner`
      Returns a new fixture for running a test. Default implementation executes the test class's no-argument constructor (validation should have ensured one exists).
      Overrides:
        `createTest` in class `BlockJUnit4ClassRunner`
      Throws:
        `java.lang.Exception`

    - #### getName

          protected java.lang.String getName()

      Description copied from class: `ParentRunner`
      Returns a name used to describe this Runner
      Overrides:
        `getName` in class `ParentRunner<FrameworkMethod>`

    - #### testName

          protected java.lang.String testName(FrameworkMethod method)

      Description copied from class: `BlockJUnit4ClassRunner`
      Returns the name that describes `method` for `Description`s. Default implementation is the method's name
      Overrides:
        `testName` in class `BlockJUnit4ClassRunner`

    - #### validateConstructor

          protected void validateConstructor(java.util.List<java.lang.Throwable> errors)

      Description copied from class: `BlockJUnit4ClassRunner`
      Adds to `errors` if the test class has more than one constructor, or if the constructor takes parameters. Override if a subclass requires different validation rules.
      Overrides:
        `validateConstructor` in class `BlockJUnit4ClassRunner`

    - #### validateFields

          protected void validateFields(java.util.List<java.lang.Throwable> errors)

      Overrides:
        `validateFields` in class `BlockJUnit4ClassRunner`

    - #### classBlock

          protected Statement classBlock(RunNotifier notifier)

      Description copied from class: `ParentRunner`
      Constructs a `Statement` to run all of the tests in the test class. Override to add pre-/post-processing. Here is an outline of the implementation:
      1. Determine the children to be run using `ParentRunner.getChildren()` (subject to any imposed filter and sort).
      2. If there are any children remaining after filtering and ignoring, construct a statement that will:
         1. Apply all `ClassRule`s on the test-class and superclasses.
         2. Run all non-overridden `@BeforeClass` methods on the test-class and superclasses; if any throws an Exception, stop execution and pass the exception on.
         3. Run all remaining tests on the test-class.
         4. Run all non-overridden `@AfterClass` methods on the test-class and superclasses: exceptions thrown by previous steps are combined, if necessary, with exceptions from AfterClass methods into a `MultipleFailureException`.
      Overrides:
        `classBlock` in class `ParentRunner<FrameworkMethod>`
      Returns:
        `Statement`

    - #### getRunnerAnnotations

          protected java.lang.annotation.Annotation[] getRunnerAnnotations()

      Overrides:
        `getRunnerAnnotations` in class `ParentRunner<FrameworkMethod>`
      Returns:
        the annotations that should be attached to this runner's description.