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.34 by jsr166, Mon Jun 3 18:20:05 2013 UTC vs.
Revision 1.40 by jsr166, Wed Dec 31 19:05:42 2014 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 < import java.util.concurrent.ExecutionException;
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.CancellationException;
12 + import java.util.concurrent.ExecutionException;
13   import java.util.concurrent.ForkJoinPool;
14   import java.util.concurrent.ForkJoinTask;
10 import java.util.concurrent.ForkJoinWorkerThread;
15   import java.util.concurrent.RecursiveAction;
12 import java.util.concurrent.TimeUnit;
16   import java.util.concurrent.TimeoutException;
17   import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
18 < import static java.util.concurrent.TimeUnit.MILLISECONDS;
19 < import static java.util.concurrent.TimeUnit.SECONDS;
20 < import java.util.HashSet;
18 < import junit.framework.*;
18 >
19 > import junit.framework.Test;
20 > import junit.framework.TestSuite;
21  
22   public class ForkJoinTaskTest extends JSR166TestCase {
23  
# Line 918 | Line 920 | public class ForkJoinTaskTest extends JS
920      }
921  
922      /**
923 <     * invokeAll(collection)  throws exception if any task does
923 >     * invokeAll(collection) throws exception if any task does
924       */
925      public void testAbnormalInvokeAllCollection() {
926          RecursiveAction a = new CheckedRecursiveAction() {
# Line 1585 | Line 1587 | public class ForkJoinTaskTest extends JS
1587      }
1588  
1589      /**
1590 <     * invokeAll(collection)  throws exception if any task does
1590 >     * invokeAll(collection) throws exception if any task does
1591       */
1592      public void testAbnormalInvokeAllCollectionSingleton() {
1593          RecursiveAction a = new CheckedRecursiveAction() {
# Line 1607 | Line 1609 | public class ForkJoinTaskTest extends JS
1609          testInvokeOnPool(singletonPool(), a);
1610      }
1611  
1612 +    /**
1613 +     * ForkJoinTask.quietlyComplete returns when task completes
1614 +     * normally without setting a value. The most recent value
1615 +     * established by setRawResult(V) (or null by default) is returned
1616 +     * from invoke.
1617 +     */
1618 +    public void testQuietlyComplete() {
1619 +        RecursiveAction a = new CheckedRecursiveAction() {
1620 +                protected void realCompute() {
1621 +                    AsyncFib f = new AsyncFib(8);
1622 +                    f.quietlyComplete();
1623 +                    assertEquals(8, f.number);
1624 +                    checkCompletedNormally(f);
1625 +                }};
1626 +        testInvokeOnPool(mainPool(), a);
1627 +    }
1628 +
1629   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines