summaryrefslogtreecommitdiffstats
path: root/support
diff options
context:
space:
mode:
authorNarayan Kamath <narayan@google.com>2013-11-15 10:23:42 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2013-11-15 10:23:42 +0000
commitebf160a0a41f2ea819b5c5c2e33199c098312941 (patch)
treec90b52c8711baf8170696f1f07c82e169f74c3e1 /support
parent4cac31eba78e0002e19dae81443f664c66d83340 (diff)
parent9aab36ec35b4591cb9ba9ae0e4586cb642c39587 (diff)
downloadlibcore-ebf160a0a41f2ea819b5c5c2e33199c098312941.zip
libcore-ebf160a0a41f2ea819b5c5c2e33199c098312941.tar.gz
libcore-ebf160a0a41f2ea819b5c5c2e33199c098312941.tar.bz2
Merge "Add serialization golden files, fix tests."
Diffstat (limited to 'support')
-rw-r--r--support/src/test/java/org/apache/harmony/testframework/serialization/SerializationTest.java7
-rw-r--r--support/src/test/java/tests/util/SerializationTester.java41
2 files changed, 5 insertions, 43 deletions
diff --git a/support/src/test/java/org/apache/harmony/testframework/serialization/SerializationTest.java b/support/src/test/java/org/apache/harmony/testframework/serialization/SerializationTest.java
index 8d0c3a4..4f0b90b 100644
--- a/support/src/test/java/org/apache/harmony/testframework/serialization/SerializationTest.java
+++ b/support/src/test/java/org/apache/harmony/testframework/serialization/SerializationTest.java
@@ -22,6 +22,7 @@
package org.apache.harmony.testframework.serialization;
+import junit.framework.TestCase;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
@@ -38,7 +39,6 @@ import java.security.PermissionCollection;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
-import junit.framework.TestCase;
/**
* Framework for serialization testing. Subclasses only need to override
@@ -98,7 +98,6 @@ public abstract class SerializationTest extends TestCase {
*/
public void testGolden() throws Throwable {
-
verifyGolden(this, getData());
}
@@ -427,7 +426,9 @@ public abstract class SerializationTest extends TestCase {
path.append(test.getClass().getName().replace('.', File.separatorChar));
path.append(toAppend);
- InputStream in = SerializationTest.class.getResourceAsStream(path.toString());
+ String pathString = path.toString();
+
+ InputStream in = SerializationTest.class.getResourceAsStream(pathString);
assertNotNull("Failed to load serialization resource file: " + path, in);
return getObjectFromStream(in);
}
diff --git a/support/src/test/java/tests/util/SerializationTester.java b/support/src/test/java/tests/util/SerializationTester.java
index 93bff70..22635e1 100644
--- a/support/src/test/java/tests/util/SerializationTester.java
+++ b/support/src/test/java/tests/util/SerializationTester.java
@@ -32,32 +32,10 @@ import java.net.URL;
* This class simplifies the serialization test.
*/
public class SerializationTester {
-
- /*
- * --------------------------------------------------------------------
- * Class variables
- * --------------------------------------------------------------------
- */
-
- // the last deserialized object
- private static Object lastOutput = null;
-
- /*
- * -------------------------------------------------------------------
- * Constructors
- * -------------------------------------------------------------------
- */
-
private SerializationTester() {
}
- /*
- * -------------------------------------------------------------------
- * Methods
- * -------------------------------------------------------------------
- */
-
/**
* Serialize an object and then deserialize it.
*
@@ -74,7 +52,6 @@ public class SerializationTester {
ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
ObjectInputStream ois = new ObjectInputStream(bis);
Object outputObject = ois.readObject();
- lastOutput = outputObject;
ois.close();
return outputObject;
}
@@ -142,8 +119,7 @@ public class SerializationTester {
throws Exception {
InputStream input = null;
ObjectInputStream oinput = null;
- URL url = SerializationTester.class.getClassLoader().getResource(
- fileName);
+ URL url = SerializationTester.class.getClassLoader().getResource(fileName);
if (null == url) {
// serialization file does not exist, create one in the current dir
writeObject(obj, new File(fileName).getName());
@@ -213,19 +189,4 @@ public class SerializationTester {
}
}
}
-
- /**
- * Gets the last deserialized object.
- *
- * @return the last deserialized object
- */
- public static Object getLastOutput() {
- return lastOutput;
- }
-
- /*
- * For test purpose.
- */
- public static void main(String[] args) {
- }
}