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

Comparing jsr166/src/test/tck/ConcurrentSkipListSetTest.java (file contents):
Revision 1.45 by jsr166, Sun Oct 16 20:44:18 2016 UTC vs.
Revision 1.48 by jsr166, Fri Aug 4 04:59:23 2017 UTC

# Line 37 | Line 37 | public class ConcurrentSkipListSetTest e
37       * Returns a new set of given size containing consecutive
38       * Integers 0 ... n - 1.
39       */
40 <    private ConcurrentSkipListSet<Integer> populatedSet(int n) {
40 >    private static ConcurrentSkipListSet<Integer> populatedSet(int n) {
41          ConcurrentSkipListSet<Integer> q =
42              new ConcurrentSkipListSet<Integer>();
43          assertTrue(q.isEmpty());
# Line 53 | Line 53 | public class ConcurrentSkipListSetTest e
53      /**
54       * Returns a new set of first 5 ints.
55       */
56 <    private ConcurrentSkipListSet set5() {
56 >    private static ConcurrentSkipListSet set5() {
57          ConcurrentSkipListSet q = new ConcurrentSkipListSet();
58          assertTrue(q.isEmpty());
59          q.add(one);
# Line 202 | Line 202 | public class ConcurrentSkipListSetTest e
202          } catch (ClassCastException success) {
203              assertTrue(q.size() < 2);
204              for (int i = 0, size = q.size(); i < size; i++)
205 <                assertTrue(q.pollFirst().getClass() == Object.class);
205 >                assertSame(Object.class, q.pollFirst().getClass());
206              assertNull(q.pollFirst());
207              assertTrue(q.isEmpty());
208              assertEquals(0, q.size());
# Line 526 | Line 526 | public class ConcurrentSkipListSetTest e
526      }
527  
528      /**
529 <     * A deserialized serialized set has same elements
529 >     * A cloned set equals original
530 >     */
531 >    public void testClone() {
532 >        ConcurrentSkipListSet x = populatedSet(SIZE);
533 >        ConcurrentSkipListSet y = x.clone();
534 >
535 >        assertNotSame(x, y);
536 >        assertEquals(x.size(), y.size());
537 >        assertEquals(x, y);
538 >        assertEquals(y, x);
539 >        while (!x.isEmpty()) {
540 >            assertFalse(y.isEmpty());
541 >            assertEquals(x.pollFirst(), y.pollFirst());
542 >        }
543 >        assertTrue(y.isEmpty());
544 >    }
545 >
546 >    /**
547 >     * A deserialized/reserialized set equals original
548       */
549      public void testSerialization() throws Exception {
550          NavigableSet x = populatedSet(SIZE);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines