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

Comparing jsr166/src/test/tck/ConcurrentLinkedDequeTest.java (file contents):
Revision 1.8 by jsr166, Fri May 27 19:47:55 2011 UTC vs.
Revision 1.9 by jsr166, Tue May 31 16:16:23 2011 UTC

# Line 7 | Line 7
7   */
8  
9   import junit.framework.*;
10 < import java.util.*;
11 < import java.util.concurrent.*;
12 < import java.io.*;
10 > import java.util.Arrays;
11 > import java.util.Collection;
12 > import java.util.Iterator;
13 > import java.util.NoSuchElementException;
14 > import java.util.Queue;
15 > import java.util.Random;
16 > import java.util.concurrent.ConcurrentLinkedDeque;
17  
18   public class ConcurrentLinkedDequeTest extends JSR166TestCase {
19  
# Line 843 | Line 847 | public class ConcurrentLinkedDequeTest e
847       * A deserialized serialized deque has same elements in same order
848       */
849      public void testSerialization() throws Exception {
850 <        ConcurrentLinkedDeque q = populatedDeque(SIZE);
851 <        ByteArrayOutputStream bout = new ByteArrayOutputStream(10000);
852 <        ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(bout));
853 <        out.writeObject(q);
854 <        out.close();
855 <
856 <        ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray());
857 <        ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin));
858 <        ConcurrentLinkedDeque r = (ConcurrentLinkedDeque)in.readObject();
859 <        assertEquals(q.size(), r.size());
860 <        while (!q.isEmpty())
861 <            assertEquals(q.remove(), r.remove());
850 >        Queue x = populatedDeque(SIZE);
851 >        Queue y = serialClone(x);
852 >
853 >        assertTrue(x != y);
854 >        assertEquals(x.size(), y.size());
855 >        assertEquals(x.toString(), y.toString());
856 >        assertTrue(Arrays.equals(x.toArray(), y.toArray()));
857 >        while (!x.isEmpty()) {
858 >            assertFalse(y.isEmpty());
859 >            assertEquals(x.remove(), y.remove());
860 >        }
861 >        assertTrue(y.isEmpty());
862      }
863  
864   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines