changeset 229:cf2c58463e23

add MsgPackTest
author tatsuki
date Mon, 05 Oct 2015 14:55:50 +0900
parents 437f6e037bd4
children a202f84bda52
files src/test/java/jp/ac/u_ryukyu/ie/cr/data/MsgPack.java
diffstat 1 files changed, 35 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/test/java/jp/ac/u_ryukyu/ie/cr/data/MsgPack.java	Mon Oct 05 14:55:50 2015 +0900
@@ -0,0 +1,35 @@
+package jp.ac.u_ryukyu.ie.cr.data;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.msgpack.MessagePack;
+
+import java.io.*;
+
+/**
+ * Created by e115731 on 15/10/05.
+ */
+public class MsgPack {
+
+    @Test
+    public void MsgPack() throws IOException {
+        String timeStamp = Long.toString(System.currentTimeMillis());
+        File file = new File("./log/" + timeStamp + ".log");
+        OutputStream out = new FileOutputStream(file,true);
+        InputStream in = new FileInputStream(file);
+        MessagePack msgpack = new MessagePack();
+        String str = new String();
+        str =  "test1";
+        msgpack.write(out,str);
+        str =  "test2";
+        msgpack.write(out,str);
+        str =  "test3";
+        msgpack.write(out,str);
+        String str2 = msgpack.read(in, String.class);
+        Assert.assertEquals(str2,"test1");
+        str2 = msgpack.read(in, String.class);
+        Assert.assertEquals(str2, "test2");
+        str2 = msgpack.read(in, String.class);
+        Assert.assertEquals(str2, "test3");
+    }
+}