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.
evaluate()| Constructor and Description | 
|---|
| SpringFailOnTimeout(Statement next,
                   long timeout)Construct a new  SpringFailOnTimeoutstatement for the suppliedtimeout. | 
| SpringFailOnTimeout(Statement next,
                   Method testMethod)Construct a new  SpringFailOnTimeoutstatement for the suppliedtestMethod, retrieving the configured timeout from the@Timedannotation on the supplied method. | 
| Modifier and Type | Method and Description | 
|---|---|
| void | evaluate()Evaluate the next  statementin the execution chain
 (typically an instance ofSpringRepeat) and throw aTimeoutExceptionif the nextstatementexecutes longer
 than the specifiedtimeout. | 
public SpringFailOnTimeout(Statement next, Method testMethod)
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 chaintestMethod - the current test methodTestAnnotationUtils.getTimeout(Method)public SpringFailOnTimeout(Statement next, long timeout)
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 nulltimeout - the configured timeout for the current test, in milliseconds;
 never negativepublic void evaluate()
              throws Throwable
statement in the execution chain
 (typically an instance of SpringRepeat) and throw a
 TimeoutException if the next statement executes longer
 than the specified timeout.