harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smish...@apache.org
Subject svn commit: r437975 - in /incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test: java/org/apache/harmony/luni/tests/java/lang/ resources/serialization/java/lang/ resources/serialization/org/apache/harmony/luni/tests/java/lang/
Date Tue, 29 Aug 2006 05:50:23 GMT
Author: smishura
Date: Mon Aug 28 22:50:22 2006
New Revision: 437975

URL: http://svn.apache.org/viewvc?rev=437975&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/lang/IllegalStateExceptionTest.golden.ser
      - copied unchanged from r434015, incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/resources/serialization/java/lang/IllegalStateException.ser
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/resources/serialization/org/apache/harmony/luni/tests/java/lang/SecurityExceptionTest.golden.ser
      - copied unchanged from r434015, incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/resources/serialization/java/lang/SecurityException.ser
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/resources/serialization/org/apache/harmony/luni/tests/java/lang/StringBufferTest.golden.ser
      - copied unchanged from r437965, incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/resources/serialization/java/lang/StringBuffer.ser
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/resources/serialization/org/apache/harmony/luni/tests/java/lang/StringBuilderTest.golden.ser
      - copied unchanged from r437965, incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/resources/serialization/java/lang/StringBuilder.ser
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/resources/serialization/org/apache/harmony/luni/tests/java/lang/UnsupportedOperationExceptionTest.golden.ser
      - copied unchanged from r434015, incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/resources/serialization/java/lang/UnsupportedOperationException.ser
Removed:
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/resources/serialization/java/lang/IllegalStateException.ser
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/resources/serialization/java/lang/SecurityException.ser
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/resources/serialization/java/lang/StringBuffer.ser
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/resources/serialization/java/lang/StringBuilder.ser
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/resources/serialization/java/lang/UnsupportedOperationException.ser
Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/IllegalStateExceptionTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/SecurityExceptionTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/StringBufferTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/StringBuilderTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/UnsupportedOperationExceptionTest.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/IllegalStateExceptionTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/IllegalStateExceptionTest.java?rev=437975&r1=437974&r2=437975&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/IllegalStateExceptionTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/IllegalStateExceptionTest.java
Mon Aug 28 22:50:22 2006
@@ -16,13 +16,11 @@
 package org.apache.harmony.luni.tests.java.lang;
 
 import junit.framework.TestCase;
-import tests.util.SerializationTester;
+
+import org.apache.harmony.testframework.serialization.SerializationTest;
 
 public class IllegalStateExceptionTest extends TestCase {
 
-	private static final String SERIALIZATION_FILE_NAME =
-		"serialization/java/lang/IllegalStateException.ser"; //$NON-NLS-1$
-	
 	/**
 	 * @tests java.lang.IllegalStateException#IllegalStateException()
 	 */
@@ -42,22 +40,19 @@
         assertNull(e.getCause());
     }
 
-	/**
-	 * @tests serialization/deserilazation.
-	 */
-	public void test_serialization() throws Exception {
-		IllegalStateException srcIllegalStateException = new IllegalStateException();
-		IllegalStateException destIllegalStateException = (IllegalStateException) SerializationTester
-				.getDeserilizedObject(srcIllegalStateException);
-	}
+    /**
+     * @tests serialization/deserialization.
+     */
+    public void testSerializationSelf() throws Exception {
 
-	/**
-	 * @tests serialization/deserilazation compatibility with RI.
-	 */
-	public void test_serializationCompatibility() throws Exception {
-		IllegalStateException srcIllegalStateException = new IllegalStateException();
-		IllegalStateException destIllegalStateException = (IllegalStateException) SerializationTester
-				.readObject(srcIllegalStateException,
-						SERIALIZATION_FILE_NAME);
-	}
+        SerializationTest.verifySelf(new IllegalStateException());
+    }
+
+    /**
+     * @tests serialization/deserialization compatibility with RI.
+     */
+    public void testSerializationCompatibility() throws Exception {
+
+        SerializationTest.verifyGolden(this, new IllegalStateException());
+    }
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/SecurityExceptionTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/SecurityExceptionTest.java?rev=437975&r1=437974&r2=437975&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/SecurityExceptionTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/SecurityExceptionTest.java
Mon Aug 28 22:50:22 2006
@@ -16,13 +16,11 @@
 package org.apache.harmony.luni.tests.java.lang;
 
 import junit.framework.TestCase;
-import tests.util.SerializationTester;
+
+import org.apache.harmony.testframework.serialization.SerializationTest;
 
 public class SecurityExceptionTest extends TestCase {
 	
-	private static final String SERIALIZATION_FILE_NAME =
-		"serialization/java/lang/SecurityException.ser"; //$NON-NLS-1$
-	
 	/**
 	 * @tests java.lang.SecurityException#SecurityException()
 	 */
@@ -42,22 +40,19 @@
         assertNull(e.getCause());
     }
 
-	/**
-	 * @tests serialization/deserilazation.
-	 */
-	public void test_serialization() throws Exception {
-		SecurityException srcSecurityException = new SecurityException();
-		SecurityException destSecurityException = (SecurityException) SerializationTester
-				.getDeserilizedObject(srcSecurityException);
-	}
+    /**
+     * @tests serialization/deserialization.
+     */
+    public void testSerializationSelf() throws Exception {
 
-	/**
-	 * @tests serialization/deserilazation compatibility with RI.
-	 */
-	public void test_serializationCompatibility() throws Exception {
-		SecurityException srcSecurityException = new SecurityException();
-		SecurityException destSecurityException = (SecurityException) SerializationTester
-				.readObject(srcSecurityException,
-						SERIALIZATION_FILE_NAME);
-	}
+        SerializationTest.verifySelf(new SecurityException());
+    }
+
+    /**
+     * @tests serialization/deserialization compatibility with RI.
+     */
+    public void testSerializationCompatibility() throws Exception {
+
+        SerializationTest.verifyGolden(this, new SecurityException());
+    }
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/StringBufferTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/StringBufferTest.java?rev=437975&r1=437974&r2=437975&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/StringBufferTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/StringBufferTest.java
Mon Aug 28 22:50:22 2006
@@ -15,9 +15,13 @@
 
 package org.apache.harmony.luni.tests.java.lang;
 
-import tests.util.SerializationTester;
+import java.io.Serializable;
+
 import junit.framework.TestCase;
 
