704 |
|
/** |
705 |
|
* Returns a random element from given choices. |
706 |
|
*/ |
707 |
+ |
<T> T chooseRandomly(List<T> choices) { |
708 |
+ |
return choices.get(ThreadLocalRandom.current().nextInt(choices.size())); |
709 |
+ |
} |
710 |
+ |
|
711 |
+ |
/** |
712 |
+ |
* Returns a random element from given choices. |
713 |
+ |
*/ |
714 |
|
<T> T chooseRandomly(T... choices) { |
715 |
|
return choices[ThreadLocalRandom.current().nextInt(choices.length)]; |
716 |
|
} |
1200 |
|
} catch (TimeoutException success) { |
1201 |
|
} catch (Exception fail) { |
1202 |
|
threadUnexpectedException(fail); |
1203 |
< |
} finally { future.cancel(true); } |
1203 |
> |
} |
1204 |
|
assertTrue(millisElapsedSince(startTime) >= timeoutMillis); |
1205 |
+ |
assertFalse(future.isDone()); |
1206 |
|
} |
1207 |
|
|
1208 |
|
/** |
1780 |
|
|
1781 |
|
public int await() { |
1782 |
|
try { |
1783 |
< |
return super.await(2 * LONG_DELAY_MS, MILLISECONDS); |
1783 |
> |
return super.await(LONGER_DELAY_MS, MILLISECONDS); |
1784 |
|
} catch (TimeoutException timedOut) { |
1785 |
|
throw new AssertionError("timed out"); |
1786 |
|
} catch (Exception fail) { |