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

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

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

revision 1.1, Sun Aug 31 19:24:56 2003 UTC revision 1.2, Sun Sep 7 20:39:11 2003 UTC
# Line 8  Line 8 
8    
9  import junit.framework.*;  import junit.framework.*;
10  import java.util.concurrent.*;  import java.util.concurrent.*;
11    import java.io.*;
12    
13  public class TimeUnitTest extends TestCase {  public class TimeUnitTest extends TestCase {
14        static public boolean DEBUG = false;        static public boolean DEBUG = false;
# Line 241  Line 242 
242              fail("Unexpected exception");              fail("Unexpected exception");
243          }          }
244      }      }
245    
246        public void testSerialization() {
247            TimeUnit q = TimeUnit.MILLISECONDS;
248    
249            try {
250                ByteArrayOutputStream bout = new ByteArrayOutputStream(10000);
251                ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(bout));
252                out.writeObject(q);
253                out.close();
254    
255                ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray());
256                ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin));
257                TimeUnit r = (TimeUnit)in.readObject();
258    
259                assertEquals(q.toString(), r.toString());
260            } catch(Exception e){
261                e.printStackTrace();
262                fail("unexpected exception");
263            }
264        }
265    
266  }  }

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

Doug Lea
ViewVC Help
Powered by ViewVC 1.0.8