From 8e20b580861e4aec9cdce7968db2f65e6bff99ca Mon Sep 17 00:00:00 2001 From: Erik Brakkee Date: Fri, 30 Jul 2010 19:38:23 +0000 Subject: [PATCH] --- .../wamblee/wicket/inject/InjectionBehaviorTest.java | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/wicket/joe/src/test/java/org/wamblee/wicket/inject/InjectionBehaviorTest.java b/wicket/joe/src/test/java/org/wamblee/wicket/inject/InjectionBehaviorTest.java index 4a2fef21..d5c62024 100644 --- a/wicket/joe/src/test/java/org/wamblee/wicket/inject/InjectionBehaviorTest.java +++ b/wicket/joe/src/test/java/org/wamblee/wicket/inject/InjectionBehaviorTest.java @@ -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); -- 2.31.1