Author: julien_viet
Date: 2011-09-27 03:41:15 -0400 (Tue, 27 Sep 2011)
New Revision: 7515
Modified:
components/pc/trunk/api/src/test/java/org/gatein/pc/api/PortletContextTestCase.java
Log:
clone object with IOTools
Modified:
components/pc/trunk/api/src/test/java/org/gatein/pc/api/PortletContextTestCase.java
===================================================================
---
components/pc/trunk/api/src/test/java/org/gatein/pc/api/PortletContextTestCase.java 2011-09-27
07:35:03 UTC (rev 7514)
+++
components/pc/trunk/api/src/test/java/org/gatein/pc/api/PortletContextTestCase.java 2011-09-27
07:41:15 UTC (rev 7515)
@@ -23,14 +23,10 @@
package org.gatein.pc.api;
+import junit.framework.AssertionFailedError;
import junit.framework.TestCase;
+import org.gatein.common.io.IOTools;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-
/**
* @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
* @version $Revision$
@@ -458,20 +454,15 @@
try
{
- final File tempFile = File.createTempFile("pc-serialized", null, new
File("/tmp"));
- tempFile.deleteOnExit();
- ObjectOutputStream out = new ObjectOutputStream(new
FileOutputStream(tempFile.getName()));
- out.writeObject(context);
- out.close();
-
- final ObjectInputStream in = new ObjectInputStream(new
FileInputStream(tempFile.getName()));
- final Object fromSerialization = in.readObject();
-
+ final Object fromSerialization = IOTools.clone(context);
+ assertNotSame(context, fromSerialization);
assertEquals(context, fromSerialization);
}
catch (Exception ex)
{
- fail(ex.getMessage());
+ AssertionFailedError afe = new AssertionFailedError();
+ afe.initCause(ex);
+ throw afe;
}
}
}
Show replies by date