Update sample unit test; the categorybasedtimer section was stale

This commit is contained in:
Michael Stack 2017-03-02 22:34:24 -08:00
parent 5645684ec9
commit 678ad0ea73
1 changed files with 7 additions and 5 deletions

View File

@ -1110,11 +1110,13 @@ public class TestExample {
// down in 'testExampleFoo()' where we use it to log current test's name. // down in 'testExampleFoo()' where we use it to log current test's name.
@Rule public TestName testName = new TestName(); @Rule public TestName testName = new TestName();
// CategoryBasedTimeout.forClass(<testcase>) decides the timeout based on the category // The below rule does two things. It decides the timeout based on the category
// (small/medium/large) of the testcase. @ClassRule requires that the full testcase runs within // (small/medium/large) of the testcase. This @Rule requires that the full testcase runs
// this timeout irrespective of individual test methods' times. // within this timeout irrespective of individual test methods' times. The second
@ClassRule // feature is we'll dump in the log when the test is done a count of threads still
public static TestRule timeout = CategoryBasedTimeout.forClass(TestExample.class); // running.
@Rule public static TestRule timeout = CategoryBasedTimeout.builder().
withTimeout(this.getClass()).withLookingForStuckThread(true).build();
@Before @Before
public void setUp() throws Exception { public void setUp() throws Exception {