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

Comparing jsr166/src/test/tck/PriorityBlockingQueueTest.java (file contents):
Revision 1.1 by dl, Sun Aug 31 19:24:55 2003 UTC vs.
Revision 1.2 by dl, Sun Sep 7 20:39:11 2003 UTC

# Line 8 | Line 8
8   import junit.framework.*;
9   import java.util.*;
10   import java.util.concurrent.*;
11 + import java.io.*;
12  
13   public class PriorityBlockingQueueTest extends TestCase {
14  
# Line 479 | Line 480 | public class PriorityBlockingQueueTest e
480              assertTrue(q.remove(new Integer(i)));
481              assertFalse(q.remove(new Integer(i+1)));
482          }
483 <        assert(q.isEmpty());
483 >        assertTrue(q.isEmpty());
484      }
485          
486      public void testContains(){
# Line 641 | Line 642 | public class PriorityBlockingQueueTest e
642  
643      }
644  
645 +    public void testSerialization() {
646 +        PriorityBlockingQueue q = fullQueue(N);
647 +        try {
648 +            ByteArrayOutputStream bout = new ByteArrayOutputStream(10000);
649 +            ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(bout));
650 +            out.writeObject(q);
651 +            out.close();
652 +
653 +            ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray());
654 +            ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin));
655 +            PriorityBlockingQueue r = (PriorityBlockingQueue)in.readObject();
656 +            assertEquals(q.size(), r.size());
657 +            while (!q.isEmpty())
658 +                assertEquals(q.remove(), r.remove());
659 +        } catch(Exception e){
660 +            fail("unexpected exception");
661 +        }
662 +    }
663 +
664   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines