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

Comparing jsr166/src/test/tck/ForkJoinTask8Test.java (file contents):
Revision 1.2 by jsr166, Mon Jul 22 15:55:43 2013 UTC vs.
Revision 1.9 by jsr166, Sat Feb 7 17:43:38 2015 UTC

# Line 3 | Line 3
3   * Expert Group and released to the public domain, as explained at
4   * http://creativecommons.org/publicdomain/zero/1.0/
5   */
6 +
7 + import static java.util.concurrent.TimeUnit.MILLISECONDS;
8 + import static java.util.concurrent.TimeUnit.SECONDS;
9 +
10 + import java.util.HashSet;
11   import java.util.concurrent.ExecutionException;
7 import java.util.concurrent.CancellationException;
12   import java.util.concurrent.ForkJoinPool;
13   import java.util.concurrent.ForkJoinTask;
10 import java.util.concurrent.ForkJoinWorkerThread;
14   import java.util.concurrent.RecursiveAction;
12 import java.util.concurrent.TimeUnit;
15   import java.util.concurrent.TimeoutException;
16 < import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
17 < import static java.util.concurrent.TimeUnit.MILLISECONDS;
18 < import static java.util.concurrent.TimeUnit.SECONDS;
17 < import java.util.HashSet;
18 < import junit.framework.*;
16 >
17 > import junit.framework.Test;
18 > import junit.framework.TestSuite;
19  
20   public class ForkJoinTask8Test extends JSR166TestCase {
21  
# Line 180 | Line 180 | public class ForkJoinTask8Test extends J
180          } catch (Throwable fail) { threadUnexpectedException(fail); }
181      }
182  
183
183      public static final class FJException extends RuntimeException {
184          FJException() { super(); }
185      }
# Line 278 | Line 277 | public class ForkJoinTask8Test extends J
277              super.reinitialize();
278          }
279  
281
280      }
281  
282      static final class AsyncFib extends BinaryAsyncAction {
# Line 572 | Line 570 | public class ForkJoinTask8Test extends J
570          testInvokeOnPool(mainPool(), a);
571      }
572  
575
573      /**
574       * getPool of executing task returns its pool
575       */
# Line 732 | Line 729 | public class ForkJoinTask8Test extends J
729                  AsyncFib f = new AsyncFib(8);
730                  AsyncFib g = new AsyncFib(9);
731                  AsyncFib h = null;
732 <                try {
733 <                    invokeAll(f, g, h);
734 <                    shouldThrow();
735 <                } catch (NullPointerException success) {}
732 >                Runnable[] throwingActions = {
733 >                    () -> invokeAll(h),
734 >                    () -> invokeAll(f, g, h),
735 >                    () -> invokeAll(f, h, g),
736 >                    () -> invokeAll(h, f, g),
737 >                };
738 >                assertThrows(NullPointerException.class, throwingActions);
739              }};
740          testInvokeOnPool(mainPool(), a);
741      }
# Line 795 | Line 795 | public class ForkJoinTask8Test extends J
795      }
796  
797      /**
798 <     * invokeAll(collection)  throws exception if any task does
798 >     * invokeAll(collection) throws exception if any task does
799       */
800      public void testAbnormalInvokeAllCollection() {
801          RecursiveAction a = new CheckedRecursiveAction() {
# Line 1372 | Line 1372 | public class ForkJoinTask8Test extends J
1372      }
1373  
1374      /**
1375 <     * invokeAll(collection)  throws exception if any task does
1375 >     * invokeAll(collection) throws exception if any task does
1376       */
1377      public void testAbnormalInvokeAllCollectionSingleton() {
1378          RecursiveAction a = new CheckedRecursiveAction() {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines