harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smish...@apache.org
Subject svn commit: r430302 - in /incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test: api/java/org/apache/harmony/luni/tests/java/util/ resources/serialization/java/util/ resources/serialization/org/apache/harmony/luni/tests/java/util/
Date Thu, 10 Aug 2006 08:13:36 GMT
Author: smishura
Date: Thu Aug 10 01:13:33 2006
New Revision: 430302

URL: http://svn.apache.org/viewvc?rev=430302&view=rev
Log:
Refactoring UnknownFormatConversionException serialization tests to use new framework

Added:
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/resources/serialization/org/apache/harmony/luni/tests/java/util/UnknownFormatConversionExceptionTest.golden.ser
      - copied unchanged from r430209, incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/resources/serialization/java/util/UnknownFormatConversionException.ser
Removed:
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/resources/serialization/java/util/UnknownFormatConversionException.ser
Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/api/java/org/apache/harmony/luni/tests/java/util/UnknownFormatConversionExceptionTest.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/api/java/org/apache/harmony/luni/tests/java/util/UnknownFormatConversionExceptionTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/api/java/org/apache/harmony/luni/tests/java/util/UnknownFormatConversionExceptionTest.java?rev=430302&r1=430301&r2=430302&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/api/java/org/apache/harmony/luni/tests/java/util/UnknownFormatConversionExceptionTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/api/java/org/apache/harmony/luni/tests/java/util/UnknownFormatConversionExceptionTest.java
Thu Aug 10 01:13:33 2006
@@ -14,15 +14,15 @@
  */
 package org.apache.harmony.luni.tests.java.util;
 
+import java.io.Serializable;
 import java.util.UnknownFormatConversionException;
 
-import tests.util.SerializationTester;
-
 import junit.framework.TestCase;
 
-public class UnknownFormatConversionExceptionTest extends TestCase {
+import org.apache.harmony.testframework.serialization.SerializationTest;
+import org.apache.harmony.testframework.serialization.SerializationTest.SerializableAssert;
 
-	private static final String SERIALIZATION_FILE_NAME = "serialization/java/util/UnknownFormatConversionException.ser";
+public class UnknownFormatConversionExceptionTest extends TestCase {
 
 	/**
 	 * @tests java.util.UnknownFormatConversionException#UnknownFormatConversionException(String)
@@ -63,33 +63,38 @@
 
 	}
 
-	/**
-	 * @tests serialization/deserilazation.
-	 */
-	public void test_serialization() throws Exception {
-		String s = "MYTESTSTRING";
-		UnknownFormatConversionException srcUnknownFormatConversionException = new UnknownFormatConversionException(
-				s);
-		UnknownFormatConversionException destUnknownFormatConversionException = (UnknownFormatConversionException)
SerializationTester
-				.getDeserilizedObject(srcUnknownFormatConversionException);
-		assertEquals(srcUnknownFormatConversionException.getConversion(),
-				destUnknownFormatConversionException.getConversion());
-
-	}
-
-	/**
-	 * @tests serialization/deserilazation compatibility with RI.
-	 */
-	public void test_serializationCompatibility() throws Exception {
-		String s = "MYTESTSTRING";
-		UnknownFormatConversionException srcUnknownFormatConversionException = new UnknownFormatConversionException(
-				s);
-		UnknownFormatConversionException destUnknownFormatConversionException = (UnknownFormatConversionException)
SerializationTester
-				.readObject(srcUnknownFormatConversionException,
-						SERIALIZATION_FILE_NAME);
-		assertEquals(srcUnknownFormatConversionException.getConversion(),
-				destUnknownFormatConversionException.getConversion());
-
-	}
-
+    // comparator for comparing UnknownFormatConversionException objects
+    private static final SerializableAssert exComparator = new SerializableAssert() {
+        public void assertDeserialized(Serializable initial,
+                Serializable deserialized) {
+
+            SerializationTest.THROWABLE_COMPARATOR.assertDeserialized(initial,
+                    deserialized);
+
+            UnknownFormatConversionException initEx = (UnknownFormatConversionException)
initial;
+            UnknownFormatConversionException desrEx = (UnknownFormatConversionException)
deserialized;
+
+            assertEquals("Conversion", initEx.getConversion(), desrEx
+                    .getConversion());
+        }
+    };
+
+    /**
+     * @tests serialization/deserialization.
+     */
+    public void testSerializationSelf() throws Exception {
+
+        SerializationTest.verifySelf(new UnknownFormatConversionException(
+                "MYTESTSTRING"), exComparator);
+    }
+
+    /**
+     * @tests serialization/deserialization compatibility with RI.
+     */
+    public void testSerializationCompatibility() throws Exception {
+
+        SerializationTest.verifyGolden(this,
+                new UnknownFormatConversionException("MYTESTSTRING"),
+                exComparator);
+    }
 }



Mime
View raw message