--- jsr166/src/test/tck/JSR166TestCase.java 2011/05/06 17:26:29 1.77 +++ jsr166/src/test/tck/JSR166TestCase.java 2011/05/07 19:03:26 1.78 @@ -478,6 +478,20 @@ public class JSR166TestCase extends Test } } + /** + * Checks that thread does not terminate within timeoutMillis + * milliseconds (that is, Thread.join times out). + */ + public void assertThreadJoinTimesOut(Thread thread, long timeoutMillis) { + try { + long startTime = System.nanoTime(); + thread.join(timeoutMillis); + assertTrue(thread.isAlive()); + assertTrue(millisElapsedSince(startTime) >= timeoutMillis); + } catch (InterruptedException ie) { + fail("Unexpected InterruptedException"); + } + } /** * Fails with message "should throw exception".