|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.junit.runner.manipulation.Filter
public abstract class Filter
The canonical case of filtering is when you want to run a single test method in a class. Rather
than introduce runner API just for that one case, JUnit provides a general filtering mechanism.
If you want to filter the tests to be run, extend 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
.
Field Summary | |
---|---|
static Filter |
ALL
A null Filter that passes all tests through. |
Constructor Summary | |
---|---|
Filter()
|
Method Summary | |
---|---|
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)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final Filter ALL
Filter
that passes all tests through.
Constructor Detail |
---|
public Filter()
Method Detail |
---|
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 run
true
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 receiver
NoTestsRemainException
- if the receiver removes all testspublic Filter intersect(Filter second)
second
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |