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

Comparing jsr166/src/test/tck/PriorityQueueTest.java (file contents):
Revision 1.22 by jsr166, Fri May 27 19:52:35 2011 UTC vs.
Revision 1.23 by jsr166, Tue May 31 16:16:24 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.Comparator;
13 > import java.util.Iterator;
14 > import java.util.NoSuchElementException;
15 > import java.util.PriorityQueue;
16 > import java.util.Queue;
17  
18   public class PriorityQueueTest extends JSR166TestCase {
19      public static void main(String[] args) {
# Line 478 | Line 482 | public class PriorityQueueTest extends J
482       * A deserialized serialized queue has same elements
483       */
484      public void testSerialization() throws Exception {
485 <        PriorityQueue q = populatedQueue(SIZE);
486 <        ByteArrayOutputStream bout = new ByteArrayOutputStream(10000);
487 <        ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(bout));
488 <        out.writeObject(q);
489 <        out.close();
490 <
491 <        ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray());
492 <        ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin));
493 <        PriorityQueue r = (PriorityQueue)in.readObject();
494 <        assertEquals(q.size(), r.size());
491 <        while (!q.isEmpty())
492 <            assertEquals(q.remove(), r.remove());
485 >        Queue x = populatedQueue(SIZE);
486 >        Queue y = serialClone(x);
487 >
488 >        assertTrue(x != y);
489 >        assertEquals(x.size(), y.size());
490 >        while (!x.isEmpty()) {
491 >            assertFalse(y.isEmpty());
492 >            assertEquals(x.remove(), y.remove());
493 >        }
494 >        assertTrue(y.isEmpty());
495      }
496   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines