[cvs] / jsr166 / src / test / tck / AtomicBooleanTest.java Repository:
ViewVC logotype

Diff of /jsr166/src/test/tck/AtomicBooleanTest.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.18, Tue Mar 15 19:47:06 2011 UTC revision 1.19, Tue May 31 16:16:23 2011 UTC
# Line 7  Line 7 
7   */   */
8    
9  import junit.framework.*;  import junit.framework.*;
10  import java.util.concurrent.atomic.*;  import java.util.concurrent.atomic.AtomicBoolean;
 import java.io.*;  
11    
12  public class AtomicBooleanTest extends JSR166TestCase {  public class AtomicBooleanTest extends JSR166TestCase {
13      public static void main(String[] args) {      public static void main(String[] args) {
# Line 119  Line 118 
118       * a deserialized serialized atomic holds same value       * a deserialized serialized atomic holds same value
119       */       */
120      public void testSerialization() throws Exception {      public void testSerialization() throws Exception {
121          AtomicBoolean l = new AtomicBoolean();          AtomicBoolean x = new AtomicBoolean();
122            AtomicBoolean y = serialClone(x);
123          l.set(true);          x.set(true);
124          ByteArrayOutputStream bout = new ByteArrayOutputStream(10000);          AtomicBoolean z = serialClone(x);
125          ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(bout));          assertTrue(x.get());
126          out.writeObject(l);          assertFalse(y.get());
127          out.close();          assertTrue(z.get());
   
         ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray());  
         ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin));  
         AtomicBoolean r = (AtomicBoolean) in.readObject();  
         assertEquals(l.get(), r.get());  
128      }      }
129    
130      /**      /**

Legend:
Removed from v.1.18  
changed lines
  Added in v.1.19

Doug Lea
ViewVC Help
Powered by ViewVC 1.0.8