[jboss-cvs] JBossAS SVN: r62648 - projects/test/trunk/src/main/java/org/jboss/test.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Apr 30 12:49:45 EDT 2007
Author: adrian at jboss.org
Date: 2007-04-30 12:49:44 -0400 (Mon, 30 Apr 2007)
New Revision: 62648
Modified:
projects/test/trunk/src/main/java/org/jboss/test/AbstractTestCase.java
Log:
Add a serialize/deserialize convenience method.
Modified: projects/test/trunk/src/main/java/org/jboss/test/AbstractTestCase.java
===================================================================
--- projects/test/trunk/src/main/java/org/jboss/test/AbstractTestCase.java 2007-04-30 16:42:38 UTC (rev 62647)
+++ projects/test/trunk/src/main/java/org/jboss/test/AbstractTestCase.java 2007-04-30 16:49:44 UTC (rev 62648)
@@ -264,8 +264,24 @@
ObjectInputStream ois = new ObjectInputStream(bais);
return ois.readObject();
}
-
+
/**
+ * Serialize/deserialize
+ *
+ * @param <T> the expected type
+ * @param value the value
+ * @param expected the expected type
+ * @return the result
+ * @throws Exception for any problem
+ */
+ protected <T> T serializeDeserialize(Serializable value, Class<T> expected) throws Exception
+ {
+ byte[] bytes = serialize(value);
+ Object result = deserialize(bytes);
+ return assertInstanceOf(result, expected);
+ }
+
+ /**
* Check we have the expected type
*
* @param <T> the expected type
More information about the jboss-cvs-commits
mailing list