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

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines