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

Comparing jsr166/src/test/tck/ForkJoinTaskTest.java (file contents):
Revision 1.48 by dl, Sun Oct 11 19:53:59 2015 UTC vs.
Revision 1.51 by jsr166, Wed Aug 24 22:22:39 2016 UTC

# Line 8 | Line 8 | import static java.util.concurrent.TimeU
8   import static java.util.concurrent.TimeUnit.SECONDS;
9  
10   import java.util.Arrays;
11 import java.util.Collections;
11   import java.util.HashSet;
13 import java.util.List;
12   import java.util.concurrent.CancellationException;
13   import java.util.concurrent.ExecutionException;
14   import java.util.concurrent.ForkJoinPool;
# Line 776 | Line 774 | public class ForkJoinTaskTest extends JS
774      }
775  
776      /**
777 +     * completeExceptionally(null) surprisingly has the same effect as
778 +     * completeExceptionally(new RuntimeException())
779 +     */
780 +    public void testCompleteExceptionally_null() {
781 +        RecursiveAction a = new CheckedRecursiveAction() {
782 +            protected void realCompute() {
783 +                AsyncFib f = new AsyncFib(8);
784 +                f.completeExceptionally(null);
785 +                try {
786 +                    f.invoke();
787 +                    shouldThrow();
788 +                } catch (RuntimeException success) {
789 +                    assertSame(success.getClass(), RuntimeException.class);
790 +                    assertNull(success.getCause());
791 +                    checkCompletedAbnormally(f, success);
792 +                }
793 +            }};
794 +        testInvokeOnPool(mainPool(), a);
795 +    }
796 +
797 +    /**
798       * invokeAll(t1, t2) invokes all task arguments
799       */
800      public void testInvokeAll2() {
# Line 876 | Line 895 | public class ForkJoinTaskTest extends JS
895                  AsyncFib f = new AsyncFib(8);
896                  FailingAsyncFib g = new FailingAsyncFib(9);
897                  ForkJoinTask[] tasks = { f, g };
898 <                Collections.shuffle(Arrays.asList(tasks));
898 >                shuffle(tasks);
899                  try {
900                      invokeAll(tasks);
901                      shouldThrow();
# Line 914 | Line 933 | public class ForkJoinTaskTest extends JS
933                  FailingAsyncFib g = new FailingAsyncFib(9);
934                  AsyncFib h = new AsyncFib(7);
935                  ForkJoinTask[] tasks = { f, g, h };
936 <                Collections.shuffle(Arrays.asList(tasks));
936 >                shuffle(tasks);
937                  try {
938                      invokeAll(tasks);
939                      shouldThrow();
# Line 935 | Line 954 | public class ForkJoinTaskTest extends JS
954                  AsyncFib g = new AsyncFib(9);
955                  AsyncFib h = new AsyncFib(7);
956                  ForkJoinTask[] tasks = { f, g, h };
957 <                List taskList = Arrays.asList(tasks);
939 <                Collections.shuffle(taskList);
957 >                shuffle(tasks);
958                  try {
959 <                    invokeAll(taskList);
959 >                    invokeAll(Arrays.asList(tasks));
960                      shouldThrow();
961                  } catch (FJException success) {
962                      checkCompletedAbnormally(f, success);
# Line 1546 | Line 1564 | public class ForkJoinTaskTest extends JS
1564                  AsyncFib f = new AsyncFib(8);
1565                  FailingAsyncFib g = new FailingAsyncFib(9);
1566                  ForkJoinTask[] tasks = { f, g };
1567 <                Collections.shuffle(Arrays.asList(tasks));
1567 >                shuffle(tasks);
1568                  try {
1569                      invokeAll(tasks);
1570                      shouldThrow();
# Line 1584 | Line 1602 | public class ForkJoinTaskTest extends JS
1602                  FailingAsyncFib g = new FailingAsyncFib(9);
1603                  AsyncFib h = new AsyncFib(7);
1604                  ForkJoinTask[] tasks = { f, g, h };
1605 <                Collections.shuffle(Arrays.asList(tasks));
1605 >                shuffle(tasks);
1606                  try {
1607                      invokeAll(tasks);
1608                      shouldThrow();
# Line 1605 | Line 1623 | public class ForkJoinTaskTest extends JS
1623                  AsyncFib g = new AsyncFib(9);
1624                  AsyncFib h = new AsyncFib(7);
1625                  ForkJoinTask[] tasks = { f, g, h };
1626 <                List taskList = Arrays.asList(tasks);
1609 <                Collections.shuffle(taskList);
1626 >                shuffle(tasks);
1627                  try {
1628 <                    invokeAll(taskList);
1628 >                    invokeAll(Arrays.asList(tasks));
1629                      shouldThrow();
1630                  } catch (FJException success) {
1631                      checkCompletedAbnormally(f, success);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines