Class Overview
The Timeout Rule applies the same timeout to all test methods in a class:
public static class HasGlobalTimeout {
public static String log;
@Rule
public MethodRule globalTimeout= new Timeout(20);
@Test
public void testInfiniteLoop1() {
log+= "ran1";
for (;;) {
}
}
@Test
public void testInfiniteLoop2() {
log+= "ran2";
for (;;) {
}
}
}
Summary
Public Constructors |
|
Timeout(int millis)
|
Public Constructors
public
Timeout
(int millis)
Parameters
millis
| the millisecond timeout
|
Public Methods
Modifies the method-running Statement
to implement an additional
test-running rule.
Parameters
base
| The Statement to be modified |
method
| The method to be run |
target
| The object on with the method will be run. |
Returns
- a new statement, which may be the same as
base
,
a wrapper around base
, or a completely new Statement.