comparison src/test/java/org/msgpack/TestSimpleConvertUnconvert.java @ 0:cb825acd883a

first commit
author sugi
date Sat, 18 Oct 2014 15:06:15 +0900
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:cb825acd883a
1 package org.msgpack;
2
3 import static org.junit.Assert.assertEquals;
4 import static org.junit.Assert.assertArrayEquals;
5
6 import java.io.IOException;
7
8 import org.msgpack.MessagePack;
9 import org.msgpack.type.Value;
10
11 import org.junit.Test;
12
13
14 public class TestSimpleConvertUnconvert {
15 @Test
16 public void testSimpleConvert() throws IOException {
17 MessagePack msgpack = new MessagePack();
18 byte[] raw = msgpack.write(new int[] {1,2,3});
19
20 Value v = msgpack.read(raw);
21
22 int[] array = msgpack.convert(v, new int[3]);
23 assertArrayEquals(new int[] {1,2,3}, array);
24
25 Value v2 = msgpack.unconvert(array);
26 assertEquals(v, v2);
27 }
28 }
29