You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by sm...@apache.org on 2006/08/10 10:34:31 UTC

svn commit: r430310 - 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/

Author: smishura
Date: Thu Aug 10 01:34:26 2006
New Revision: 430310

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

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/api/java/org/apache/harmony/luni/tests/java/util/MissingFormatWidthExceptionTest.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/MissingFormatWidthExceptionTest.java?rev=430310&r1=430309&r2=430310&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/api/java/org/apache/harmony/luni/tests/java/util/MissingFormatWidthExceptionTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/api/java/org/apache/harmony/luni/tests/java/util/MissingFormatWidthExceptionTest.java Thu Aug 10 01:34:26 2006
@@ -14,15 +14,15 @@
  */
 package org.apache.harmony.luni.tests.java.util;
 
+import java.io.Serializable;
 import java.util.MissingFormatWidthException;
 
-import tests.util.SerializationTester;
-
 import junit.framework.TestCase;
 
-public class MissingFormatWidthExceptionTest 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/MissingFormatWidthException.ser";
+public class MissingFormatWidthExceptionTest extends TestCase {
 
 	/**
 	 * @tests java.util.MissingFormatWidthException#MissingFormatWidthException(String)
@@ -58,33 +58,37 @@
 
 	}
 
-	/**
-	 * @tests serialization/deserilazation.
-	 */
-	public void test_serialization() throws Exception {
-		String s = "MYTESTSTRING";
-		MissingFormatWidthException srcMissingFormatWidthException = new MissingFormatWidthException(
-				s);
-		MissingFormatWidthException destMissingFormatWidthException = (MissingFormatWidthException) SerializationTester
-				.getDeserilizedObject(srcMissingFormatWidthException);
-		assertEquals(srcMissingFormatWidthException.getFormatSpecifier(),
-				destMissingFormatWidthException.getFormatSpecifier());
-
-	}
-
-	/**
-	 * @tests serialization/deserilazation compatibility with RI.
-	 */
-	public void test_serializationCompatibility() throws Exception {
-		String s = "MYTESTSTRING";
-		MissingFormatWidthException srcMissingFormatWidthException = new MissingFormatWidthException(
-				s);
-		MissingFormatWidthException destMissingFormatWidthException = (MissingFormatWidthException) SerializationTester
-				.readObject(srcMissingFormatWidthException,
-						SERIALIZATION_FILE_NAME);
-		assertEquals(srcMissingFormatWidthException.getFormatSpecifier(),
-				destMissingFormatWidthException.getFormatSpecifier());
-
-	}
-
+    // 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);
+
+            MissingFormatWidthException initEx = (MissingFormatWidthException) initial;
+            MissingFormatWidthException desrEx = (MissingFormatWidthException) deserialized;
+
+            assertEquals("FormatSpecifier", initEx.getFormatSpecifier(), desrEx
+                    .getFormatSpecifier());
+        }
+    };
+
+    /**
+     * @tests serialization/deserialization.
+     */
+    public void testSerializationSelf() throws Exception {
+
+        SerializationTest.verifySelf(new MissingFormatWidthException(
+                "MYTESTSTRING"), exComparator);
+    }
+
+    /**
+     * @tests serialization/deserialization compatibility with RI.
+     */
+    public void testSerializationCompatibility() throws Exception {
+
+        SerializationTest.verifyGolden(this, new MissingFormatWidthException(
+                "MYTESTSTRING"), exComparator);
+    }
 }