harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smish...@apache.org
Subject svn commit: r442845 - in /incubator/harmony/enhanced/classlib/trunk/modules/nio_char/src/test: java/org/apache/harmony/nio_char/tests/java/nio/charset/ resources/serialization/org/apache/harmony/nio_char/tests/java/nio/charset/ resources/tests/api/java...
Date Wed, 13 Sep 2006 05:11:09 GMT
Author: smishura
Date: Tue Sep 12 22:11:07 2006
New Revision: 442845

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

Added:
    incubator/harmony/enhanced/classlib/trunk/modules/nio_char/src/test/resources/serialization/org/apache/harmony/nio_char/tests/java/nio/charset/CharacterCodingExceptionTest.golden.ser
      - copied unchanged from r442621, incubator/harmony/enhanced/classlib/trunk/modules/nio_char/src/test/resources/tests/api/java/nio/charset/CharacterCodingException.ser
    incubator/harmony/enhanced/classlib/trunk/modules/nio_char/src/test/resources/serialization/org/apache/harmony/nio_char/tests/java/nio/charset/CoderMalfunctionErrorTest.golden.ser
      - copied unchanged from r442621, incubator/harmony/enhanced/classlib/trunk/modules/nio_char/src/test/resources/tests/api/java/nio/charset/CoderMalfunctionError.ser
    incubator/harmony/enhanced/classlib/trunk/modules/nio_char/src/test/resources/serialization/org/apache/harmony/nio_char/tests/java/nio/charset/IllegalCharsetNameExceptionTest.golden.ser
      - copied unchanged from r442621, incubator/harmony/enhanced/classlib/trunk/modules/nio_char/src/test/resources/tests/api/java/nio/charset/IllegalCharsetNameException.ser
    incubator/harmony/enhanced/classlib/trunk/modules/nio_char/src/test/resources/serialization/org/apache/harmony/nio_char/tests/java/nio/charset/MalformedInputExceptionTest.golden.ser
      - copied unchanged from r442621, incubator/harmony/enhanced/classlib/trunk/modules/nio_char/src/test/resources/tests/api/java/nio/charset/MalformedInputException.ser
    incubator/harmony/enhanced/classlib/trunk/modules/nio_char/src/test/resources/serialization/org/apache/harmony/nio_char/tests/java/nio/charset/UnmappableCharacterExceptionTest.golden.ser
      - copied unchanged from r442621, incubator/harmony/enhanced/classlib/trunk/modules/nio_char/src/test/resources/tests/api/java/nio/charset/UnmappableCharacterException.ser
    incubator/harmony/enhanced/classlib/trunk/modules/nio_char/src/test/resources/serialization/org/apache/harmony/nio_char/tests/java/nio/charset/UnsupportedCharsetExceptionTest.golden.ser
      - copied unchanged from r442621, incubator/harmony/enhanced/classlib/trunk/modules/nio_char/src/test/resources/tests/api/java/nio/charset/UnsupportedCharsetException.ser
Removed:
    incubator/harmony/enhanced/classlib/trunk/modules/nio_char/src/test/resources/tests/api/java/nio/charset/CharacterCodingException.ser
    incubator/harmony/enhanced/classlib/trunk/modules/nio_char/src/test/resources/tests/api/java/nio/charset/CoderMalfunctionError.ser
    incubator/harmony/enhanced/classlib/trunk/modules/nio_char/src/test/resources/tests/api/java/nio/charset/IllegalCharsetNameException.ser
    incubator/harmony/enhanced/classlib/trunk/modules/nio_char/src/test/resources/tests/api/java/nio/charset/MalformedInputException.ser
    incubator/harmony/enhanced/classlib/trunk/modules/nio_char/src/test/resources/tests/api/java/nio/charset/UnmappableCharacterException.ser
    incubator/harmony/enhanced/classlib/trunk/modules/nio_char/src/test/resources/tests/api/java/nio/charset/UnsupportedCharsetException.ser
Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/CharacterCodingExceptionTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/CoderMalfunctionErrorTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/IllegalCharsetNameExceptionTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/MalformedInputExceptionTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/UnmappableCharacterExceptionTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/UnsupportedCharsetExceptionTest.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/CharacterCodingExceptionTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/CharacterCodingExceptionTest.java?view=diff&rev=442845&r1=442844&r2=442845
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/CharacterCodingExceptionTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/CharacterCodingExceptionTest.java
Tue Sep 12 22:11:07 2006
@@ -19,7 +19,8 @@
 import java.nio.charset.CharacterCodingException;
 
 import junit.framework.TestCase;
-import tests.util.SerializationTester;
+
+import org.apache.harmony.testframework.serialization.SerializationTest;
 
 /**
  * Test CharacterCodingException
@@ -33,24 +34,19 @@
 		assertNull(ex.getMessage());
 	}
 
-	/*
-	 * Test serialization/deserialization.
-	 */
-	public void testSerialization() throws Exception {
-		CharacterCodingException ex = new CharacterCodingException();
-
-		CharacterCodingException deEx = (CharacterCodingException) SerializationTester
-				.getDeserilizedObject(ex);
-	}
+    /**
+     * @tests serialization/deserialization compatibility.
+     */
+    public void testSerializationSelf() throws Exception {
+
+        SerializationTest.verifySelf(new CharacterCodingException());
+    }
+
+    /**
+     * @tests serialization/deserialization compatibility with RI.
+     */
+    public void testSerializationCompatibility() throws Exception {
+        SerializationTest.verifyGolden(this, new CharacterCodingException());
 
-	/*
-	 * Test serialization/deserialization.
-	 */
-	public void testSerializationCompatibility() throws Exception {
-		CharacterCodingException ex = new CharacterCodingException();
-
-		CharacterCodingException deEx = (CharacterCodingException) SerializationTester
-				.readObject(ex,
-						"tests/api/java/nio/charset/CharacterCodingException.ser");
-	}
+    }
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/CoderMalfunctionErrorTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/CoderMalfunctionErrorTest.java?view=diff&rev=442845&r1=442844&r2=442845
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/CoderMalfunctionErrorTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/CoderMalfunctionErrorTest.java
Tue Sep 12 22:11:07 2006
@@ -18,7 +18,8 @@
 import java.nio.charset.CoderMalfunctionError;
 
 import junit.framework.TestCase;
-import tests.util.SerializationTester;
+
+import org.apache.harmony.testframework.serialization.SerializationTest;
 
 /**
  * Test java.nio.CoderMalfunctionError.
@@ -42,26 +43,19 @@
 		assertNull(e.getCause());
 	}
 
-	/*
-	 * Test serialization/deserialization.
-	 */
-	public void testSerialization() throws Exception {
-		CoderMalfunctionError ex = new CoderMalfunctionError(null);
-
-		CoderMalfunctionError deEx = (CoderMalfunctionError) SerializationTester
-				.getDeserilizedObject(ex);
-		assertEquals(null, deEx.getCause());
-	}
+    /**
+     * @tests serialization/deserialization compatibility.
+     */
+    public void testSerializationSelf() throws Exception {
+
+        SerializationTest.verifySelf(new CoderMalfunctionError(null));
+    }
+
+    /**
+     * @tests serialization/deserialization compatibility with RI.
+     */
+    public void testSerializationCompatibility() throws Exception {
+        SerializationTest.verifyGolden(this, new CoderMalfunctionError(null));
 
-	/*
-	 * Test serialization/deserialization.
-	 */
-	public void testSerializationCompatibility() throws Exception {
-		CoderMalfunctionError ex = new CoderMalfunctionError(null);
-
-		CoderMalfunctionError deEx = (CoderMalfunctionError) SerializationTester
-				.readObject(ex,
-						"tests/api/java/nio/charset/CoderMalfunctionError.ser");
-		assertEquals(null, deEx.getCause());
-	}
+    }
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/IllegalCharsetNameExceptionTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/IllegalCharsetNameExceptionTest.java?view=diff&rev=442845&r1=442844&r2=442845
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/IllegalCharsetNameExceptionTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/IllegalCharsetNameExceptionTest.java
Tue Sep 12 22:11:07 2006
@@ -15,10 +15,13 @@
 
 package org.apache.harmony.nio_char.tests.java.nio.charset;
 
+import java.io.Serializable;
 import java.nio.charset.IllegalCharsetNameException;
 
 import junit.framework.TestCase;
-import tests.util.SerializationTester;
+
+import org.apache.harmony.testframework.serialization.SerializationTest;
+import org.apache.harmony.testframework.serialization.SerializationTest.SerializableAssert;
 
 /**
  * Test class IllegalCharsetNameException.
@@ -50,27 +53,41 @@
 
 	}
 
-	/*
-	 * Test serialization/deserialization.
-	 */
-	public void testSerialization() throws Exception {
-		IllegalCharsetNameException ex = new IllegalCharsetNameException(
-				"charsetName");
-
-		IllegalCharsetNameException deEx = (IllegalCharsetNameException) SerializationTester
-				.getDeserilizedObject(ex);
-	}
-
-	/*
-	 * Test serialization/deserialization
-	 */
-	public void testSerializationCompatibility() throws Exception {
-		IllegalCharsetNameException ex = new IllegalCharsetNameException(
-				"charsetName");
-
-		IllegalCharsetNameException deEx = (IllegalCharsetNameException) SerializationTester
-				.readObject(ex,
-						"tests/api/java/nio/charset/IllegalCharsetNameException.ser");
-	}
-
+    // comparator for IllegalCharsetNameException objects
+    private static final SerializableAssert COMPARATOR = new SerializableAssert() {
+        public void assertDeserialized(Serializable initial,
+                Serializable deserialized) {
+
+            // FIXME?: getMessage() returns more helpful string but
+            // this leads to incompatible message in serial form
+            //
+            // do common checks for all throwable objects
+            // SerializationTest.THROWABLE_COMPARATOR.assertDeserialized(initial,
+            //        deserialized);
+
+            IllegalCharsetNameException initEx = (IllegalCharsetNameException) initial;
+            IllegalCharsetNameException desrEx = (IllegalCharsetNameException) deserialized;
+
+            assertEquals("CharsetName", initEx.getCharsetName(), desrEx
+                    .getCharsetName());
+        }
+    };
+
+    /**
+     * @tests serialization/deserialization compatibility.
+     */
+    public void testSerializationSelf() throws Exception {
+
+        SerializationTest.verifySelf(new IllegalCharsetNameException(
+                "charsetName"), COMPARATOR);
+    }
+
+    /**
+     * @tests serialization/deserialization compatibility with RI.
+     */
+    public void testSerializationCompatibility() throws Exception {
+
+        SerializationTest.verifyGolden(this, new IllegalCharsetNameException(
+                "charsetName"), COMPARATOR);
+    }
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/MalformedInputExceptionTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/MalformedInputExceptionTest.java?view=diff&rev=442845&r1=442844&r2=442845
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/MalformedInputExceptionTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/MalformedInputExceptionTest.java
Tue Sep 12 22:11:07 2006
@@ -15,11 +15,14 @@
 
 package org.apache.harmony.nio_char.tests.java.nio.charset;
 
+import java.io.Serializable;
 import java.nio.charset.CharacterCodingException;
 import java.nio.charset.MalformedInputException;
 
 import junit.framework.TestCase;
-import tests.util.SerializationTester;
+
+import org.apache.harmony.testframework.serialization.SerializationTest;
+import org.apache.harmony.testframework.serialization.SerializationTest.SerializableAssert;
 
 /**
  * Test class MalformedInputException.
@@ -44,28 +47,38 @@
 		assertTrue(ex.getMessage().indexOf("0") != -1);
 	}
 
-	/*
-	 * Test serialization/deserialization.
-	 */
-	public void testSerialization() throws Exception {
-		MalformedInputException ex = new MalformedInputException(11);
-
-		MalformedInputException deEx = (MalformedInputException) SerializationTester
-				.getDeserilizedObject(ex);
-		assertEquals(11, deEx.getInputLength());
-	}
-
-	/*
-	 * Test serialization/deserialization compatibility with reference
-	 * implementation.
-	 */
-	public void testSerializationCompatibility() throws Exception {
-		MalformedInputException ex = new MalformedInputException(11);
-
-		MalformedInputException deEx = (MalformedInputException) SerializationTester
-				.readObject(ex,
-						"tests/api/java/nio/charset/MalformedInputException.ser");
-		assertEquals(11, deEx.getInputLength());
-	}
-
+    // comparator for MalformedInputException objects
+    private static final SerializableAssert COMPARATOR = new SerializableAssert() {
+        public void assertDeserialized(Serializable initial,
+                Serializable deserialized) {
+
+            // do common checks for all throwable objects
+            SerializationTest.THROWABLE_COMPARATOR.assertDeserialized(initial,
+                    deserialized);
+
+            MalformedInputException initEx = (MalformedInputException) initial;
+            MalformedInputException desrEx = (MalformedInputException) deserialized;
+
+            assertEquals("InputLength", initEx.getInputLength(), desrEx
+                    .getInputLength());
+        }
+    };
+
+    /**
+     * @tests serialization/deserialization compatibility.
+     */
+    public void testSerializationSelf() throws Exception {
+
+        SerializationTest.verifySelf(new MalformedInputException(11),
+                COMPARATOR);
+    }
+
+    /**
+     * @tests serialization/deserialization compatibility with RI.
+     */
+    public void testSerializationCompatibility() throws Exception {
+
+        SerializationTest.verifyGolden(this, new MalformedInputException(11),
+                COMPARATOR);
+    }
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/UnmappableCharacterExceptionTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/UnmappableCharacterExceptionTest.java?view=diff&rev=442845&r1=442844&r2=442845
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/UnmappableCharacterExceptionTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/UnmappableCharacterExceptionTest.java
Tue Sep 12 22:11:07 2006
@@ -15,11 +15,14 @@
 
 package org.apache.harmony.nio_char.tests.java.nio.charset;
 
+import java.io.Serializable;
 import java.nio.charset.CharacterCodingException;
 import java.nio.charset.UnmappableCharacterException;
 
 import junit.framework.TestCase;
-import tests.util.SerializationTester;
+
+import org.apache.harmony.testframework.serialization.SerializationTest;
+import org.apache.harmony.testframework.serialization.SerializationTest.SerializableAssert;
 
 /**
  * Test class UnmappableCharacterException.
@@ -45,28 +48,38 @@
 
 	}
 
-	/*
-	 * Test serialization/deserialization.
-	 */
-	public void testSerialization() throws Exception {
-		UnmappableCharacterException ex = new UnmappableCharacterException(11);
-
-		UnmappableCharacterException deEx = (UnmappableCharacterException) SerializationTester
-				.getDeserilizedObject(ex);
-		assertEquals(11, deEx.getInputLength());
-	}
-
-	/*
-	 * Test serialization/deserialization compatibility with reference
-	 * implementation.
-	 */
-	public void testSerializationCompatibility() throws Exception {
-		UnmappableCharacterException ex = new UnmappableCharacterException(11);
-
-		UnmappableCharacterException deEx = (UnmappableCharacterException) SerializationTester
-				.readObject(ex,
-						"tests/api/java/nio/charset/UnmappableCharacterException.ser");
-		assertEquals(11, deEx.getInputLength());
-	}
-
+    // comparator for UnmappableCharacterException objects
+    private static final SerializableAssert COMPARATOR = new SerializableAssert() {
+        public void assertDeserialized(Serializable initial,
+                Serializable deserialized) {
+
+            // do common checks for all throwable objects
+            SerializationTest.THROWABLE_COMPARATOR.assertDeserialized(initial,
+                    deserialized);
+
+            UnmappableCharacterException initEx = (UnmappableCharacterException) initial;
+            UnmappableCharacterException desrEx = (UnmappableCharacterException) deserialized;
+
+            assertEquals("InputLength", initEx.getInputLength(), desrEx
+                    .getInputLength());
+        }
+    };
+
+    /**
+     * @tests serialization/deserialization compatibility.
+     */
+    public void testSerializationSelf() throws Exception {
+
+        SerializationTest.verifySelf(new UnmappableCharacterException(11),
+                COMPARATOR);
+    }
+
+    /**
+     * @tests serialization/deserialization compatibility with RI.
+     */
+    public void testSerializationCompatibility() throws Exception {
+
+        SerializationTest.verifyGolden(this, new UnmappableCharacterException(
+                11), COMPARATOR);
+    }
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/UnsupportedCharsetExceptionTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/UnsupportedCharsetExceptionTest.java?view=diff&rev=442845&r1=442844&r2=442845
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/UnsupportedCharsetExceptionTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/UnsupportedCharsetExceptionTest.java
Tue Sep 12 22:11:07 2006
@@ -15,10 +15,13 @@
 
 package org.apache.harmony.nio_char.tests.java.nio.charset;
 
+import java.io.Serializable;
 import java.nio.charset.UnsupportedCharsetException;
 
 import junit.framework.TestCase;
-import tests.util.SerializationTester;
+
+import org.apache.harmony.testframework.serialization.SerializationTest;
+import org.apache.harmony.testframework.serialization.SerializationTest.SerializableAssert;
 
 /**
  * Test class UnsupportedCharsetException.
@@ -49,26 +52,41 @@
 		assertTrue(ex.getMessage().indexOf("null") != -1);
 	}
 
-	/*
-	 * Test serialization/deserialization.
-	 */
-	public void testSerialization() throws Exception {
-		UnsupportedCharsetException ex = new UnsupportedCharsetException(
-				"charsetName");
-
-		UnsupportedCharsetException deEx = (UnsupportedCharsetException) SerializationTester
-				.getDeserilizedObject(ex);
-	}
-
-	/*
-	 * Test serialization/deserialization.
-	 */
-	public void testSerializationCompatibility() throws Exception {
-		UnsupportedCharsetException ex = new UnsupportedCharsetException(
-				"charsetName");
-
-		UnsupportedCharsetException deEx = (UnsupportedCharsetException) SerializationTester
-				.readObject(ex,
-						"tests/api/java/nio/charset/UnsupportedCharsetException.ser");
-	}
+    // comparator for UnsupportedCharsetException objects
+    private static final SerializableAssert COMPARATOR = new SerializableAssert() {
+        public void assertDeserialized(Serializable initial,
+                Serializable deserialized) {
+
+            // FIXME?: getMessage() returns more helpful string but
+            // this leads to incompatible message in serial form
+            //
+            // do common checks for all throwable objects
+            // SerializationTest.THROWABLE_COMPARATOR.assertDeserialized(initial,
+            //        deserialized);
+
+            UnsupportedCharsetException initEx = (UnsupportedCharsetException) initial;
+            UnsupportedCharsetException desrEx = (UnsupportedCharsetException) deserialized;
+
+            assertEquals("CharsetName", initEx.getCharsetName(), desrEx
+                    .getCharsetName());
+        }
+    };
+
+    /**
+     * @tests serialization/deserialization compatibility.
+     */
+    public void testSerializationSelf() throws Exception {
+
+        SerializationTest.verifySelf(new UnsupportedCharsetException(
+                "charsetName"), COMPARATOR);
+    }
+
+    /**
+     * @tests serialization/deserialization compatibility with RI.
+     */
+    public void testSerializationCompatibility() throws Exception {
+
+        SerializationTest.verifyGolden(this, new UnsupportedCharsetException(
+                "charsetName"), COMPARATOR);
+    }
 }



Mime
View raw message