类 Filter
- java.lang.Object
- org.junit.runner.manipulation.Filter
- 直接已知子类:
Categories.CategoryFilter
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, extendFilter
and apply an instance of your filter to theRequest
before running it (seeJUnitCore.run(Request)
. Alternatively, apply aFilter
to aRunner
before running tests (for example, in conjunction withRunWith
.- 从以下版本开始:
- 4.0
构造器概要
构造器 构造器 说明 Filter()
方法概要
所有方法 静态方法 实例方法 抽象方法 具体方法 修饰符和类型 方法 说明 void
apply(Object child)
Invoke with aRunner
to cause all tests it intends to run to first be checked with the filter.abstract String
describe()
Returns a textual description of this FilterFilter
intersect(Filter second)
Returns a new Filter that accepts the intersection of the tests accepted by this Filter andsecond
static Filter
matchMethodDescription(Description desiredDescription)
Returns aFilter
that only runs the single method described bydesiredDescription
abstract boolean
shouldRun(Description description)
构造器详细资料
Filter
public Filter()
方法详细资料
matchMethodDescription
public static Filter matchMethodDescription(Description desiredDescription)
Returns aFilter
that only runs the single method described bydesiredDescription
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 aRunner
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