harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smish...@apache.org
Subject svn commit: r431782 - in /incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test: java/org/apache/harmony/luni/tests/java/util/ resources/serialization/java/util/ resources/serialization/org/apache/harmony/luni/tests/java/util/
Date Wed, 16 Aug 2006 03:02:28 GMT
Author: smishura
Date: Tue Aug 15 20:02:27 2006
New Revision: 431782

URL: http://svn.apache.org/viewvc?rev=431782&view=rev
Log:
Refactoring 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/DuplicateFormatFlagsExceptionTest.golden.ser
      - copied unchanged from r431764, incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/resources/serialization/java/util/DuplicateFormatFlagsException.ser
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/resources/serialization/org/apache/harmony/luni/tests/java/util/FormatFlagsConversionMismatchExceptionTest.golden.ser
      - copied unchanged from r431764, incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/resources/serialization/java/util/FormatFlagsConversionMismatchException.ser
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/resources/serialization/org/apache/harmony/luni/tests/java/util/IllegalFormatCodePointExceptionTest.golden.ser
      - copied unchanged from r431764, incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/resources/serialization/java/util/IllegalFormatCodePointException.ser
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/resources/serialization/org/apache/harmony/luni/tests/java/util/IllegalFormatConversionExceptionTest.golden.ser
      - copied unchanged from r431764, incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/resources/serialization/java/util/IllegalFormatConversionException.ser
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/resources/serialization/org/apache/harmony/luni/tests/java/util/IllegalFormatFlagsExceptionTest.golden.ser
      - copied unchanged from r431764, incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/resources/serialization/java/util/IllegalFormatFlagsException.ser
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/resources/serialization/org/apache/harmony/luni/tests/java/util/IllegalFormatPrecisionExceptionTest.golden.ser
      - copied unchanged from r431764, incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/resources/serialization/java/util/IllegalFormatPrecisionException.ser
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/resources/serialization/org/apache/harmony/luni/tests/java/util/IllegalFormatWidthExceptionTest.golden.ser
      - copied unchanged from r431764, incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/resources/serialization/java/util/IllegalFormatWidthException.ser
Removed:
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/resources/serialization/java/util/DuplicateFormatFlagsException.ser
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/resources/serialization/java/util/FormatFlagsConversionMismatchException.ser
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/resources/serialization/java/util/IllegalFormatCodePointException.ser
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/resources/serialization/java/util/IllegalFormatConversionException.ser
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/resources/serialization/java/util/IllegalFormatFlagsException.ser
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/resources/serialization/java/util/IllegalFormatPrecisionException.ser
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/resources/serialization/java/util/IllegalFormatWidthException.ser
Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/util/DuplicateFormatFlagsExceptionTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/util/FormatFlagsConversionMismatchExceptionTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/util/IllegalFormatCodePointExceptionTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/util/IllegalFormatConversionExceptionTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/util/IllegalFormatFlagsExceptionTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/util/IllegalFormatPrecisionExceptionTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/util/IllegalFormatWidthExceptionTest.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/util/DuplicateFormatFlagsExceptionTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/util/DuplicateFormatFlagsExceptionTest.java?rev=431782&r1=431781&r2=431782&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/util/DuplicateFormatFlagsExceptionTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/util/DuplicateFormatFlagsExceptionTest.java
Tue Aug 15 20:02:27 2006
@@ -15,15 +15,15 @@
 
 package org.apache.harmony.luni.tests.java.util;
 
+import java.io.Serializable;
 import java.util.DuplicateFormatFlagsException;
 
-import tests.util.SerializationTester;
-
 import junit.framework.TestCase;
 
-public class DuplicateFormatFlagsExceptionTest 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/DuplicateFormatFlagsException.ser";
//$NON-NLS-1$
+public class DuplicateFormatFlagsExceptionTest extends TestCase {
 
 	/**
 	 * @tests java.util.DuplicateFormatFlagsException#DuplicateFormatFlagsException(String)
@@ -58,25 +58,36 @@
 
 	}
 
-	/**
-	 * @tests serialization/deserilazation.
-	 */
-	public void test_serialization() throws Exception {
-		DuplicateFormatFlagsException srcDuplicateFormatFlagsException = new DuplicateFormatFlagsException(
-				"TESTDESC");
-		DuplicateFormatFlagsException destDuplicateFormatFlagsException = (DuplicateFormatFlagsException)
SerializationTester
-				.getDeserilizedObject(srcDuplicateFormatFlagsException);
-	}
-
-	/**
-	 * @tests serialization/deserilazation compatibility with RI.
-	 */
-	public void test_serializationCompatibility() throws Exception {
-		DuplicateFormatFlagsException srcDuplicateFormatFlagsException = new DuplicateFormatFlagsException(
-				"TESTDESC");
-		DuplicateFormatFlagsException destDuplicateFormatFlagsException = (DuplicateFormatFlagsException)
SerializationTester
-				.readObject(srcDuplicateFormatFlagsException,
-						SERIALIZATION_FILE_NAME);
-	}
-
+    // comparator for DuplicateFormatFlagsException objects
+    private static final SerializableAssert exComparator = new SerializableAssert() {
+        public void assertDeserialized(Serializable initial,
+                Serializable deserialized) {
+
+            SerializationTest.THROWABLE_COMPARATOR.assertDeserialized(initial,
+                    deserialized);
+
+            DuplicateFormatFlagsException initEx = (DuplicateFormatFlagsException) initial;
+            DuplicateFormatFlagsException desrEx = (DuplicateFormatFlagsException) deserialized;
+
+            assertEquals("Flags", initEx.getFlags(), desrEx.getFlags());
+        }
+    };
+
+    /**
+     * @tests serialization/deserialization.
+     */
+    public void testSerializationSelf() throws Exception {
+
+        SerializationTest.verifySelf(new DuplicateFormatFlagsException(
+                "TESTDESC"), exComparator);
+    }
+
+    /**
+     * @tests serialization/deserialization compatibility with RI.
+     */
+    public void testSerializationCompatibility() throws Exception {
+
+        SerializationTest.verifyGolden(this, new DuplicateFormatFlagsException(
+                "TESTDESC"), exComparator);
+    }
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/util/FormatFlagsConversionMismatchExceptionTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/util/FormatFlagsConversionMismatchExceptionTest.java?rev=431782&r1=431781&r2=431782&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/util/FormatFlagsConversionMismatchExceptionTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/util/FormatFlagsConversionMismatchExceptionTest.java
Tue Aug 15 20:02:27 2006
@@ -15,15 +15,15 @@
 
 package org.apache.harmony.luni.tests.java.util;
 
+import java.io.Serializable;
 import java.util.FormatFlagsConversionMismatchException;
 
-import tests.util.SerializationTester;
-
 import junit.framework.TestCase;
 
-public class FormatFlagsConversionMismatchExceptionTest 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/FormatFlagsConversionMismatchException.ser";
//$NON-NLS-1$
+public class FormatFlagsConversionMismatchExceptionTest extends TestCase {
 
 	/**
 	 * @tests java.util.FormatFlagsConversionMismatchException#FormatFlagsConversionMismatchException(String,
@@ -75,33 +75,40 @@
 
 	}
 
-	/**
-	 * @tests serialization/deserilazation.
-	 */
-	public void test_serialization() throws Exception {
-		String flags = "MYTESTFLAGS";
-		char conversion = 'T';
-		FormatFlagsConversionMismatchException srcFormatFlagsConversionMismatchException = new
FormatFlagsConversionMismatchException(
-				flags,conversion);
-		FormatFlagsConversionMismatchException destFormatFlagsConversionMismatchException = (FormatFlagsConversionMismatchException)
SerializationTester
-				.getDeserilizedObject(srcFormatFlagsConversionMismatchException);
-		assertEquals(srcFormatFlagsConversionMismatchException.getFlags(),destFormatFlagsConversionMismatchException.getFlags());
-		assertEquals(srcFormatFlagsConversionMismatchException.getConversion(),destFormatFlagsConversionMismatchException.getConversion());
-	}
-
-	/**
-	 * @tests serialization/deserilazation compatibility with RI.
-	 */
-	public void test_serializationCompatibility() throws Exception {
-		String flags = "MYTESTFLAGS";
-		char conversion = 'T';
-		FormatFlagsConversionMismatchException srcFormatFlagsConversionMismatchException = new
FormatFlagsConversionMismatchException(
-				flags,conversion);
-		FormatFlagsConversionMismatchException destFormatFlagsConversionMismatchException = (FormatFlagsConversionMismatchException)
SerializationTester
-				.readObject(srcFormatFlagsConversionMismatchException,
-						SERIALIZATION_FILE_NAME);
-		assertEquals(srcFormatFlagsConversionMismatchException.getFlags(),destFormatFlagsConversionMismatchException.getFlags());
-		assertEquals(srcFormatFlagsConversionMismatchException.getConversion(),destFormatFlagsConversionMismatchException.getConversion());
-	}
-
+    // comparator for FormatFlagsConversionMismatchException objects
+    private static final SerializableAssert exComparator = new SerializableAssert() {
+        public void assertDeserialized(Serializable initial,
+                Serializable deserialized) {
+
+            SerializationTest.THROWABLE_COMPARATOR.assertDeserialized(initial,
+                    deserialized);
+
+            FormatFlagsConversionMismatchException initEx = (FormatFlagsConversionMismatchException)
initial;
+            FormatFlagsConversionMismatchException desrEx = (FormatFlagsConversionMismatchException)
deserialized;
+
+            assertEquals("Flags", initEx.getFlags(), desrEx.getFlags());
+            assertEquals("Conversion", initEx.getConversion(), desrEx
+                    .getConversion());
+        }
+    };
+
+    /**
+     * @tests serialization/deserialization.
+     */
+    public void testSerializationSelf() throws Exception {
+
+        SerializationTest.verifySelf(
+                new FormatFlagsConversionMismatchException("MYTESTFLAGS", 'T'),
+                exComparator);
+    }
+
+    /**
+     * @tests serialization/deserialization compatibility with RI.
+     */
+    public void testSerializationCompatibility() throws Exception {
+
+        SerializationTest.verifyGolden(this,
+                new FormatFlagsConversionMismatchException("MYTESTFLAGS", 'T'),
+                exComparator);
+    }
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/util/IllegalFormatCodePointExceptionTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/util/IllegalFormatCodePointExceptionTest.java?rev=431782&r1=431781&r2=431782&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/util/IllegalFormatCodePointExceptionTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/util/IllegalFormatCodePointExceptionTest.java
Tue Aug 15 20:02:27 2006
@@ -15,15 +15,15 @@
 
 package org.apache.harmony.luni.tests.java.util;
 
+import java.io.Serializable;
 import java.util.IllegalFormatCodePointException;
 
-import tests.util.SerializationTester;
-
 import junit.framework.TestCase;
 
-public class IllegalFormatCodePointExceptionTest 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/IllegalFormatCodePointException.ser";
+public class IllegalFormatCodePointExceptionTest extends TestCase {
 
 	/**
 	 * @tests java.util.IllegalFormatCodePointException.IllegalFormatCodePointException(int)
@@ -54,31 +54,37 @@
 		assertTrue(null != illegalFormatCodePointException.getMessage());
 	}
 
-	/**
-	 * @tests serialization/deserilazation.
-	 */
-	public void test_serialization() throws Exception {
-		int codePoint = 12345;
-		IllegalFormatCodePointException srcIllegalFormatCodePointException = new IllegalFormatCodePointException(
-				codePoint);
-		IllegalFormatCodePointException destIllegalFormatCodePointException = (IllegalFormatCodePointException)
SerializationTester
-				.getDeserilizedObject(srcIllegalFormatCodePointException);
-		assertEquals(srcIllegalFormatCodePointException.getCodePoint(),
-				destIllegalFormatCodePointException.getCodePoint());
-	}
-
-	/**
-	 * @tests serialization/deserilazation compatibility with RI.
-	 */
-	public void test_serializationCompatibility() throws Exception {
-		int codePoint = 12345;
-		IllegalFormatCodePointException srcIllegalFormatCodePointException = new IllegalFormatCodePointException(
-				codePoint);
-		IllegalFormatCodePointException destIllegalFormatCodePointException = (IllegalFormatCodePointException)
SerializationTester
-				.readObject(srcIllegalFormatCodePointException,
-						SERIALIZATION_FILE_NAME);
-		assertEquals(srcIllegalFormatCodePointException.getCodePoint(),
-				destIllegalFormatCodePointException.getCodePoint());
-	}
-
+    // comparator for IllegalFormatCodePointException objects
+    private static final SerializableAssert exComparator = new SerializableAssert() {
+        public void assertDeserialized(Serializable initial,
+                Serializable deserialized) {
+
+            SerializationTest.THROWABLE_COMPARATOR.assertDeserialized(initial,
+                    deserialized);
+
+            IllegalFormatCodePointException initEx = (IllegalFormatCodePointException) initial;
+            IllegalFormatCodePointException desrEx = (IllegalFormatCodePointException) deserialized;
+
+            assertEquals("CodePoint", initEx.getCodePoint(), desrEx
+                    .getCodePoint());
+        }
+    };
+
+    /**
+     * @tests serialization/deserialization.
+     */
+    public void testSerializationSelf() throws Exception {
+
+        SerializationTest.verifySelf(
+                new IllegalFormatCodePointException(12345), exComparator);
+    }
+
+    /**
+     * @tests serialization/deserialization compatibility with RI.
+     */
+    public void testSerializationCompatibility() throws Exception {
+
+        SerializationTest.verifyGolden(this,
+                new IllegalFormatCodePointException(12345), exComparator);
+    }
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/util/IllegalFormatConversionExceptionTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/util/IllegalFormatConversionExceptionTest.java?rev=431782&r1=431781&r2=431782&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/util/IllegalFormatConversionExceptionTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/util/IllegalFormatConversionExceptionTest.java
Tue Aug 15 20:02:27 2006
@@ -15,15 +15,15 @@
 
 package org.apache.harmony.luni.tests.java.util;
 
+import java.io.Serializable;
 import java.util.IllegalFormatConversionException;
 
-import tests.util.SerializationTester;
-
 import junit.framework.TestCase;
 
-public class IllegalFormatConversionExceptionTest 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/IllegalFormatConversionException.ser";
+public class IllegalFormatConversionExceptionTest extends TestCase {
 
 	/**
 	 * @tests java.util.IllegalFormatConversionException#IllegalFormatConversionException(char,
@@ -75,37 +75,40 @@
 
 	}
 
-	/**
-	 * @tests serialization/deserilazation.
-	 */
-	public void test_serialization() throws Exception {
-		char c = '*';
-		Class argClass = String.class;
-		IllegalFormatConversionException srcIllegalFormatConversionException = new IllegalFormatConversionException(
-				c, argClass);
-		IllegalFormatConversionException destIllegalFormatConversionException = (IllegalFormatConversionException)
SerializationTester
-				.getDeserilizedObject(srcIllegalFormatConversionException);
-		assertEquals(srcIllegalFormatConversionException.getArgumentClass(),
-				destIllegalFormatConversionException.getArgumentClass());
-		assertEquals(srcIllegalFormatConversionException.getConversion(),
-				destIllegalFormatConversionException.getConversion());
-	}
-
-	/**
-	 * @tests serialization/deserilazation compatibility with RI.
-	 */
-	public void test_serializationCompatibility() throws Exception {
-		char c = '*';
-		Class argClass = String.class;
-		IllegalFormatConversionException srcIllegalFormatConversionException = new IllegalFormatConversionException(
-				c, argClass);
-		IllegalFormatConversionException destIllegalFormatConversionException = (IllegalFormatConversionException)
SerializationTester
-				.readObject(srcIllegalFormatConversionException,
-						SERIALIZATION_FILE_NAME);
-		assertEquals(srcIllegalFormatConversionException.getArgumentClass(),
-				destIllegalFormatConversionException.getArgumentClass());
-		assertEquals(srcIllegalFormatConversionException.getConversion(),
-				destIllegalFormatConversionException.getConversion());
-	}
-
+    // comparator for IllegalFormatConversionException objects
+    private static final SerializableAssert exComparator = new SerializableAssert() {
+        public void assertDeserialized(Serializable initial,
+                Serializable deserialized) {
+
+            SerializationTest.THROWABLE_COMPARATOR.assertDeserialized(initial,
+                    deserialized);
+
+            IllegalFormatConversionException initEx = (IllegalFormatConversionException)
initial;
+            IllegalFormatConversionException desrEx = (IllegalFormatConversionException)
deserialized;
+
+            assertEquals("ArgumentClass", initEx.getArgumentClass(), desrEx
+                    .getArgumentClass());
+            assertEquals("Conversion", initEx.getConversion(), desrEx
+                    .getConversion());
+        }
+    };
+
+    /**
+     * @tests serialization/deserialization.
+     */
+    public void testSerializationSelf() throws Exception {
+
+        SerializationTest.verifySelf(new IllegalFormatConversionException('*',
+                String.class), exComparator);
+    }
+
+    /**
+     * @tests serialization/deserialization compatibility with RI.
+     */
+    public void testSerializationCompatibility() throws Exception {
+
+        SerializationTest.verifyGolden(this,
+                new IllegalFormatConversionException('*', String.class),
+                exComparator);
+    }
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/util/IllegalFormatFlagsExceptionTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/util/IllegalFormatFlagsExceptionTest.java?rev=431782&r1=431781&r2=431782&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/util/IllegalFormatFlagsExceptionTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/util/IllegalFormatFlagsExceptionTest.java
Tue Aug 15 20:02:27 2006
@@ -15,15 +15,15 @@
 
 package org.apache.harmony.luni.tests.java.util;
 
+import java.io.Serializable;
 import java.util.IllegalFormatFlagsException;
 
-import tests.util.SerializationTester;
-
 import junit.framework.TestCase;
 
-public class IllegalFormatFlagsExceptionTest 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/IllegalFormatFlagsException.ser";
+public class IllegalFormatFlagsExceptionTest extends TestCase {
 
 	/**
 	 * @tests java.util.IllegalFormatFlagsException#IllegalFormatFlagsException(String)
@@ -58,33 +58,36 @@
 
 	}
 
-	/**
-	 * @tests serialization/deserilazation.
-	 */
-	public void test_serialization() throws Exception {
-		String flags = "TESTFLAGS";
-		IllegalFormatFlagsException srcIllegalFormatFlagsException = new IllegalFormatFlagsException(
-				flags);
-		IllegalFormatFlagsException destIllegalFormatFlagsException = (IllegalFormatFlagsException)
SerializationTester
-				.getDeserilizedObject(srcIllegalFormatFlagsException);
-		assertEquals(srcIllegalFormatFlagsException.getFlags(),
-				destIllegalFormatFlagsException.getFlags());
-
-	}
-
-	/**
-	 * @tests serialization/deserilazation compatibility with RI.
-	 */
-	public void test_serializationCompatibility() throws Exception {
-		String flags = "TESTFLAGS";
-		IllegalFormatFlagsException srcIllegalFormatFlagsException = new IllegalFormatFlagsException(
-				flags);		
-		IllegalFormatFlagsException destIllegalFormatFlagsException = (IllegalFormatFlagsException)
SerializationTester
-				.readObject(srcIllegalFormatFlagsException,
-						SERIALIZATION_FILE_NAME);
-		assertEquals(srcIllegalFormatFlagsException.getFlags(),
-				destIllegalFormatFlagsException.getFlags());
-
-	}
-
+    // comparator for IllegalFormatFlagsException objects
+    private static final SerializableAssert exComparator = new SerializableAssert() {
+        public void assertDeserialized(Serializable initial,
+                Serializable deserialized) {
+
+            SerializationTest.THROWABLE_COMPARATOR.assertDeserialized(initial,
+                    deserialized);
+
+            IllegalFormatFlagsException initEx = (IllegalFormatFlagsException) initial;
+            IllegalFormatFlagsException desrEx = (IllegalFormatFlagsException) deserialized;
+
+            assertEquals("Flags", initEx.getFlags(), desrEx.getFlags());
+        }
+    };
+
+    /**
+     * @tests serialization/deserialization.
+     */
+    public void testSerializationSelf() throws Exception {
+
+        SerializationTest.verifySelf(new IllegalFormatFlagsException(
+                "TESTFLAGS"), exComparator);
+    }
+
+    /**
+     * @tests serialization/deserialization compatibility with RI.
+     */
+    public void testSerializationCompatibility() throws Exception {
+
+        SerializationTest.verifyGolden(this, new IllegalFormatFlagsException(
+                "TESTFLAGS"), exComparator);
+    }
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/util/IllegalFormatPrecisionExceptionTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/util/IllegalFormatPrecisionExceptionTest.java?rev=431782&r1=431781&r2=431782&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/util/IllegalFormatPrecisionExceptionTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/util/IllegalFormatPrecisionExceptionTest.java
Tue Aug 15 20:02:27 2006
@@ -14,15 +14,15 @@
  */
 package org.apache.harmony.luni.tests.java.util;
 
+import java.io.Serializable;
 import java.util.IllegalFormatPrecisionException;
 
-import tests.util.SerializationTester;
-
 import junit.framework.TestCase;
 
-public class IllegalFormatPrecisionExceptionTest 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/IllegalFormatPrecisionException.ser";
+public class IllegalFormatPrecisionExceptionTest extends TestCase {
 
 	/**
 	 * @tests java.util.IllegalFormatPrecisionException#IllegalFormatPrecisionException(int)
@@ -55,33 +55,37 @@
 
 	}
 
-	/**
-	 * @tests serialization/deserilazation.
-	 */
-	public void test_serialization() throws Exception {
-		int precision = 12345;
-		IllegalFormatPrecisionException srcIllegalFormatPrecisionException = new IllegalFormatPrecisionException(
-				precision);
-		IllegalFormatPrecisionException destIllegalFormatPrecisionException = (IllegalFormatPrecisionException)
SerializationTester
-				.getDeserilizedObject(srcIllegalFormatPrecisionException);
-		assertEquals(srcIllegalFormatPrecisionException.getPrecision(),
-				destIllegalFormatPrecisionException.getPrecision());
-
-	}
-
-	/**
-	 * @tests serialization/deserilazation compatibility with RI.
-	 */
-	public void test_serializationCompatibility() throws Exception {
-		int precision = 12345;
-		IllegalFormatPrecisionException srcIllegalFormatPrecisionException = new IllegalFormatPrecisionException(
-				precision);
-		IllegalFormatPrecisionException destIllegalFormatPrecisionException = (IllegalFormatPrecisionException)
SerializationTester
-				.readObject(srcIllegalFormatPrecisionException,
-						SERIALIZATION_FILE_NAME);
-		assertEquals(srcIllegalFormatPrecisionException.getPrecision(),
-				destIllegalFormatPrecisionException.getPrecision());
-
-	}
-
+    // comparator for IllegalFormatPrecisionException objects
+    private static final SerializableAssert exComparator = new SerializableAssert() {
+        public void assertDeserialized(Serializable initial,
+                Serializable deserialized) {
+
+            SerializationTest.THROWABLE_COMPARATOR.assertDeserialized(initial,
+                    deserialized);
+
+            IllegalFormatPrecisionException initEx = (IllegalFormatPrecisionException) initial;
+            IllegalFormatPrecisionException desrEx = (IllegalFormatPrecisionException) deserialized;
+
+            assertEquals("Precision", initEx.getPrecision(), desrEx
+                    .getPrecision());
+        }
+    };
+
+    /**
+     * @tests serialization/deserialization.
+     */
+    public void testSerializationSelf() throws Exception {
+
+        SerializationTest.verifySelf(
+                new IllegalFormatPrecisionException(12345), exComparator);
+    }
+
+    /**
+     * @tests serialization/deserialization compatibility with RI.
+     */
+    public void testSerializationCompatibility() throws Exception {
+
+        SerializationTest.verifyGolden(this,
+                new IllegalFormatPrecisionException(12345), exComparator);
+    }
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/util/IllegalFormatWidthExceptionTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/util/IllegalFormatWidthExceptionTest.java?rev=431782&r1=431781&r2=431782&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/util/IllegalFormatWidthExceptionTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/util/IllegalFormatWidthExceptionTest.java
Tue Aug 15 20:02:27 2006
@@ -14,15 +14,15 @@
  */
 package org.apache.harmony.luni.tests.java.util;
 
+import java.io.Serializable;
 import java.util.IllegalFormatWidthException;
 
-import tests.util.SerializationTester;
-
 import junit.framework.TestCase;
 
-public class IllegalFormatWidthExceptionTest 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/IllegalFormatWidthException.ser";
+public class IllegalFormatWidthExceptionTest extends TestCase {
 
 	/**
 	 * @tests java.util.IllegalFormatWidthException#IllegalFormatWidthException(int)
@@ -57,33 +57,36 @@
 
 	}
 
-	/**
-	 * @tests serialization/deserilazation.
-	 */
-	public void test_serialization() throws Exception {
-		int width = 12345;
-		IllegalFormatWidthException srcIllegalFormatWidthException = new IllegalFormatWidthException(
-				width);
-		IllegalFormatWidthException destIllegalFormatWidthException = (IllegalFormatWidthException)
SerializationTester
-				.getDeserilizedObject(srcIllegalFormatWidthException);
-		assertEquals(srcIllegalFormatWidthException.getWidth(),
-				destIllegalFormatWidthException.getWidth());
-
-	}
-
-	/**
-	 * @tests serialization/deserilazation compatibility with RI.
-	 */
-	public void test_serializationCompatibility() throws Exception {
-		int width = 12345;
-		IllegalFormatWidthException srcIllegalFormatWidthException = new IllegalFormatWidthException(
-				width);
-		IllegalFormatWidthException destIllegalFormatWidthException = (IllegalFormatWidthException)
SerializationTester
-				.readObject(srcIllegalFormatWidthException,
-						SERIALIZATION_FILE_NAME);
-		assertEquals(srcIllegalFormatWidthException.getWidth(),
-				destIllegalFormatWidthException.getWidth());
-
-	}
-
+    // comparator for IllegalFormatWidthException objects
+    private static final SerializableAssert exComparator = new SerializableAssert() {
+        public void assertDeserialized(Serializable initial,
+                Serializable deserialized) {
+
+            SerializationTest.THROWABLE_COMPARATOR.assertDeserialized(initial,
+                    deserialized);
+
+            IllegalFormatWidthException initEx = (IllegalFormatWidthException) initial;
+            IllegalFormatWidthException desrEx = (IllegalFormatWidthException) deserialized;
+
+            assertEquals("Width", initEx.getWidth(), desrEx.getWidth());
+        }
+    };
+
+    /**
+     * @tests serialization/deserialization.
+     */
+    public void testSerializationSelf() throws Exception {
+
+        SerializationTest.verifySelf(new IllegalFormatWidthException(12345),
+                exComparator);
+    }
+
+    /**
+     * @tests serialization/deserialization compatibility with RI.
+     */
+    public void testSerializationCompatibility() throws Exception {
+
+        SerializationTest.verifyGolden(this, new IllegalFormatWidthException(
+                12345), exComparator);
+    }
 }



Mime
View raw message