Author: smishura
Date: Thu Aug 10 01:46:01 2006
New Revision: 430313
URL: http://svn.apache.org/viewvc?rev=430313&view=rev
Log:
Refactoring MissingFormatArgumentExceptionTest 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/MissingFormatArgumentExceptionTest.golden.ser
- copied unchanged from r430309, incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/resources/serialization/java/util/MissingFormatArgumentException.ser
Removed:
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/resources/serialization/java/util/MissingFormatArgumentException.ser
Modified:
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/api/java/org/apache/harmony/luni/tests/java/util/MissingFormatArgumentExceptionTest.java
Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/api/java/org/apache/harmony/luni/tests/java/util/MissingFormatArgumentExceptionTest.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/MissingFormatArgumentExceptionTest.java?rev=430313&r1=430312&r2=430313&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/api/java/org/apache/harmony/luni/tests/java/util/MissingFormatArgumentExceptionTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/api/java/org/apache/harmony/luni/tests/java/util/MissingFormatArgumentExceptionTest.java
Thu Aug 10 01:46:01 2006
@@ -15,15 +15,15 @@
package org.apache.harmony.luni.tests.java.util;
+import java.io.Serializable;
import java.util.MissingFormatArgumentException;
-import tests.util.SerializationTester;
-
import junit.framework.TestCase;
-public class MissingFormatArgumentExceptionTest 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/MissingFormatArgumentException.ser";
+public class MissingFormatArgumentExceptionTest extends TestCase {
/**
* @tests java.util.MissingFormatArgumentException#MissingFormatArgumentException(String)
@@ -59,33 +59,38 @@
}
- /**
- * @tests serialization/deserilazation.
- */
- public void test_serialization() throws Exception {
- String s = "MYTESTSTRING";
- MissingFormatArgumentException srcMissingFormatArgumentException = new MissingFormatArgumentException(
- s);
- MissingFormatArgumentException destMissingFormatArgumentException = (MissingFormatArgumentException)
SerializationTester
- .getDeserilizedObject(srcMissingFormatArgumentException);
- assertEquals(srcMissingFormatArgumentException.getFormatSpecifier(),
- destMissingFormatArgumentException.getFormatSpecifier());
-
- }
-
- /**
- * @tests serialization/deserilazation compatibility with RI.
- */
- public void test_serializationCompatibility() throws Exception {
- String s = "MYTESTSTRING";
- MissingFormatArgumentException srcMissingFormatArgumentException = new MissingFormatArgumentException(
- s);
- MissingFormatArgumentException destMissingFormatArgumentException = (MissingFormatArgumentException)
SerializationTester
- .readObject(srcMissingFormatArgumentException,
- SERIALIZATION_FILE_NAME);
- assertEquals(srcMissingFormatArgumentException.getFormatSpecifier(),
- destMissingFormatArgumentException.getFormatSpecifier());
-
- }
-
+ // comparator for comparing MissingFormatArgumentException objects
+ private static final SerializableAssert exComparator = new SerializableAssert() {
+ public void assertDeserialized(Serializable initial,
+ Serializable deserialized) {
+
+ SerializationTest.THROWABLE_COMPARATOR.assertDeserialized(initial,
+ deserialized);
+
+ MissingFormatArgumentException initEx = (MissingFormatArgumentException) initial;
+ MissingFormatArgumentException desrEx = (MissingFormatArgumentException) deserialized;
+
+ assertEquals("FormatSpecifier", initEx.getFormatSpecifier(), desrEx
+ .getFormatSpecifier());
+ }
+ };
+
+ /**
+ * @tests serialization/deserialization.
+ */
+ public void testSerializationSelf() throws Exception {
+
+ SerializationTest.verifySelf(new MissingFormatArgumentException(
+ "MYTESTSTRING"), exComparator);
+ }
+
+ /**
+ * @tests serialization/deserialization compatibility with RI.
+ */
+ public void testSerializationCompatibility() throws Exception {
+
+ SerializationTest.verifyGolden(this,
+ new MissingFormatArgumentException("MYTESTSTRING"),
+ exComparator);
+ }
}
|