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.11 by jsr166, Sat Nov 21 02:07:26 2009 UTC vs.
Revision 1.12 by jsr166, Sat Nov 21 10:25:05 2009 UTC

# Line 51 | Line 51 | public class CopyOnWriteArraySetTest ext
51  
52  
53      /**
54 <     *   addAll  adds each element from the given collection
54 >     *  addAll adds each element from the given collection
55       */
56      public void testAddAll() {
57          CopyOnWriteArraySet full = populatedSet(3);
# Line 64 | Line 64 | public class CopyOnWriteArraySetTest ext
64      }
65  
66      /**
67 <     *   addAll adds each element from the given collection that did not
67 >     *  addAll adds each element from the given collection that did not
68       *  already exist in the set
69       */
70      public void testAddAll2() {
# Line 78 | Line 78 | public class CopyOnWriteArraySetTest ext
78      }
79  
80      /**
81 <     *   add will not add the element if it already exists in the set
81 >     *  add will not add the element if it already exists in the set
82       */
83      public void testAdd2() {
84          CopyOnWriteArraySet full = populatedSet(3);
# Line 87 | Line 87 | public class CopyOnWriteArraySetTest ext
87      }
88  
89      /**
90 <     *   add  adds the element when it does not exist
91 <     *   in the set
90 >     *  add  adds the element when it does not exist
91 >     *  in the set
92       */
93      public void testAdd3() {
94          CopyOnWriteArraySet full = populatedSet(3);
# Line 97 | Line 97 | public class CopyOnWriteArraySetTest ext
97      }
98  
99      /**
100 <     *   clear  removes all elements from the set
100 >     *  clear removes all elements from the set
101       */
102      public void testClear() {
103          CopyOnWriteArraySet full = populatedSet(3);
# Line 134 | Line 134 | public class CopyOnWriteArraySetTest ext
134  
135  
136      /**
137 <     *   containsAll returns true for collections with subset of elements
137 >     *  containsAll returns true for collections with subset of elements
138       */
139      public void testContainsAll() {
140          CopyOnWriteArraySet full = populatedSet(3);
# Line 147 | Line 147 | public class CopyOnWriteArraySetTest ext
147      }
148  
149      /**
150 <     *   isEmpty is true when empty, else false
150 >     *  isEmpty is true when empty, else false
151       */
152      public void testIsEmpty() {
153          CopyOnWriteArraySet empty = new CopyOnWriteArraySet();
# Line 157 | Line 157 | public class CopyOnWriteArraySetTest ext
157      }
158  
159      /**
160 <     *   iterator() returns an iterator containing the elements of the set
160 >     *  iterator() returns an iterator containing the elements of the set
161       */
162      public void testIterator() {
163          CopyOnWriteArraySet full = populatedSet(3);
# Line 178 | Line 178 | public class CopyOnWriteArraySetTest ext
178          try {
179              it.remove();
180              shouldThrow();
181 <        }
182 <        catch (UnsupportedOperationException success) {}
181 >        } catch (UnsupportedOperationException success) {}
182      }
183  
184      /**
# Line 195 | Line 194 | public class CopyOnWriteArraySetTest ext
194  
195  
196      /**
197 <     *   removeAll  removes all elements from the given collection
197 >     *  removeAll  removes all elements from the given collection
198       */
199      public void testRemoveAll() {
200          CopyOnWriteArraySet full = populatedSet(3);
# Line 218 | Line 217 | public class CopyOnWriteArraySetTest ext
217      }
218  
219      /**
220 <     *   size returns the number of elements
220 >     *  size returns the number of elements
221       */
222      public void testSize() {
223          CopyOnWriteArraySet empty = new CopyOnWriteArraySet();
# Line 228 | Line 227 | public class CopyOnWriteArraySetTest ext
227      }
228  
229      /**
230 <     *   toArray returns an Object array containing all elements from the set
230 >     *  toArray returns an Object array containing all elements from the set
231       */
232      public void testToArray() {
233          CopyOnWriteArraySet full = populatedSet(3);
# Line 240 | Line 239 | public class CopyOnWriteArraySetTest ext
239      }
240  
241      /**
242 <     *   toArray returns an Integer array containing all elements from
243 <     *   the set
242 >     *  toArray returns an Integer array containing all elements from
243 >     *  the set
244       */
245      public void testToArray2() {
246          CopyOnWriteArraySet full = populatedSet(3);
# Line 271 | Line 270 | public class CopyOnWriteArraySetTest ext
270      /**
271       * A deserialized serialized set is equal
272       */
273 <    public void testSerialization() {
273 >    public void testSerialization() throws Exception {
274          CopyOnWriteArraySet q = populatedSet(SIZE);
275  
276 <        try {
277 <            ByteArrayOutputStream bout = new ByteArrayOutputStream(10000);
278 <            ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(bout));
279 <            out.writeObject(q);
280 <            out.close();
281 <
282 <            ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray());
283 <            ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin));
284 <            CopyOnWriteArraySet r = (CopyOnWriteArraySet)in.readObject();
285 <            assertEquals(q.size(), r.size());
286 <            assertTrue(q.equals(r));
288 <            assertTrue(r.equals(q));
289 <        } catch (Exception e) {
290 <            unexpectedException();
291 <        }
276 >        ByteArrayOutputStream bout = new ByteArrayOutputStream(10000);
277 >        ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(bout));
278 >        out.writeObject(q);
279 >        out.close();
280 >
281 >        ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray());
282 >        ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin));
283 >        CopyOnWriteArraySet r = (CopyOnWriteArraySet)in.readObject();
284 >        assertEquals(q.size(), r.size());
285 >        assertTrue(q.equals(r));
286 >        assertTrue(r.equals(q));
287      }
288  
289   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines