org.junit.runners
Class ParentRunner<T>

java.lang.Object
  extended by org.junit.runner.Runner
      extended by org.junit.runners.ParentRunner<T>
All Implemented Interfaces:
Describable, Filterable, Sortable
Direct Known Subclasses:
BlockJUnit4ClassRunner, Suite

public abstract class ParentRunner<T>
extends Runner
implements Filterable, Sortable

Provides most of the functionality specific to a Runner that implements a "parent node" in the test tree, with children defined by objects of some data type T. (For BlockJUnit4ClassRunner, T is Method . For Suite, T is Class.) Subclasses must implement finding the children of the node, describing each child, and running each child. ParentRunner will filter and sort children, handle @BeforeClass and @AfterClass methods, create a composite Description, and run children sequentially.


Method Summary
 void filter(Filter filter)
          Remove tests that don't pass the parameter filter.
 Description getDescription()
           
 TestClass getTestClass()
          Returns a TestClass object wrapping the class to be executed.
 void run(RunNotifier notifier)
          Run the tests for this runner.
 void setScheduler(RunnerScheduler scheduler)
          Sets a scheduler that determines the order and parallelization of children.
 void sort(Sorter sorter)
          Sorts the tests using sorter
 
Methods inherited from class org.junit.runner.Runner
testCount
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getTestClass

public final TestClass getTestClass()
Returns a TestClass object wrapping the class to be executed.


getDescription

public Description getDescription()
Specified by:
getDescription in interface Describable
Specified by:
getDescription in class Runner
Returns:
a Description showing the tests to be run by the receiver

run

public void run(RunNotifier notifier)
Description copied from class: Runner
Run the tests for this runner.

Specified by:
run in class Runner
Parameters:
notifier - will be notified of events while tests are being run--tests being started, finishing, and failing

filter

public void filter(Filter filter)
            throws NoTestsRemainException
Description copied from interface: Filterable
Remove tests that don't pass the parameter filter.

Specified by:
filter in interface Filterable
Parameters:
filter - the Filter to apply
Throws:
NoTestsRemainException - if all tests are filtered out

sort

public void sort(Sorter sorter)
Description copied from interface: Sortable
Sorts the tests using sorter

Specified by:
sort in interface Sortable
Parameters:
sorter - the Sorter to use for sorting the tests

setScheduler

public void setScheduler(RunnerScheduler scheduler)
Sets a scheduler that determines the order and parallelization of children. Highly experimental feature that may change.