--- jsr166/src/test/tck/JSR166TestCase.java 2009/08/03 19:07:51 1.35 +++ jsr166/src/test/tck/JSR166TestCase.java 2009/08/04 00:23:18 1.37 @@ -9,6 +9,7 @@ import junit.framework.*; import java.util.*; import java.util.concurrent.*; +import static java.util.concurrent.TimeUnit.MILLISECONDS; import java.io.*; import java.security.*; @@ -288,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"); } /** @@ -320,7 +316,7 @@ public class JSR166TestCase extends Test public void joinPool(ExecutorService exec) { try { exec.shutdown(); - assertTrue(exec.awaitTermination(LONG_DELAY_MS, TimeUnit.MILLISECONDS)); + assertTrue(exec.awaitTermination(LONG_DELAY_MS, MILLISECONDS)); } catch (SecurityException ok) { // Allowed in case test doesn't have privs } catch (InterruptedException ie) { @@ -343,6 +339,14 @@ public class JSR166TestCase extends Test fail("Unexpected exception"); } + /** + * fail with message "Unexpected exception", with argument + */ + public void unexpectedException(Throwable ex) { + ex.printStackTrace(); + fail("Unexpected exception: " + ex); + } + /** * The number of elements to place in collections, arrays, etc.