ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/test/tck/CountedCompleterTest.java
(Generate patch)

Comparing jsr166/src/test/tck/CountedCompleterTest.java (file contents):
Revision 1.32 by jsr166, Sat Mar 11 17:33:32 2017 UTC vs.
Revision 1.33 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.HashSet;
10   import java.util.concurrent.CancellationException;
# Line 77 | Line 76 | public class CountedCompleterTest extend
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 95 | Line 94 | public class CountedCompleterTest extend
94              Thread.currentThread().interrupt();
95              long startTime = System.nanoTime();
96              assertNull(a.join());
97 <            assertTrue(millisElapsedSince(startTime) < SMALL_DELAY_MS);
97 >            assertTrue(millisElapsedSince(startTime) < LONG_DELAY_MS);
98              Thread.interrupted();
99          }
100  
# Line 103 | Line 102 | public class CountedCompleterTest extend
102              Thread.currentThread().interrupt();
103              long startTime = System.nanoTime();
104              a.quietlyJoin();        // should be no-op
105 <            assertTrue(millisElapsedSince(startTime) < SMALL_DELAY_MS);
105 >            assertTrue(millisElapsedSince(startTime) < LONG_DELAY_MS);
106              Thread.interrupted();
107          }
108  
# Line 111 | Line 110 | public class CountedCompleterTest extend
110          assertFalse(a.cancel(true));
111          try {
112              assertNull(a.get());
113 <        } catch (Throwable fail) { threadUnexpectedException(fail); }
115 <        try {
116 <            assertNull(a.get(5L, SECONDS));
113 >            assertNull(a.get(randomTimeout(), randomTimeUnit()));
114          } catch (Throwable fail) { threadUnexpectedException(fail); }
115      }
116  
# Line 138 | Line 135 | public class CountedCompleterTest extend
135          {
136              long startTime = System.nanoTime();
137              a.quietlyJoin();        // should be no-op
138 <            assertTrue(millisElapsedSince(startTime) < SMALL_DELAY_MS);
138 >            assertTrue(millisElapsedSince(startTime) < LONG_DELAY_MS);
139          }
140  
141          try {
# Line 148 | Line 145 | public class CountedCompleterTest extend
145          } catch (Throwable fail) { threadUnexpectedException(fail); }
146  
147          try {
148 <            a.get(5L, SECONDS);
148 >            a.get(randomTimeout(), randomTimeUnit());
149              shouldThrow();
150          } catch (CancellationException success) {
151          } catch (Throwable fail) { threadUnexpectedException(fail); }
# Line 176 | Line 173 | public class CountedCompleterTest extend
173          {
174              long startTime = System.nanoTime();
175              a.quietlyJoin();        // should be no-op
176 <            assertTrue(millisElapsedSince(startTime) < SMALL_DELAY_MS);
176 >            assertTrue(millisElapsedSince(startTime) < LONG_DELAY_MS);
177          }
178  
179          try {
# Line 187 | Line 184 | public class CountedCompleterTest extend
184          } catch (Throwable fail) { threadUnexpectedException(fail); }
185  
186          try {
187 <            a.get(5L, SECONDS);
187 >            a.get(randomTimeout(), randomTimeUnit());
188              shouldThrow();
189          } catch (ExecutionException success) {
190              assertSame(t.getClass(), success.getCause().getClass());
# Line 702 | Line 699 | public class CountedCompleterTest extend
699                  CCF f = new LCCF(8);
700                  assertSame(f, f.fork());
701                  try {
702 <                    f.get(5L, null);
702 >                    f.get(randomTimeout(), null);
703                      shouldThrow();
704                  } catch (NullPointerException success) {}
705              }};
# Line 1424 | Line 1421 | public class CountedCompleterTest extend
1421                  CCF f = new LCCF(8);
1422                  assertSame(f, f.fork());
1423                  try {
1424 <                    f.get(5L, null);
1424 >                    f.get(randomTimeout(), null);
1425                      shouldThrow();
1426                  } catch (NullPointerException success) {}
1427              }};

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines