public class Timeout extends Object implements TestRule
public static class HasGlobalTimeout {
public static String log;
@Rule
public Timeout globalTimeout= new Timeout(20);
@Test
public void testInfiniteLoop1() {
log+= "ran1";
for (;;) {
}
}
@Test
public void testInfiniteLoop2() {
log+= "ran2";
for (;;) {
}
}
}
| Constructor and Description |
|---|
Timeout(int millis) |
| Modifier and Type | Method and Description |
|---|---|
Statement |
apply(Statement base,
Description description)
Modifies the method-running
Statement to implement this
test-running rule. |
public Statement apply(Statement base, Description description)
TestRuleStatement to implement this
test-running rule.apply in interface TestRulebase - The Statement to be modifieddescription - A Description of the test implemented in basebase,
a wrapper around base, or a completely new Statement.