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

Comparing jsr166/src/test/tck/ThreadLocalRandom8Test.java (file contents):
Revision 1.8 by jsr166, Wed Dec 31 21:28:49 2014 UTC vs.
Revision 1.12 by jsr166, Fri Aug 4 03:30:21 2017 UTC

# Line 14 | Line 14 | import junit.framework.TestSuite;
14   public class ThreadLocalRandom8Test extends JSR166TestCase {
15  
16      public static void main(String[] args) {
17 <        junit.textui.TestRunner.run(suite());
17 >        main(suite(), args);
18      }
19      public static Test suite() {
20          return new TestSuite(ThreadLocalRandom8Test.class);
# Line 232 | Line 232 | public class ThreadLocalRandom8Test exte
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   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines