org.springframework.test.context.junit4.statements

## Class SpringFailOnTimeout

- java.lang.Object
- - org.junit.runners.model.Statement
  - - org.springframework.test.context.junit4.statements.SpringFailOnTimeout

    public class SpringFailOnTimeout
    extends org.junit.runners.model.Statement

`SpringFailOnTimeout` is a custom JUnit 4.5+ `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.

Since:
  3.0
Author:
  Sam Brannen
See Also:
  `evaluate()`

### Constructor Summary

Constructors
Constructor and Description
`SpringFailOnTimeout(org.junit.runners.model.Statement next, long timeout)` Constructs a new `SpringFailOnTimeout` statement.

### Method Summary

Methods
`void` `evaluate()` Invokes the next `statement` in the execution chain (typically an instance of `InvokeMethod` or `ExpectException`) and throws an exception if the next `statement` takes more than the specified `timeout` .

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### SpringFailOnTimeout

    public SpringFailOnTimeout(org.junit.runners.model.Statement next,
                       long timeout)

Constructs a new `SpringFailOnTimeout` statement.

Parameters:
  `next` - the next `Statement` in the execution chain
  `timeout` - the configured `timeout` for the current test
See Also:
  `Timed.millis()`

### Method Detail

#### evaluate

    public void evaluate()
                  throws Throwable

Invokes the next `statement` in the execution chain (typically an instance of `InvokeMethod` or `ExpectException`) and throws an exception if the next `statement` takes more than the specified `timeout` .

Specified by:
  `evaluate` in class `org.junit.runners.model.Statement`
Throws:
  `Throwable`