From 34fd5fda85e35981770e85c0db052748ba8888f3 Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Tue, 18 Nov 2008 21:15:32 +0000 Subject: [PATCH] Test our streamable tuple changes. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5558 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- .../com/threerings/io/StreamableTest.java | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/tests/src/java/com/threerings/io/StreamableTest.java b/tests/src/java/com/threerings/io/StreamableTest.java index f75bb35da..04ddbb255 100644 --- a/tests/src/java/com/threerings/io/StreamableTest.java +++ b/tests/src/java/com/threerings/io/StreamableTest.java @@ -28,6 +28,8 @@ import java.io.IOException; import junit.framework.Test; import junit.framework.TestCase; +import com.threerings.util.StreamableTuple; + /** * Tests the {@link Streamable} class. */ @@ -116,18 +118,17 @@ public class StreamableTest extends TestCase oout.writeObject(w); w.string1 = "three"; oout.writeObject(w); + oout.writeObject(StreamableTuple.newTuple("left", "right")); byte[] data = bout.toByteArray(); // System.out.println(data.length + " bytes were written."); ByteArrayInputStream bin = new ByteArrayInputStream(data); ObjectInputStream oin = new ObjectInputStream(bin); -// System.out.println(oin.readObject()); -// System.out.println(oin.readObject()); -// System.out.println(oin.readObject()); - oin.readObject(); - oin.readObject(); - oin.readObject(); + readObject(oin); // widget + readObject(oin); // modified widget + readObject(oin); // again modified widget + readObject(oin); // streamable tuple } catch (Exception e) { e.printStackTrace(); @@ -135,6 +136,14 @@ public class StreamableTest extends TestCase } } + protected Object readObject (ObjectInputStream oin) + throws Exception + { + Object object = oin.readObject(); + System.out.println(object); + return object; + } + public static Test suite () { return new StreamableTest();