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

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

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

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

Legend:
Removed from v.1.21  
changed lines
  Added in v.1.22

Doug Lea
ViewVC Help
Powered by ViewVC 1.0.8