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

Comparing jsr166/src/test/tck/LinkedBlockingDequeTest.java (file contents):
Revision 1.40 by jsr166, Mon May 30 22:43:20 2011 UTC vs.
Revision 1.41 by jsr166, Tue May 31 16:16:24 2011 UTC

# Line 10 | Line 10 | import java.util.ArrayList;
10   import java.util.Collection;
11   import java.util.Iterator;
12   import java.util.NoSuchElementException;
13 + import java.util.Queue;
14   import java.util.concurrent.BlockingDeque;
15   import java.util.concurrent.BlockingQueue;
16   import java.util.concurrent.CountDownLatch;
# Line 17 | Line 18 | import java.util.concurrent.Executors;
18   import java.util.concurrent.ExecutorService;
19   import java.util.concurrent.LinkedBlockingDeque;
20   import static java.util.concurrent.TimeUnit.MILLISECONDS;
20 import java.io.*;
21  
22   public class LinkedBlockingDequeTest extends JSR166TestCase {
23  
# Line 1718 | Line 1718 | public class LinkedBlockingDequeTest ext
1718       * A deserialized serialized deque has same elements in same order
1719       */
1720      public void testSerialization() throws Exception {
1721 <        LinkedBlockingDeque q = populatedDeque(SIZE);
1721 >        Queue x = populatedDeque(SIZE);
1722 >        Queue y = serialClone(x);
1723  
1724 <        ByteArrayOutputStream bout = new ByteArrayOutputStream(10000);
1725 <        ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(bout));
1726 <        out.writeObject(q);
1727 <        out.close();
1728 <
1729 <        ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray());
1730 <        ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin));
1731 <        LinkedBlockingDeque r = (LinkedBlockingDeque)in.readObject();
1732 <        assertEquals(q.size(), r.size());
1732 <        while (!q.isEmpty())
1733 <            assertEquals(q.remove(), r.remove());
1724 >        assertTrue(x != y);
1725 >        assertEquals(x.size(), y.size());
1726 >        assertEquals(x.toString(), y.toString());
1727 >        assertTrue(Arrays.equals(x.toArray(), y.toArray()));
1728 >        while (!x.isEmpty()) {
1729 >            assertFalse(y.isEmpty());
1730 >            assertEquals(x.remove(), y.remove());
1731 >        }
1732 >        assertTrue(y.isEmpty());
1733      }
1734  
1735      /**

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines