|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.junit.rules.Timeout
public class Timeout
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 (;;) { } } }
Constructor Summary | |
---|---|
Timeout(int millis)
|
Method Summary | |
---|---|
Statement |
apply(Statement base,
Description description)
Modifies the method-running Statement to implement this
test-running rule. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Timeout(int millis)
millis
- the millisecond timeoutMethod Detail |
---|
public Statement apply(Statement base, Description description)
TestRule
Statement
to implement this
test-running rule.
apply
in interface TestRule
base
- The Statement
to be modifieddescription
- A Description
of the test implemented in base
base
,
a wrapper around base
, or a completely new Statement.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |