svn commit: rev 30908 - avalon/trunk/runtime/framework/impl/src/test/org/apache/avalon/framework/parameters/test

[email protected]
Newsgroups gmane.comp.jakarta.avalon.cvs
Message-ID <[email protected]>
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() );
     }
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.