public abstract class Filter extends Object
Filter
and apply an instance of
your filter to the Request
before running it (see
JUnitCore.run(Request)
. Alternatively, apply a Filter
to
a Runner
before running tests (for example, in conjunction with
RunWith
.Modifier and Type | Field and Description |
---|---|
static Filter |
ALL
A null
Filter that passes all tests through. |
Constructor and Description |
---|
Filter() |
Modifier and Type | Method and Description |
---|---|
void |
apply(Object child)
Invoke with a
Runner to cause all tests it intends to run
to first be checked with the filter. |
abstract String |
describe()
Returns a textual description of this Filter
|
Filter |
intersect(Filter second)
Returns a new Filter that accepts the intersection of the tests accepted
by this Filter and
second |
static Filter |
matchMethodDescription(Description desiredDescription)
Returns a
Filter that only runs the single method described by
desiredDescription |
abstract boolean |
shouldRun(Description description) |
public static Filter ALL
Filter
that passes all tests through.public static Filter matchMethodDescription(Description desiredDescription)
Filter
that only runs the single method described by
desiredDescription
public abstract boolean shouldRun(Description description)
description
- the description of the test to be runtrue
if the test should be runpublic abstract String describe()
public void apply(Object child) throws NoTestsRemainException
Runner
to cause all tests it intends to run
to first be checked with the filter. Only those that pass the filter will be run.child
- the runner to be filtered by the receiverNoTestsRemainException
- if the receiver removes all tests