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.51 by jsr166, Wed Aug 24 22:22:39 2016 UTC vs.
Revision 1.52 by jsr166, Mon May 29 19:15:02 2017 UTC

# Line 5 | Line 5
5   */
6  
7   import static java.util.concurrent.TimeUnit.MILLISECONDS;
8 import static java.util.concurrent.TimeUnit.SECONDS;
8  
9   import java.util.Arrays;
10   import java.util.HashSet;
# Line 77 | Line 76 | public class ForkJoinTaskTest extends JS
76          assertNull(a.getRawResult());
77  
78          try {
79 <            a.get(0L, SECONDS);
79 >            a.get(randomExpiredTimeout(), randomTimeUnit());
80              shouldThrow();
81          } catch (TimeoutException success) {
82          } catch (Throwable fail) { threadUnexpectedException(fail); }
# Line 99 | Line 98 | public class ForkJoinTaskTest extends JS
98              Thread.currentThread().interrupt();
99              long startTime = System.nanoTime();
100              assertSame(expected, a.join());
101 <            assertTrue(millisElapsedSince(startTime) < SMALL_DELAY_MS);
101 >            assertTrue(millisElapsedSince(startTime) < LONG_DELAY_MS);
102              Thread.interrupted();
103          }
104  
# Line 107 | Line 106 | public class ForkJoinTaskTest extends JS
106              Thread.currentThread().interrupt();
107              long startTime = System.nanoTime();
108              a.quietlyJoin();        // should be no-op
109 <            assertTrue(millisElapsedSince(startTime) < SMALL_DELAY_MS);
109 >            assertTrue(millisElapsedSince(startTime) < LONG_DELAY_MS);
110              Thread.interrupted();
111          }
112  
# Line 115 | Line 114 | public class ForkJoinTaskTest extends JS
114          assertFalse(a.cancel(true));
115          try {
116              assertSame(expected, a.get());
117 <        } catch (Throwable fail) { threadUnexpectedException(fail); }
119 <        try {
120 <            assertSame(expected, a.get(5L, SECONDS));
117 >            assertSame(expected, a.get(randomTimeout(), randomTimeUnit()));
118          } catch (Throwable fail) { threadUnexpectedException(fail); }
119      }
120  
# Line 142 | Line 139 | public class ForkJoinTaskTest extends JS
139          {
140              long startTime = System.nanoTime();
141              a.quietlyJoin();        // should be no-op
142 <            assertTrue(millisElapsedSince(startTime) < SMALL_DELAY_MS);
142 >            assertTrue(millisElapsedSince(startTime) < LONG_DELAY_MS);
143          }
144  
145          try {
# Line 152 | Line 149 | public class ForkJoinTaskTest extends JS
149          } catch (Throwable fail) { threadUnexpectedException(fail); }
150  
151          try {
152 <            a.get(5L, SECONDS);
152 >            a.get(randomTimeout(), randomTimeUnit());
153              shouldThrow();
154          } catch (CancellationException success) {
155          } catch (Throwable fail) { threadUnexpectedException(fail); }
# Line 180 | Line 177 | public class ForkJoinTaskTest extends JS
177          {
178              long startTime = System.nanoTime();
179              a.quietlyJoin();        // should be no-op
180 <            assertTrue(millisElapsedSince(startTime) < SMALL_DELAY_MS);
180 >            assertTrue(millisElapsedSince(startTime) < LONG_DELAY_MS);
181          }
182  
183          try {
# Line 191 | Line 188 | public class ForkJoinTaskTest extends JS
188          } catch (Throwable fail) { threadUnexpectedException(fail); }
189  
190          try {
191 <            a.get(5L, SECONDS);
191 >            a.get(randomTimeout(), randomTimeUnit());
192              shouldThrow();
193          } catch (ExecutionException success) {
194              assertSame(t.getClass(), success.getCause().getClass());
# Line 465 | Line 462 | public class ForkJoinTaskTest extends JS
462                  AsyncFib f = new AsyncFib(8);
463                  assertSame(f, f.fork());
464                  try {
465 <                    f.get(5L, null);
465 >                    f.get(randomTimeout(), null);
466                      shouldThrow();
467                  } catch (NullPointerException success) {}
468              }};
# Line 1212 | Line 1209 | public class ForkJoinTaskTest extends JS
1209                  AsyncFib f = new AsyncFib(8);
1210                  assertSame(f, f.fork());
1211                  try {
1212 <                    f.get(5L, null);
1212 >                    f.get(randomTimeout(), null);
1213                      shouldThrow();
1214                  } catch (NullPointerException success) {}
1215              }};

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines