--- jsr166/src/test/tck/ForkJoinPoolTest.java 2009/08/04 21:10:19 1.8 +++ jsr166/src/test/tck/ForkJoinPoolTest.java 2009/08/05 00:49:40 1.9 @@ -699,13 +699,12 @@ public class ForkJoinPoolTest extends JS } /** - * invokeAny(c) throws NullPointerException if c has null elements + * invokeAny(c) throws NullPointerException if c has a single null element */ public void testInvokeAny3() throws Throwable { ExecutorService e = new ForkJoinPool(1); try { ArrayList> l = new ArrayList>(); - l.add(new StringTask()); l.add(null); e.invokeAny(l); shouldThrow(); @@ -716,12 +715,35 @@ public class ForkJoinPoolTest extends JS } /** - * invokeAny(c) throws ExecutionException if no task in c completes + * invokeAny(c) throws NullPointerException if c has null elements */ public void testInvokeAny4() throws Throwable { ExecutorService e = new ForkJoinPool(1); try { ArrayList> l = new ArrayList>(); + l.add(new Callable() { + public String call() { + // The delay gives the pool a chance to notice + // the null element. + sleepTillInterrupted(SMALL_DELAY_MS); + return "foo"; + }}); + l.add(null); + e.invokeAny(l); + shouldThrow(); + } catch (NullPointerException success) { + } finally { + joinPool(e); + } + } + + /** + * invokeAny(c) throws ExecutionException if no task in c completes + */ + public void testInvokeAny5() throws Throwable { + ExecutorService e = new ForkJoinPool(1); + try { + ArrayList> l = new ArrayList>(); l.add(new NPETask()); e.invokeAny(l); shouldThrow(); @@ -734,7 +756,7 @@ public class ForkJoinPoolTest extends JS /** * invokeAny(c) returns result of some task in c if at least one completes */ - public void testInvokeAny5() throws Throwable { + public void testInvokeAny6() throws Throwable { ExecutorService e = new ForkJoinPool(1); try { ArrayList> l = new ArrayList>();