232 |
|
assertEquals(size, counter.sum()); |
233 |
|
} |
234 |
|
|
235 |
+ |
/** |
236 |
+ |
* A deserialized/reserialized ThreadLocalRandom is always |
237 |
+ |
* identical to ThreadLocalRandom.current() |
238 |
+ |
*/ |
239 |
+ |
public void testSerialization() { |
240 |
+ |
assertSame( |
241 |
+ |
ThreadLocalRandom.current(), |
242 |
+ |
serialClone(ThreadLocalRandom.current())); |
243 |
+ |
// In the current implementation, there is exactly one shared instance |
244 |
+ |
if (testImplementationDetails) |
245 |
+ |
assertSame( |
246 |
+ |
ThreadLocalRandom.current(), |
247 |
+ |
java.util.concurrent.CompletableFuture.supplyAsync( |
248 |
+ |
() -> serialClone(ThreadLocalRandom.current())).join()); |
249 |
+ |
} |
250 |
+ |
|
251 |
|
} |