类 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
另请参阅:
  • 字段概要

    字段
    修饰符和类型
    字段
    说明
    private final org.junit.runners.model.Statement
     
    private final long
     
  • 构造器概要

    构造器
    构造器
    说明
    FailOnTimeout(org.junit.runners.model.Statement next, long timeout)
    Construct a new FailOnTimeout statement for the supplied timeout.
    FailOnTimeout(org.junit.runners.model.Statement next, Method testMethod)
    Construct a new FailOnTimeout statement for the supplied testMethod, retrieving the configured timeout from the @Timed annotation on the supplied method.
  • 方法概要

    修饰符和类型
    方法
    说明
    void
    Evaluate the next statement in the execution chain (typically an instance of RepeatTest) and throw a TimeoutException if the next statement executes longer than the specified timeout.

    从类继承的方法 java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 字段详细资料

    • next

      private final org.junit.runners.model.Statement next
    • timeout

      private final long timeout
  • 构造器详细资料

    • FailOnTimeout

      public FailOnTimeout(org.junit.runners.model.Statement next, Method testMethod)
      Construct a new FailOnTimeout statement for the supplied testMethod, retrieving the configured timeout from the @Timed annotation on the supplied method.
      参数:
      next - the next Statement in the execution chain
      testMethod - the current test method
      另请参阅:
    • FailOnTimeout

      public FailOnTimeout(org.junit.runners.model.Statement next, long timeout)
      Construct a new FailOnTimeout statement for the supplied timeout.

      If the supplied timeout is 0, the execution of the next statement will not be timed.

      参数:
      next - the next Statement in the execution chain; never null
      timeout - the configured timeout for the current test, in milliseconds; never negative
  • 方法详细资料

    • evaluate

      public void evaluate() throws Throwable
      Evaluate the next statement in the execution chain (typically an instance of RepeatTest) and throw a TimeoutException if the next statement executes longer than the specified timeout.
      指定者:
      evaluate 在类中 org.junit.runners.model.Statement
      抛出:
      Throwable