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.6 by jsr166, Wed Dec 31 17:00:58 2014 UTC vs.
Revision 1.10 by jsr166, Sat Feb 7 17:49:11 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;
12   import java.util.concurrent.ForkJoinPool;
13   import java.util.concurrent.ForkJoinTask;
14   import java.util.concurrent.RecursiveAction;
15   import java.util.concurrent.TimeoutException;
16 < import static java.util.concurrent.TimeUnit.MILLISECONDS;
17 < import static java.util.concurrent.TimeUnit.SECONDS;
18 < import junit.framework.*;
16 >
17 > import junit.framework.Test;
18 > import junit.framework.TestSuite;
19  
20   public class ForkJoinTask8Test extends JSR166TestCase {
21  
# Line 176 | Line 180 | public class ForkJoinTask8Test extends J
180          } catch (Throwable fail) { threadUnexpectedException(fail); }
181      }
182  
179
183      public static final class FJException extends RuntimeException {
184          FJException() { super(); }
185      }
# Line 718 | Line 721 | public class ForkJoinTask8Test extends J
721      }
722  
723      /**
724 <     * invokeAll(tasks) with any null task throws NPE
724 >     * invokeAll(tasks) with any null task throws NullPointerException
725       */
726 <    public void testInvokeAllNPE() {
726 >    public void testInvokeAllNullTask() {
727          RecursiveAction a = new CheckedRecursiveAction() {
728              protected void realCompute() {
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) {}
731 >                AsyncFib nul = null;
732 >                Runnable[] throwingActions = {
733 >                    () -> invokeAll(nul),
734 >                    () -> invokeAll(nul, nul),
735 >                    () -> invokeAll(f, g, nul),
736 >                    () -> invokeAll(f, nul, g),
737 >                    () -> invokeAll(nul, f, g),
738 >                };
739 >                assertThrows(NullPointerException.class, throwingActions);
740              }};
741          testInvokeOnPool(mainPool(), a);
742      }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines