harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smish...@apache.org
Subject svn commit: r430297 - 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 07:44:46 GMT
Author: smishura
Date: Thu Aug 10 00:44:43 2006
New Revision: 430297

URL: http://svn.apache.org/viewvc?rev=430297&view=rev
Log:
Refactoring UnknownFormatFlagsException 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/UnknownFormatFlagsExceptionTest.golden.ser
      - copied unchanged from r430209, incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/resources/serialization/java/util/UnknownFormatFlagsException.ser
Removed:
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/resources/serialization/java/util/UnknownFormatFlagsException.ser
Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/api/java/org/apache/harmony/luni/tests/java/util/UnknownFormatFlagsExceptionTest.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/api/java/org/apache/harmony/luni/tests/java/util/UnknownFormatFlagsExceptionTest.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/UnknownFormatFlagsExceptionTest.java?rev=430297&r1=430296&r2=430297&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/api/java/org/apache/harmony/luni/tests/java/util/UnknownFormatFlagsExceptionTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/api/java/org/apache/harmony/luni/tests/java/util/UnknownFormatFlagsExceptionTest.java
Thu Aug 10 00:44:43 2006
@@ -15,15 +15,16 @@
 
 package org.apache.harmony.luni.tests.java.util;
 
+import java.io.Serializable;
 import java.util.UnknownFormatFlagsException;
 
-import tests.util.SerializationTester;
-
 import junit.framework.TestCase;
 
+import org.apache.harmony.testframework.serialization.SerializationTest;
+import org.apache.harmony.testframework.serialization.SerializationTest.SerializableAssert;
+
 public class UnknownFormatFlagsExceptionTest extends TestCase {
 
-	private static final String SERIALIZATION_FILE_NAME = "serialization/java/util/UnknownFormatFlagsException.ser";
 
 	/**
 	 * @tests java.util.UnknownFormatFlagsException#UnknownFormatFlagsException(String)
@@ -61,33 +62,36 @@
 		assertNotNull(UnknownFormatFlagsException.getMessage());
 	}
 
-	/**
-	 * @tests serialization/deserilazation.
-	 */
-	public void test_serialization() throws Exception {
-		String s = "MYTESTSTRING";
-		UnknownFormatFlagsException srcUnknownFormatFlagsException = new UnknownFormatFlagsException(
-				s);
-		UnknownFormatFlagsException destUnknownFormatFlagsException = (UnknownFormatFlagsException)
SerializationTester
-				.getDeserilizedObject(srcUnknownFormatFlagsException);
-		assertEquals(srcUnknownFormatFlagsException.getFlags(),
-				destUnknownFormatFlagsException.getFlags());
-
-	}
-
-	/**
-	 * @tests serialization/deserilazation compatibility with RI.
-	 */
-	public void test_serializationCompatibility() throws Exception {
-		String s = "MYTESTSTRING";
-		UnknownFormatFlagsException srcUnknownFormatFlagsException = new UnknownFormatFlagsException(
-				s);
-		UnknownFormatFlagsException destUnknownFormatFlagsException = (UnknownFormatFlagsException)
SerializationTester
-				.readObject(srcUnknownFormatFlagsException,
-						SERIALIZATION_FILE_NAME);
-		assertEquals(srcUnknownFormatFlagsException.getFlags(),
-				destUnknownFormatFlagsException.getFlags());
-
-	}
-
+    // comparator for comparing UnknownFormatFlagsException objects
+    private static final SerializableAssert exComparator = new SerializableAssert() {
+        public void assertDeserialized(Serializable initial,
+                Serializable deserialized) {
+
+            SerializationTest.THROWABLE_COMPARATOR.assertDeserialized(initial,
+                    deserialized);
+
+            UnknownFormatFlagsException initEx = (UnknownFormatFlagsException) initial;
+            UnknownFormatFlagsException desrEx = (UnknownFormatFlagsException) deserialized;
+
+            assertEquals("Flags", initEx.getFlags(), desrEx.getFlags());
+        }
+    };
+
+    /**
+     * @tests serialization/deserialization.
+     */
+    public void testSerializationSelf() throws Exception {
+
+        SerializationTest.verifySelf(new UnknownFormatFlagsException(
+                "MYTESTSTRING"), exComparator);
+    }
+
+    /**
+     * @tests serialization/deserialization compatibility with RI.
+     */
+    public void testSerializationCompatibility() throws Exception {
+
+        SerializationTest.verifyGolden(this, new UnknownFormatFlagsException(
+                "MYTESTSTRING"), exComparator);
+    }
 }



Mime
View raw message