ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/test/tck/RecursiveTaskTest.java
(Generate patch)

Comparing jsr166/src/test/tck/RecursiveTaskTest.java (file contents):
Revision 1.20 by jsr166, Sun Nov 21 08:25:10 2010 UTC vs.
Revision 1.22 by jsr166, Sun Nov 21 19:06:53 2010 UTC

# Line 145 | Line 145 | public class RecursiveTaskTest extends J
145          } catch (Throwable fail) { threadUnexpectedException(fail); }
146      }
147  
148 <    void checkTaskThrew(RecursiveTask a, Throwable t) {
148 >    void checkCompletedAbnormally(RecursiveTask a, Throwable t) {
149          assertTrue(a.isDone());
150          assertFalse(a.isCancelled());
151          assertFalse(a.isCompletedNormally());
# Line 344 | Line 344 | public class RecursiveTaskTest extends J
344                      f.invoke();
345                      shouldThrow();
346                  } catch (FJException success) {
347 <                    checkTaskThrew(f, success);
347 >                    checkCompletedAbnormally(f, success);
348                  }
349                  return NoResult;
350              }};
# Line 360 | Line 360 | public class RecursiveTaskTest extends J
360                  FailingFibTask f = new FailingFibTask(8);
361                  f.quietlyInvoke();
362                  assertTrue(f.getException() instanceof FJException);
363 <                checkTaskThrew(f, f.getException());
363 >                checkCompletedAbnormally(f, f.getException());
364                  return NoResult;
365              }};
366          assertSame(NoResult, testInvokeOnPool(mainPool(), a));
# Line 378 | Line 378 | public class RecursiveTaskTest extends J
378                      Integer r = f.join();
379                      shouldThrow();
380                  } catch (FJException success) {
381 <                    checkTaskThrew(f, success);
381 >                    checkCompletedAbnormally(f, success);
382                  }
383                  return NoResult;
384              }};
# Line 397 | Line 397 | public class RecursiveTaskTest extends J
397                      Integer r = f.get();
398                      shouldThrow();
399                  } catch (ExecutionException success) {
400 <                    checkTaskThrew(f, success.getCause());
400 >                    Throwable cause = success.getCause();
401 >                    assertTrue(cause instanceof FJException);
402 >                    checkCompletedAbnormally(f, cause);
403                  }
404                  return NoResult;
405              }};
# Line 416 | Line 418 | public class RecursiveTaskTest extends J
418                      Integer r = f.get(5L, SECONDS);
419                      shouldThrow();
420                  } catch (ExecutionException success) {
421 <                    checkTaskThrew(f, success.getCause());
421 >                    Throwable cause = success.getCause();
422 >                    assertTrue(cause instanceof FJException);
423 >                    checkCompletedAbnormally(f, cause);
424                  }
425                  return NoResult;
426              }};
# Line 433 | Line 437 | public class RecursiveTaskTest extends J
437                  assertSame(f, f.fork());
438                  f.quietlyJoin();
439                  assertTrue(f.getException() instanceof FJException);
440 <                checkTaskThrew(f, f.getException());
440 >                checkCompletedAbnormally(f, f.getException());
441                  return NoResult;
442              }};
443          assertSame(NoResult, testInvokeOnPool(mainPool(), a));
# Line 577 | Line 581 | public class RecursiveTaskTest extends J
581      public void testInForkJoinPool2() {
582          RecursiveTask<Integer> a = new CheckedRecursiveTask<Integer>() {
583              public Integer realCompute() {
584 <                assertTrue(!inForkJoinPool());
584 >                assertFalse(inForkJoinPool());
585                  return NoResult;
586              }};
587          assertSame(NoResult, a.invoke());
# Line 633 | Line 637 | public class RecursiveTaskTest extends J
637                          f.invoke();
638                          shouldThrow();
639                      } catch (FJException success) {
640 <                        checkTaskThrew(f, success);
640 >                        checkCompletedAbnormally(f, success);
641                      }
642                      f.reinitialize();
643                      checkNotDone(f);
# Line 655 | Line 659 | public class RecursiveTaskTest extends J
659                      Integer r = f.invoke();
660                      shouldThrow();
661                  } catch (FJException success) {
662 <                    checkTaskThrew(f, success);
662 >                    checkCompletedAbnormally(f, success);
663                  }
664                  return NoResult;
665              }};
# Line 687 | Line 691 | public class RecursiveTaskTest extends J
691                  FibTask f = new FibTask(8);
692                  FibTask g = new FibTask(9);
693                  invokeAll(f, g);
694 <                checkCompletesNormally(f, 21);
695 <                checkCompletesNormally(g, 34);
694 >                checkCompletedNormally(f, 21);
695 >                checkCompletedNormally(g, 34);
696                  return NoResult;
697              }};
698          assertSame(NoResult, testInvokeOnPool(mainPool(), a));
# Line 702 | Line 706 | public class RecursiveTaskTest extends J
706              public Integer realCompute() {
707                  FibTask f = new FibTask(8);
708                  invokeAll(f);
709 <                checkCompletesNormally(f, 21);
709 >                checkCompletedNormally(f, 21);
710                  return NoResult;
711              }};
712          assertSame(NoResult, testInvokeOnPool(mainPool(), a));
# Line 718 | Line 722 | public class RecursiveTaskTest extends J
722                  FibTask g = new FibTask(9);
723                  FibTask h = new FibTask(7);
724                  invokeAll(f, g, h);
725 <                checkCompletesNormally(f, 21);
726 <                checkCompletesNormally(g, 34);
727 <                checkCompletesNormally(h, 13);
725 >                assertTrue(f.isDone());
726 >                assertTrue(g.isDone());
727 >                assertTrue(h.isDone());
728 >                checkCompletedNormally(f, 21);
729 >                checkCompletedNormally(g, 34);
730 >                checkCompletedNormally(h, 13);
731                  return NoResult;
732              }};
733          assertSame(NoResult, testInvokeOnPool(mainPool(), a));
# Line 740 | Line 747 | public class RecursiveTaskTest extends J
747                  set.add(g);
748                  set.add(h);
749                  invokeAll(set);
750 <                checkCompletesNormally(f, 21);
751 <                checkCompletesNormally(g, 34);
752 <                checkCompletesNormally(h, 13);
750 >                assertTrue(f.isDone());
751 >                assertTrue(g.isDone());
752 >                assertTrue(h.isDone());
753 >                checkCompletedNormally(f, 21);
754 >                checkCompletedNormally(g, 34);
755 >                checkCompletedNormally(h, 13);
756                  return NoResult;
757              }};
758          assertSame(NoResult, testInvokeOnPool(mainPool(), a));
# Line 779 | Line 789 | public class RecursiveTaskTest extends J
789                      invokeAll(f, g);
790                      shouldThrow();
791                  } catch (FJException success) {
792 <                    checkTaskThrew(g, success);
792 >                    checkCompletedAbnormally(g, success);
793                  }
794                  return NoResult;
795              }};
# Line 797 | Line 807 | public class RecursiveTaskTest extends J
807                      invokeAll(g);
808                      shouldThrow();
809                  } catch (FJException success) {
810 <                    checkTaskThrew(g, success);
810 >                    checkCompletedAbnormally(g, success);
811                  }
812                  return NoResult;
813              }};
# Line 817 | Line 827 | public class RecursiveTaskTest extends J
827                      invokeAll(f, g, h);
828                      shouldThrow();
829                  } catch (FJException success) {
830 <                    checkTaskThrew(g, success);
830 >                    checkCompletedAbnormally(g, success);
831                  }
832                  return NoResult;
833              }};
# Line 841 | Line 851 | public class RecursiveTaskTest extends J
851                      invokeAll(set);
852                      shouldThrow();
853                  } catch (FJException success) {
854 <                    checkTaskThrew(f, success);
854 >                    checkCompletedAbnormally(f, success);
855                  }
856                  return NoResult;
857              }};
# Line 883 | Line 893 | public class RecursiveTaskTest extends J
893                  assertSame(f, f.fork());
894                  assertTrue(getSurplusQueuedTaskCount() > 0);
895                  helpQuiesce();
896 +                assertEquals(0, getSurplusQueuedTaskCount());
897                  checkCompletedNormally(f, 21);
898                  checkCompletedNormally(g, 34);
899                  checkCompletedNormally(h, 13);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines