(no commit message)
authorerik <erik@77661180-640e-0410-b3a8-9f9b13e6d0e0>
Fri, 30 Jul 2010 19:38:23 +0000 (19:38 +0000)
committererik <erik@77661180-640e-0410-b3a8-9f9b13e6d0e0>
Fri, 30 Jul 2010 19:38:23 +0000 (19:38 +0000)
wicket/joe/src/test/java/org/wamblee/wicket/inject/InjectionBehaviorTest.java

index 4a2fef21c8df962e8aa7ffdf738073244aa93bbf..d5c62024137d8940d3b524d792c80a095ccc2829 100644 (file)
@@ -24,6 +24,7 @@ import org.apache.wicket.Component;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
+import org.wamblee.general.ObjectSerializationUtils;
 import org.wamblee.inject.Injector;
 import org.wamblee.inject.InjectorBuilder;
 import org.wamblee.inject.InjectorFactory;
@@ -61,14 +62,8 @@ public class InjectionBehaviorTest {
     public void testInjectOnlyOnceAfterDeserialisation() throws Exception { 
         InjectionBehavior behavior = new InjectionBehavior();
         
-        ByteArrayOutputStream bos = new ByteArrayOutputStream(); 
-        ObjectOutputStream os = new ObjectOutputStream(bos); 
-        os.writeObject(behavior);
-        os.flush();
-        ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
-        ObjectInputStream ois = new ObjectInputStream(bis); 
-        behavior = (InjectionBehavior)ois.readObject();
-        
+        behavior = ObjectSerializationUtils.deserialize(ObjectSerializationUtils.serialize(behavior), InjectionBehavior.class);
+       
         behavior.beforeRender(component); 
         verify(injector).inject(same(component));
         reset(injector);