org.springframework.test.context.junit4.statements
Class SpringFailOnTimeout
java.lang.Object
Statement
org.springframework.test.context.junit4.statements.SpringFailOnTimeout
public class SpringFailOnTimeout
- extends 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()
Field Summary |
private Statement |
next
|
private long |
timeout
|
Constructor Summary |
SpringFailOnTimeout(Statement next,
long timeout)
Constructs a new SpringFailOnTimeout statement. |
Method Summary |
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 |
next
private final Statement next
timeout
private final long timeout
SpringFailOnTimeout
public SpringFailOnTimeout(Statement next,
long timeout)
- Constructs a new
SpringFailOnTimeout
statement.
- Parameters:
next
- the next Statement
in the execution chaintimeout
- the configured timeout
for the current test- See Also:
Timed.millis()
evaluate
public void evaluate()
throws java.lang.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
.
- Throws:
java.lang.Throwable