类 SpringFailOnTimeout


  • public class SpringFailOnTimeout
    extends Statement
    SpringFailOnTimeout is a custom JUnit Statement which adds support for Spring'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.

    从以下版本开始:
    3.0
    作者:
    Sam Brannen
    另请参阅:
    evaluate()
    • 构造器详细资料

      • SpringFailOnTimeout

        public SpringFailOnTimeout​(Statement next,
                                   Method testMethod)
        Construct a new SpringFailOnTimeout 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
        另请参阅:
        TestAnnotationUtils.getTimeout(Method)
      • SpringFailOnTimeout

        public SpringFailOnTimeout​(Statement next,
                                   long timeout)
        Construct a new SpringFailOnTimeout 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