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

Comparing jsr166/src/test/tck/SynchronousQueueTest.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 SynchronousQueueTest extends TestCase {
14  
# Line 288 | Line 289 | public class SynchronousQueueTest extend
289          for (int i = 1; i < N; i+=2) {
290              assertFalse(q.remove(new Integer(i)));
291          }
292 <        assert(q.isEmpty());
292 >        assertTrue(q.isEmpty());
293      }
294          
295      public void testContains(){
# Line 440 | Line 441 | public class SynchronousQueueTest extend
441  
442      }
443  
444 +    public void testSerialization() {
445 +        SynchronousQueue q = new SynchronousQueue();
446 +        try {
447 +            ByteArrayOutputStream bout = new ByteArrayOutputStream(10000);
448 +            ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(bout));
449 +            out.writeObject(q);
450 +            out.close();
451 +
452 +            ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray());
453 +            ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin));
454 +            SynchronousQueue r = (SynchronousQueue)in.readObject();
455 +            assertEquals(q.size(), r.size());
456 +            while (!q.isEmpty())
457 +                assertEquals(q.remove(), r.remove());
458 +        } catch(Exception e){
459 +            fail("unexpected exception");
460 +        }
461 +    }
462 +
463   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines