8 |
|
|
9 |
|
import static java.util.concurrent.TimeUnit.MILLISECONDS; |
10 |
|
import static java.util.concurrent.TimeUnit.NANOSECONDS; |
11 |
– |
import static java.util.concurrent.TimeUnit.SECONDS; |
11 |
|
|
12 |
|
import java.util.ArrayList; |
13 |
|
import java.util.List; |
107 |
|
|
108 |
|
try { |
109 |
|
assertSame(expected, f.get()); |
110 |
< |
} catch (Throwable fail) { threadUnexpectedException(fail); } |
112 |
< |
try { |
113 |
< |
assertSame(expected, f.get(5L, SECONDS)); |
110 |
> |
assertSame(expected, f.get(randomTimeout(), randomTimeUnit())); |
111 |
|
} catch (Throwable fail) { threadUnexpectedException(fail); } |
112 |
|
} |
113 |
|
|
122 |
|
} catch (Throwable fail) { threadUnexpectedException(fail); } |
123 |
|
|
124 |
|
try { |
125 |
< |
f.get(5L, SECONDS); |
125 |
> |
f.get(randomTimeout(), randomTimeUnit()); |
126 |
|
shouldThrow(); |
127 |
|
} catch (CancellationException success) { |
128 |
|
} catch (Throwable fail) { threadUnexpectedException(fail); } |
148 |
|
} catch (Throwable fail) { threadUnexpectedException(fail); } |
149 |
|
|
150 |
|
try { |
151 |
< |
f.get(5L, SECONDS); |
151 |
> |
f.get(randomTimeout(), randomTimeUnit()); |
152 |
|
shouldThrow(); |
153 |
|
} catch (ExecutionException success) { |
154 |
|
assertSame(t, success.getCause()); |