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

Comparing jsr166/src/test/tck/CopyOnWriteArraySetTest.java (file contents):
Revision 1.24 by jsr166, Tue Nov 29 20:59:24 2011 UTC vs.
Revision 1.26 by jsr166, Tue Apr 2 22:18:26 2013 UTC

# Line 7 | Line 7
7   */
8  
9   import junit.framework.*;
10 + import java.util.ArrayList;
11   import java.util.Arrays;
12   import java.util.Collection;
13   import java.util.Collections;
# Line 173 | Line 174 | public class CopyOnWriteArraySetTest ext
174       * set in insertion order
175       */
176      public void testIterator() {
177 <        Set empty = new CopyOnWriteArraySet();
177 >        Collection empty = new CopyOnWriteArraySet();
178          assertFalse(empty.iterator().hasNext());
179          try {
180              empty.iterator().next();
# Line 215 | Line 216 | public class CopyOnWriteArraySetTest ext
216       * toString holds toString of elements
217       */
218      public void testToString() {
219 +        assertEquals("[]", new CopyOnWriteArraySet().toString());
220          CopyOnWriteArraySet full = populatedSet(3);
221          String s = full.toString();
222 <        for (int i = 0; i < 3; ++i) {
222 >        for (int i = 0; i < 3; ++i)
223              assertTrue(s.contains(String.valueOf(i)));
224 <        }
224 >        assertEquals(new ArrayList(full).toString(),
225 >                     full.toString());
226      }
227  
228      /**
# Line 345 | Line 348 | public class CopyOnWriteArraySetTest ext
348          assertEquals(x, y);
349          assertEquals(y, x);
350      }
351 +
352 +    /**
353 +     * addAll is idempotent
354 +     */
355 +    public void testAddAll_idempotent() throws Exception {
356 +        Set x = populatedSet(SIZE);
357 +        Set y = new CopyOnWriteArraySet(x);
358 +        y.addAll(x);
359 +        assertEquals(x, y);
360 +        assertEquals(y, x);
361 +    }
362  
363   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines