org.junit.runner.manipulation
Class Filter
java.lang.Object
org.junit.runner.manipulation.Filter
public abstract class Filter
- extends Object
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.
|
字段摘要 |
static Filter |
ALL
A null Filter that passes all tests through. |
| 类方法继承: java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ALL
public static Filter ALL
- A null
Filter that passes all tests through.
Filter
public Filter()
matchMethodDescription
public static Filter matchMethodDescription(Description desiredDescription)
- Returns a
Filter that only runs the single method described by
desiredDescription
shouldRun
public abstract boolean shouldRun(Description description)
- 参数:
description - the description of the test to be run
- 返回:
true if the test should be run
describe
public abstract String describe()
- Returns a textual description of this Filter
- 返回:
- a textual description of this Filter
apply
public void apply(Object child)
throws NoTestsRemainException
- Invoke with a
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 tests