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.29 by jsr166, Mon May 29 19:15:02 2017 UTC vs.
Revision 1.34 by dl, Mon Aug 12 15:08:44 2019 UTC

# Line 113 | Line 113 | public class ForkJoinTask8Test extends J
113          checkCompletedNormally(a, null);
114      }
115  
116 <    <T> void checkCompletedNormally(ForkJoinTask<T> a, T expected) {
116 >    <T> void checkCompletedNormally(ForkJoinTask<T> a, T expectedValue) {
117          assertTrue(a.isDone());
118          assertFalse(a.isCancelled());
119          assertTrue(a.isCompletedNormally());
120          assertFalse(a.isCompletedAbnormally());
121          assertNull(a.getException());
122 <        assertSame(expected, a.getRawResult());
122 >        assertSame(expectedValue, a.getRawResult());
123          if (a instanceof BinaryAsyncAction)
124              assertEquals(COMPLETE_STATE,
125                           ((BinaryAsyncAction)a).getForkJoinTaskTag());
# Line 127 | Line 127 | public class ForkJoinTask8Test extends J
127          {
128              Thread.currentThread().interrupt();
129              long startTime = System.nanoTime();
130 <            assertSame(expected, a.join());
130 >            assertSame(expectedValue, a.join());
131              assertTrue(millisElapsedSince(startTime) < LONG_DELAY_MS);
132              Thread.interrupted();
133          }
# Line 142 | Line 142 | public class ForkJoinTask8Test extends J
142  
143          assertFalse(a.cancel(false));
144          assertFalse(a.cancel(true));
145 +
146 +        T v1 = null, v2 = null;
147          try {
148 <            assertSame(expected, a.get());
149 <            assertSame(expected, a.get(randomTimeout(), randomTimeUnit()));
148 >            v1 = a.get();
149 >            v2 = a.get(randomTimeout(), randomTimeUnit());
150          } catch (Throwable fail) { threadUnexpectedException(fail); }
151 +        assertSame(expectedValue, v1);
152 +        assertSame(expectedValue, v2);
153      }
154  
155      void checkCompletedAbnormally(ForkJoinTask a, Throwable t) {
# Line 528 | Line 532 | public class ForkJoinTask8Test extends J
532                  AsyncFib f = new AsyncFib(8);
533                  assertSame(f, f.fork());
534                  helpQuiesce();
535 +                while (!f.isDone()) // wait out race
536 +                    ;
537                  assertEquals(0, getQueuedTaskCount());
538                  f.checkCompletedNormally();
539              }};
# Line 869 | Line 875 | public class ForkJoinTask8Test extends J
875          RecursiveAction a = new CheckedRecursiveAction() {
876              protected void realCompute() {
877                  AsyncFib nul = null;
878 <                Runnable[] throwingActions = {
878 >                assertThrows(
879 >                    NullPointerException.class,
880                      () -> invokeAll(nul),
881                      () -> invokeAll(nul, nul),
882                      () -> invokeAll(new AsyncFib(8), new AsyncFib(9), nul),
883                      () -> invokeAll(new AsyncFib(8), nul, new AsyncFib(9)),
884 <                    () -> invokeAll(nul, new AsyncFib(8), new AsyncFib(9)),
878 <                };
879 <                assertThrows(NullPointerException.class, throwingActions);
884 >                    () -> invokeAll(nul, new AsyncFib(8), new AsyncFib(9)));
885              }};
886          testInvokeOnPool(pool, a);
887      }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines