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

Comparing jsr166/src/test/tck/AtomicIntegerArrayTest.java (file contents):
Revision 1.21 by jsr166, Fri May 27 19:39:07 2011 UTC vs.
Revision 1.22 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.*;
12 < import java.util.*;
10 > import java.util.Arrays;
11 > import java.util.concurrent.atomic.AtomicIntegerArray;
12  
13   public class AtomicIntegerArrayTest extends JSR166TestCase {
14  
# Line 310 | Line 309 | public class AtomicIntegerArrayTest exte
309       * a deserialized serialized array holds same values
310       */
311      public void testSerialization() throws Exception {
312 <        AtomicIntegerArray l = new AtomicIntegerArray(SIZE);
313 <        for (int i = 0; i < SIZE; ++i)
314 <            l.set(i, -i);
315 <
316 <        ByteArrayOutputStream bout = new ByteArrayOutputStream(10000);
317 <        ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(bout));
318 <        out.writeObject(l);
319 <        out.close();
321 <
322 <        ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray());
323 <        ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin));
324 <        AtomicIntegerArray r = (AtomicIntegerArray) in.readObject();
325 <        for (int i = 0; i < SIZE; ++i) {
326 <            assertEquals(l.get(i), r.get(i));
312 >        AtomicIntegerArray x = new AtomicIntegerArray(SIZE);
313 >        for (int i = 0; i < SIZE; i++)
314 >            x.set(i, -i);
315 >        AtomicIntegerArray y = serialClone(x);
316 >        assertTrue(x != y);
317 >        assertEquals(x.length(), y.length());
318 >        for (int i = 0; i < SIZE; i++) {
319 >            assertEquals(x.get(i), y.get(i));
320          }
321      }
322  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines