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

Comparing jsr166/src/test/tck/AtomicBooleanTest.java (file contents):
Revision 1.18 by jsr166, Tue Mar 15 19:47:06 2011 UTC vs.
Revision 1.19 by jsr166, Tue May 31 16:16:23 2011 UTC

# Line 7 | Line 7
7   */
8  
9   import junit.framework.*;
10 < import java.util.concurrent.atomic.*;
11 < import java.io.*;
10 > import java.util.concurrent.atomic.AtomicBoolean;
11  
12   public class AtomicBooleanTest extends JSR166TestCase {
13      public static void main(String[] args) {
# Line 119 | Line 118 | public class AtomicBooleanTest extends J
118       * a deserialized serialized atomic holds same value
119       */
120      public void testSerialization() throws Exception {
121 <        AtomicBoolean l = new AtomicBoolean();
122 <
123 <        l.set(true);
124 <        ByteArrayOutputStream bout = new ByteArrayOutputStream(10000);
125 <        ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(bout));
126 <        out.writeObject(l);
127 <        out.close();
129 <
130 <        ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray());
131 <        ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin));
132 <        AtomicBoolean r = (AtomicBoolean) in.readObject();
133 <        assertEquals(l.get(), r.get());
121 >        AtomicBoolean x = new AtomicBoolean();
122 >        AtomicBoolean y = serialClone(x);
123 >        x.set(true);
124 >        AtomicBoolean z = serialClone(x);
125 >        assertTrue(x.get());
126 >        assertFalse(y.get());
127 >        assertTrue(z.get());
128      }
129  
130      /**

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines