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.33 by jsr166, Fri Feb 22 19:27:47 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 869 | Line 873 | public class ForkJoinTask8Test extends J
873          RecursiveAction a = new CheckedRecursiveAction() {
874              protected void realCompute() {
875                  AsyncFib nul = null;
876 <                Runnable[] throwingActions = {
876 >                assertThrows(
877 >                    NullPointerException.class,
878                      () -> invokeAll(nul),
879                      () -> invokeAll(nul, nul),
880                      () -> invokeAll(new AsyncFib(8), new AsyncFib(9), nul),
881                      () -> invokeAll(new AsyncFib(8), nul, new AsyncFib(9)),
882 <                    () -> invokeAll(nul, new AsyncFib(8), new AsyncFib(9)),
878 <                };
879 <                assertThrows(NullPointerException.class, throwingActions);
882 >                    () -> invokeAll(nul, new AsyncFib(8), new AsyncFib(9)));
883              }};
884          testInvokeOnPool(pool, a);
885      }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines