类 FailOnTimeout
java.lang.Object
org.junit.runners.model.Statement
cn.taketoday.test.context.junit4.statements.FailOnTimeout
public class FailOnTimeout
extends org.junit.runners.model.Statement
FailOnTimeout is a custom JUnit Statement which adds
support for Framework's @Timed
annotation by throwing an exception if the next statement in the execution
chain takes more than the specified number of milliseconds.
In contrast to JUnit's
FailOnTimeout,
the next statement will be executed in the same thread as the
caller and will therefore not be aborted preemptively.
- 从以下版本开始:
- 4.0
- 作者:
- Sam Brannen
- 另请参阅:
-
字段概要
字段 -
构造器概要
构造器构造器说明FailOnTimeout(org.junit.runners.model.Statement next, long timeout) Construct a newFailOnTimeoutstatement for the suppliedtimeout.FailOnTimeout(org.junit.runners.model.Statement next, Method testMethod) Construct a newFailOnTimeoutstatement for the suppliedtestMethod, retrieving the configured timeout from the@Timedannotation on the supplied method. -
方法概要
修饰符和类型方法说明voidevaluate()Evaluate the nextstatementin the execution chain (typically an instance ofRepeatTest) and throw aTimeoutExceptionif the nextstatementexecutes longer than the specifiedtimeout.
-
字段详细资料
-
next
private final org.junit.runners.model.Statement next -
timeout
private final long timeout
-
-
构造器详细资料
-
FailOnTimeout
Construct a newFailOnTimeoutstatement for the suppliedtestMethod, retrieving the configured timeout from the@Timedannotation on the supplied method.- 参数:
next- the nextStatementin the execution chaintestMethod- the current test method- 另请参阅:
-
FailOnTimeout
public FailOnTimeout(org.junit.runners.model.Statement next, long timeout) Construct a newFailOnTimeoutstatement for the suppliedtimeout.If the supplied
timeoutis0, the execution of thenextstatement will not be timed.- 参数:
next- the nextStatementin the execution chain; nevernulltimeout- the configuredtimeoutfor the current test, in milliseconds; never negative
-
-
方法详细资料
-
evaluate
Evaluate the nextstatementin the execution chain (typically an instance ofRepeatTest) and throw aTimeoutExceptionif the nextstatementexecutes longer than the specifiedtimeout.- 指定者:
evaluate在类中org.junit.runners.model.Statement- 抛出:
Throwable
-