--- jsr166/src/test/tck/RecursiveActionTest.java 2010/11/21 08:25:10 1.19 +++ jsr166/src/test/tck/RecursiveActionTest.java 2010/11/21 19:06:53 1.21 @@ -125,7 +125,7 @@ public class RecursiveActionTest extends } catch (Throwable fail) { threadUnexpectedException(fail); } } - void checkTaskThrew(RecursiveAction a, Throwable t) { + void checkCompletedAbnormally(RecursiveAction a, Throwable t) { assertTrue(a.isDone()); assertFalse(a.isCancelled()); assertFalse(a.isCompletedNormally()); @@ -333,7 +333,7 @@ public class RecursiveActionTest extends f.invoke(); shouldThrow(); } catch (FJException success) { - checkTaskThrew(f, success); + checkCompletedAbnormally(f, success); } }}; testInvokeOnPool(mainPool(), a); @@ -348,7 +348,7 @@ public class RecursiveActionTest extends FailingFibAction f = new FailingFibAction(8); f.quietlyInvoke(); assertTrue(f.getException() instanceof FJException); - checkTaskThrew(f, f.getException()); + checkCompletedAbnormally(f, f.getException()); }}; testInvokeOnPool(mainPool(), a); } @@ -365,7 +365,7 @@ public class RecursiveActionTest extends f.join(); shouldThrow(); } catch (FJException success) { - checkTaskThrew(f, success); + checkCompletedAbnormally(f, success); } }}; testInvokeOnPool(mainPool(), a); @@ -383,7 +383,9 @@ public class RecursiveActionTest extends f.get(); shouldThrow(); } catch (ExecutionException success) { - checkTaskThrew(f, success.getCause()); + Throwable cause = success.getCause(); + assertTrue(cause instanceof FJException); + checkCompletedAbnormally(f, cause); } }}; testInvokeOnPool(mainPool(), a); @@ -401,7 +403,9 @@ public class RecursiveActionTest extends f.get(5L, TimeUnit.SECONDS); shouldThrow(); } catch (ExecutionException success) { - checkTaskThrew(f, success.getCause()); + Throwable cause = success.getCause(); + assertTrue(cause instanceof FJException); + checkCompletedAbnormally(f, cause); } }}; testInvokeOnPool(mainPool(), a); @@ -417,7 +421,7 @@ public class RecursiveActionTest extends assertSame(f, f.fork()); f.quietlyJoin(); assertTrue(f.getException() instanceof FJException); - checkTaskThrew(f, f.getException()); + checkCompletedAbnormally(f, f.getException()); }}; testInvokeOnPool(mainPool(), a); } @@ -630,7 +634,7 @@ public class RecursiveActionTest extends f.invoke(); shouldThrow(); } catch (FJException success) { - checkTaskThrew(f, success); + checkCompletedAbnormally(f, success); } }}; testInvokeOnPool(mainPool(), a); @@ -692,6 +696,9 @@ public class RecursiveActionTest extends FibAction g = new FibAction(9); FibAction h = new FibAction(7); invokeAll(f, g, h); + assertTrue(f.isDone()); + assertTrue(g.isDone()); + assertTrue(h.isDone()); checkCompletedNormally(f); assertEquals(21, f.result); checkCompletedNormally(g); @@ -716,6 +723,9 @@ public class RecursiveActionTest extends set.add(g); set.add(h); invokeAll(set); + assertTrue(f.isDone()); + assertTrue(g.isDone()); + assertTrue(h.isDone()); checkCompletedNormally(f); assertEquals(21, f.result); checkCompletedNormally(g); @@ -756,7 +766,7 @@ public class RecursiveActionTest extends invokeAll(f, g); shouldThrow(); } catch (FJException success) { - checkTaskThrew(g, success); + checkCompletedAbnormally(g, success); } }}; testInvokeOnPool(mainPool(), a); @@ -773,7 +783,7 @@ public class RecursiveActionTest extends invokeAll(g); shouldThrow(); } catch (FJException success) { - checkTaskThrew(g, success); + checkCompletedAbnormally(g, success); } }}; testInvokeOnPool(mainPool(), a); @@ -792,7 +802,7 @@ public class RecursiveActionTest extends invokeAll(f, g, h); shouldThrow(); } catch (FJException success) { - checkTaskThrew(g, success); + checkCompletedAbnormally(g, success); } }}; testInvokeOnPool(mainPool(), a); @@ -815,7 +825,7 @@ public class RecursiveActionTest extends invokeAll(set); shouldThrow(); } catch (FJException success) { - checkTaskThrew(f, success); + checkCompletedAbnormally(f, success); } }}; testInvokeOnPool(mainPool(), a); @@ -855,6 +865,7 @@ public class RecursiveActionTest extends assertSame(f, f.fork()); assertTrue(getSurplusQueuedTaskCount() > 0); helpQuiesce(); + assertEquals(0, getSurplusQueuedTaskCount()); checkCompletedNormally(f); checkCompletedNormally(g); checkCompletedNormally(h);