--- jsr166/src/test/tck/JSR166TestCase.java 2009/08/03 22:08:45 1.36 +++ jsr166/src/test/tck/JSR166TestCase.java 2009/08/05 00:43:59 1.38 @@ -289,13 +289,8 @@ public class JSR166TestCase extends Test * threadFail with message "should throw exception" */ public void threadShouldThrow() { - try { - threadFailed = true; - fail("should throw exception"); - } catch (AssertionFailedError e) { - e.printStackTrace(); - throw e; - } + threadFailed = true; + fail("should throw exception"); } /** @@ -400,6 +395,25 @@ public class JSR166TestCase extends Test public void refresh() {} } + /** + * Sleep until the timeout has elapsed, or interrupted. + * Does NOT throw InterruptedException. + */ + void sleepTillInterrupted(long timeoutMillis) { + try { + Thread.sleep(timeoutMillis); + } catch (InterruptedException wakeup) { + } + } + + /** + * Returns a new started Thread running the given runnable. + */ + Thread newStartedThread(Runnable runnable) { + Thread t = new Thread(runnable); + t.start(); + return t; + } // Some convenient Runnable classes