+import org.apache.harmony.testframework.serialization.SerializationTest;
+import org.apache.harmony.testframework.serialization.SerializationTest.SerializableAssert;
+
 public class StringBufferTest extends TestCase {
 
 	/**
@@ -450,17 +454,37 @@
             
         }
     }
-    
-    public void test_serialization() throws Exception {
-        final String fixture = "0123456789";
-        StringBuffer sb = new StringBuffer(fixture);
-        SerializationTester.assertEquals(sb);
+
+    // comparator for StringBuffer objects
+    private static final SerializableAssert STRING_BUFFER_COMPARATOR = new SerializableAssert()
{
+        public void assertDeserialized(Serializable initial,
+                Serializable deserialized) {
+
+            StringBuffer init = (StringBuffer) initial;
+            StringBuffer desr = (StringBuffer) deserialized;
+
+            // serializable fields are: 'count', 'shared', 'value'
+            // serialization of 'shared' is not verified
+            // 'count' + 'value' should result in required string
+            assertEquals("toString", init.toString(), desr.toString());
+        }
+    };
+
+    /**
+     * @tests serialization/deserialization.
+     */
+    public void testSerializationSelf() throws Exception {
+
+        SerializationTest.verifySelf(new StringBuffer("0123456789"),
+                STRING_BUFFER_COMPARATOR);
     }
 
-    public void test_serializationCompatability() throws Exception {
-        final String fixture = "0123456789";
-        StringBuffer sb = new StringBuffer(fixture);
-        SerializationTester.assertCompabilityEquals(sb,
-                "serialization/java/lang/StringBuffer.ser");
+    /**
+     * @tests serialization/deserialization compatibility with RI.
+     */
+    public void testSerializationCompatibility() throws Exception {
+
+        SerializationTest.verifyGolden(this, new StringBuffer("0123456789"),
+                STRING_BUFFER_COMPARATOR);
     }
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/StringBuilderTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/StringBuilderTest.java?rev=437975&r1=437974&r2=437975&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/StringBuilderTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/StringBuilderTest.java
Mon Aug 28 22:50:22 2006
@@ -17,12 +17,14 @@
 
 package org.apache.harmony.luni.tests.java.lang;
 
+import java.io.Serializable;
 import java.util.Arrays;
 
-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 StringBuilderTest extends TestCase {
 
 	/**
@@ -1771,18 +1773,35 @@
 		assertEquals(fixture.length(), sb.length());
 		assertEquals(fixture, sb.toString());
 	}
-    
-    public void test_serialization() throws Exception {
-        final String fixture = "0123456789";
-        StringBuilder sb = new StringBuilder(fixture);
-        SerializationTester.assertEquals(sb);
+
+    // comparator for StringBuilder objects
+    private static final SerializableAssert STRING_BILDER_COMPARATOR = new SerializableAssert()
{
+        public void assertDeserialized(Serializable initial,
+                Serializable deserialized) {
+
+            StringBuilder init = (StringBuilder) initial;
+            StringBuilder desr = (StringBuilder) deserialized;
+
+            assertEquals("toString", init.toString(), desr.toString());
+        }
+    };
+
+    /**
+     * @tests serialization/deserialization.
+     */
+    public void testSerializationSelf() throws Exception {
+
+        SerializationTest.verifySelf(new StringBuilder("0123456789"),
+                STRING_BILDER_COMPARATOR);
     }
 
-    public void test_serializationCompatability() throws Exception {
-        final String fixture = "0123456789";
-        StringBuilder sb = new StringBuilder(fixture);
-        SerializationTester.assertCompabilityEquals(sb,
-                "serialization/java/lang/StringBuilder.ser");
+    /**
+     * @tests serialization/deserialization compatibility with RI.
+     */
+    public void testSerializationCompatibility() throws Exception {
+
+        SerializationTest.verifyGolden(this, new StringBuilder("0123456789"),
+                STRING_BILDER_COMPARATOR);
     }
 
 	private static final class Fixture {

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/UnsupportedOperationExceptionTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/UnsupportedOperationExceptionTest.java?rev=437975&r1=437974&r2=437975&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/UnsupportedOperationExceptionTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/UnsupportedOperationExceptionTest.java
Mon Aug 28 22:50:22 2006
@@ -16,13 +16,11 @@
 package org.apache.harmony.luni.tests.java.lang;
 
 import junit.framework.TestCase;
-import tests.util.SerializationTester;
+
+import org.apache.harmony.testframework.serialization.SerializationTest;
 
 public class UnsupportedOperationExceptionTest extends TestCase {
 
-	private static final String SERIALIZATION_FILE_NAME =
-		"serialization/java/lang/UnsupportedOperationException.ser"; //$NON-NLS-1$
-	
 	/**
 	 * @tests java.lang.UnsupportedOperationException#UnsupportedOperationException()
 	 */
@@ -42,22 +40,20 @@
         assertNull(e.getCause());
     }
 	
-	/**
-	 * @tests serialization/deserilazation.
-	 */
-	public void test_serialization() throws Exception {
-		UnsupportedOperationException srcUnsupportedOperationException = new UnsupportedOperationException();
-		UnsupportedOperationException destUnsupportedOperationException = (UnsupportedOperationException)
SerializationTester
-				.getDeserilizedObject(srcUnsupportedOperationException);
-	}
+    /**
+     * @tests serialization/deserialization.
+     */
+    public void testSerializationSelf() throws Exception {
 
-	/**
-	 * @tests serialization/deserilazation compatibility with RI.
-	 */
-	public void test_serializationCompatibility() throws Exception {
-		UnsupportedOperationException srcUnsupportedOperationException = new UnsupportedOperationException();
-		UnsupportedOperationException destUnsupportedOperationException = (UnsupportedOperationException)
SerializationTester
-				.readObject(srcUnsupportedOperationException,
-						SERIALIZATION_FILE_NAME);
-	}
+        SerializationTest.verifySelf(new UnsupportedOperationException());
+    }
+
+    /**
+     * @tests serialization/deserialization compatibility with RI.
+     */
+    public void testSerializationCompatibility() throws Exception {
+
+        SerializationTest.verifyGolden(this,
+                new UnsupportedOperationException());
+    }
 }



Mime
View raw message