220 |
|
normalizedTime <= cycles) |
221 |
|
return; |
222 |
|
} |
223 |
< |
throw new AssertionError("unexpected execution rate"); |
223 |
> |
fail("unexpected execution rate"); |
224 |
|
} |
225 |
|
} |
226 |
|
|
246 |
|
normalizedTime <= cycles) |
247 |
|
return; |
248 |
|
} |
249 |
< |
throw new AssertionError("unexpected execution rate"); |
249 |
> |
fail("unexpected execution rate"); |
250 |
|
} |
251 |
|
} |
252 |
|
|
1116 |
|
public void testTimedInvokeAny5() throws Exception { |
1117 |
|
final ExecutorService e = new CustomExecutor(2); |
1118 |
|
try (PoolCleaner cleaner = cleaner(e)) { |
1119 |
+ |
long startTime = System.nanoTime(); |
1120 |
|
List<Callable<String>> l = new ArrayList<Callable<String>>(); |
1121 |
|
l.add(new StringTask()); |
1122 |
|
l.add(new StringTask()); |
1123 |
< |
String result = e.invokeAny(l, MEDIUM_DELAY_MS, MILLISECONDS); |
1123 |
> |
String result = e.invokeAny(l, LONG_DELAY_MS, MILLISECONDS); |
1124 |
|
assertSame(TEST_STRING, result); |
1125 |
+ |
assertTrue(millisElapsedSince(startTime) < LONG_DELAY_MS); |
1126 |
|
} |
1127 |
|
} |
1128 |
|
|