harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smish...@apache.org
Subject svn commit: r414160 - /incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/support/common/java/org/apache/harmony/security/tests/support/SerializationTest.java
Date Wed, 14 Jun 2006 09:08:24 GMT
Author: smishura
Date: Wed Jun 14 02:08:24 2006
New Revision: 414160

URL: http://svn.apache.org/viewvc?rev=414160&view=rev
Log:
Removing assertDeserialized(Object, Object). Adding javadocs.

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/support/common/java/org/apache/harmony/security/tests/support/SerializationTest.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/support/common/java/org/apache/harmony/security/tests/support/SerializationTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/support/common/java/org/apache/harmony/security/tests/support/SerializationTest.java?rev=414160&r1=414159&r2=414160&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/support/common/java/org/apache/harmony/security/tests/support/SerializationTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/support/common/java/org/apache/harmony/security/tests/support/SerializationTest.java
Wed Jun 14 02:08:24 2006
@@ -35,10 +35,8 @@
 import java.lang.reflect.Method;
 import java.security.Permission;
 import java.security.PermissionCollection;
-import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
-import java.util.Enumeration;
 import java.util.HashSet;
 
 import junit.framework.TestCase;
@@ -130,16 +128,6 @@
     protected abstract Object[] getData();
 
     /**
-     * Compares deserialized and reference objects. This default implementation
-     * just asserts equality of the two objects. Should be overriden if a class
-     * under test does not provide specific equals() method and it's instances
-     * should to be compared manually.
-     */
-    protected void assertDeserialized(Object reference, Object test) {
-        assertEquals(reference, test);
-    }
-
-    /**
      * Tests that data objects can be serialized and deserialized without
      * exceptions, and that deserialization really produces deeply cloned
      * objects.
@@ -235,8 +223,15 @@
     
     /**
      * Interface to compare (de)serialized objects
+     * 
+     * Should be implemented if a class under test does not provide specific
+     * equals() method and it's instances should to be compared manually.
      */
     public interface SerializableAssert {
+        
+        /**
+         * Compares deserialized and reference objects.
+         */
         void assertDeserialized(Serializable reference, Serializable test);
     }
 
@@ -247,7 +242,9 @@
         }
     };
 
-    // for comparing java.lang.Throwable objects
+    /**
+     * Comparator for java.lang.Throwable objects
+     */
     public final static SerializableAssert THROWABLE_COMPARATOR = new SerializableAssert()
{
         public void assertDeserialized(Serializable reference, Serializable test) {
 
@@ -275,7 +272,9 @@
         }
     };
 
-    // for comparing java.security.PermissionCollection objects
+    /**
+     * Comparator for java.security.PermissionCollection objects
+     */
     public final static SerializableAssert PERMISSION_COLLECTION_COMPARATOR = new SerializableAssert()
{
         public void assertDeserialized(Serializable reference, Serializable test) {
 
@@ -327,14 +326,6 @@
             return PERMISSION_COLLECTION_COMPARATOR;
         }
 
-        // TODO - throw new RuntimeException() if failed to detect comparator
-        // return stub comparator for a while
-        final SerializationTest thisTest = this;
-        return new SerializableAssert() {
-            public void assertDeserialized(Serializable reference,
-                    Serializable test) {
-                thisTest.assertDeserialized(reference, test);
-            }
-        };
+        throw new RuntimeException("Failed to detect comparator");
     }
 }



Mime
View raw message