0
|
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
|