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

Comparing jsr166/src/test/tck/ConcurrentLinkedQueueTest.java (file contents):
Revision 1.26 by jsr166, Fri May 27 19:49:56 2011 UTC vs.
Revision 1.27 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.concurrent.ConcurrentLinkedQueue;
16  
17   public class ConcurrentLinkedQueueTest extends JSR166TestCase {
18  
# Line 497 | Line 500 | public class ConcurrentLinkedQueueTest e
500       * A deserialized serialized queue has same elements in same order
501       */
502      public void testSerialization() throws Exception {
503 <        ConcurrentLinkedQueue q = populatedQueue(SIZE);
504 <        ByteArrayOutputStream bout = new ByteArrayOutputStream(10000);
505 <        ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(bout));
506 <        out.writeObject(q);
507 <        out.close();
508 <
509 <        ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray());
510 <        ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin));
511 <        ConcurrentLinkedQueue r = (ConcurrentLinkedQueue)in.readObject();
512 <        assertEquals(q.size(), r.size());
513 <        while (!q.isEmpty())
514 <            assertEquals(q.remove(), r.remove());
503 >        Queue x = populatedQueue(SIZE);
504 >        Queue y = serialClone(x);
505 >
506 >        assertTrue(x != y);
507 >        assertEquals(x.size(), y.size());
508 >        assertEquals(x.toString(), y.toString());
509 >        assertTrue(Arrays.equals(x.toArray(), y.toArray()));
510 >        while (!x.isEmpty()) {
511 >            assertFalse(y.isEmpty());
512 >            assertEquals(x.remove(), y.remove());
513 >        }
514 >        assertTrue(y.isEmpty());
515      }
516  
517   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines