avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nic...@apache.org
Subject svn commit: rev 30908 - avalon/trunk/runtime/framework/impl/src/test/org/apache/avalon/framework/parameters/test
Date Thu, 29 Jul 2004 06:55:08 GMT
Author: niclas
Date: Wed Jul 28 23:55:08 2004
New Revision: 30908

Modified:
   avalon/trunk/runtime/framework/impl/src/test/org/apache/avalon/framework/parameters/test/ParameterTestCase.java
Log:
Testcase in Parameters showing that a cloned (deep-copy) instance is not considered equal.

Modified: avalon/trunk/runtime/framework/impl/src/test/org/apache/avalon/framework/parameters/test/ParameterTestCase.java
==============================================================================
--- avalon/trunk/runtime/framework/impl/src/test/org/apache/avalon/framework/parameters/test/ParameterTestCase.java
(original)
+++ avalon/trunk/runtime/framework/impl/src/test/org/apache/avalon/framework/parameters/test/ParameterTestCase.java
Wed Jul 28 23:55:08 2004
@@ -15,7 +15,7 @@
  */
 package org.apache.avalon.framework.parameters.test;
 
-import java.io.ByteArrayInputStream;
+import java.io.*;
 import java.util.Properties;
 
 import junit.framework.TestCase;
@@ -140,5 +140,26 @@
         {
             fail( pe.getMessage() );
         }
+    }
+
+    public void testSerialization() 
+        throws Exception
+    {
+        Parameters p = Parameters.EMPTY_PARAMETERS;
+        
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        
+        ObjectOutputStream oos = new ObjectOutputStream( baos );
+        oos.writeObject( p );
+        oos.close();
+        byte[] ba = baos.toByteArray();
+        
+        ByteArrayInputStream bais = new ByteArrayInputStream( ba );
+        ObjectInputStream ois = new ObjectInputStream( bais );
+        Parameters serialized = (Parameters) ois.readObject();
+        ois.close();
+
+        assertEquals( "equality", p, serialized );
+        assertEquals( "hashcode", p.hashCode(), serialized.hashCode() );
     }
 }

---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@avalon.apache.org
For additional commands, e-mail: cvs-help@avalon.apache.org


Mime
View raw message