程序包 org.junit.rules
类 Verifier
- java.lang.Object
- org.junit.rules.Verifier
- 所有已实现的接口:
TestRule
- 直接已知子类:
ErrorCollector
public abstract class Verifier extends Object implements TestRule
Verifier is a base class for Rules like ErrorCollector, which can turn otherwise passing test methods into failing tests if a verification check is failedpublic static class ErrorLogVerifier { private ErrorLog errorLog = new ErrorLog(); @Rule public Verifier verifier = new Verifier() { @Override public void verify() { assertTrue(errorLog.isEmpty()); } } @Test public void testThatMightWriteErrorLog() { // ... } }
- 从以下版本开始:
- 4.7
构造器概要
构造器 构造器 说明 Verifier()
构造器详细资料
Verifier
public Verifier()
方法详细资料
apply
public Statement apply(Statement base, Description description)
从接口复制的说明:TestRule
Modifies the method-runningStatement
to implement this test-running rule.- 指定者:
apply
在接口中TestRule
- 参数:
base
- TheStatement
to be modifieddescription
- ADescription
of the test implemented inbase
- 返回:
- a new statement, which may be the same as
base
, a wrapper aroundbase
, or a completely new Statement.