Known Direct Subclasses
|
Class Overview
A RunnerBuilder is a strategy for constructing runners for classes.
Only writers of custom runners should use RunnerBuilder
s. A custom runner class with a constructor taking
a RunnerBuilder
parameter will be passed the instance of RunnerBuilder
used to build that runner itself.
For example,
imagine a custom runner that builds suites based on a list of classes in a text file:
\@RunWith(TextFileSuite.class)
\@SuiteSpecFile("mysuite.txt")
class MySuite {}
The implementation of TextFileSuite might include:
public TextFileSuite(Class testClass, RunnerBuilder builder) {
// ...
for (String className : readClassNames())
addRunner(builder.runnerForClass(Class.forName(className)));
// ...
}
Summary
Public Methods |
abstract
Runner
|
runnerForClass(Class<?> testClass)
Override to calculate the correct runner for a test class at runtime.
|
List<Runner>
|
runners(Class<?> parent, Class[]<?> children)
Constructs and returns a list of Runners, one for each child class in
children .
|
Runner
|
safeRunnerForClass(Class<?> testClass)
Always returns a runner, even if it is just one that prints an error instead of running tests.
|
[Expand]
Inherited Methods |
From class
java.lang.Object
Object
|
clone()
|
boolean
|
equals(Object arg0)
|
void
|
finalize()
|
final
Class<?>
|
getClass()
|
int
|
hashCode()
|
final
void
|
notify()
|
final
void
|
notifyAll()
|
String
|
toString()
|
final
void
|
wait()
|
final
void
|
wait(long arg0, int arg1)
|
final
void
|
wait(long arg0)
|
|
Public Constructors
Public Methods
public
abstract
Runner
runnerForClass
(Class<?> testClass)
Override to calculate the correct runner for a test class at runtime.
Parameters
testClass
| class to be run |
Constructs and returns a list of Runners, one for each child class in
children
. Care is taken to avoid infinite recursion:
this builder will throw an exception if it is requested for another
runner for parent
before this call completes.
public
Runner
safeRunnerForClass
(Class<?> testClass)
Always returns a runner, even if it is just one that prints an error instead of running tests.
Parameters
testClass
| class to be run |