0
|
1 package org.msgpack.annotation;
|
|
2
|
|
3 import java.io.ByteArrayInputStream;
|
|
4 import java.io.ByteArrayOutputStream;
|
|
5
|
|
6 import org.junit.Test;
|
|
7 import org.msgpack.MessagePack;
|
|
8
|
|
9
|
|
10 public class TestOptionalPackUnpack {
|
|
11
|
|
12 @org.junit.Ignore
|
|
13 public static class TestMessagePack extends TestSetOptional {
|
|
14 public void testOptional0101() throws Exception {
|
|
15 super.testOptional0101();
|
|
16 }
|
|
17
|
|
18 public MyMessage01 testOptional0101(MyMessage01 src) throws Exception {
|
|
19 MessagePack msgpack = new MessagePack();
|
|
20 ByteArrayOutputStream out = new ByteArrayOutputStream();
|
|
21 msgpack.write(out, src);
|
|
22 byte[] bytes = out.toByteArray();
|
|
23 ByteArrayInputStream in = new ByteArrayInputStream(bytes);
|
|
24 return msgpack.read(in, MyMessage01.class);
|
|
25 }
|
|
26
|
|
27 public void testOptional0102() throws Exception {
|
|
28 super.testOptional0102();
|
|
29 }
|
|
30
|
|
31 public MyMessage02 testOptional0102(MyMessage01 src) throws Exception {
|
|
32 MessagePack msgpack = new MessagePack();
|
|
33 ByteArrayOutputStream out = new ByteArrayOutputStream();
|
|
34 msgpack.write(out, src);
|
|
35 byte[] bytes = out.toByteArray();
|
|
36 ByteArrayInputStream in = new ByteArrayInputStream(bytes);
|
|
37 return msgpack.read(in, MyMessage02.class);
|
|
38 }
|
|
39
|
|
40 public void testOptional0103() throws Exception {
|
|
41 super.testOptional0103();
|
|
42 }
|
|
43
|
|
44 public MyMessage03 testOptional0103(MyMessage01 src) throws Exception {
|
|
45 MessagePack msgpack = new MessagePack();
|
|
46 ByteArrayOutputStream out = new ByteArrayOutputStream();
|
|
47 msgpack.write(out, src);
|
|
48 byte[] bytes = out.toByteArray();
|
|
49 ByteArrayInputStream in = new ByteArrayInputStream(bytes);
|
|
50 return msgpack.read(in, MyMessage03.class);
|
|
51 }
|
|
52
|
|
53 public void testOptional0203() throws Exception {
|
|
54 super.testOptional0203();
|
|
55 }
|
|
56
|
|
57 public MyMessage03 testOptional0202(MyMessage02 src) throws Exception {
|
|
58 MessagePack msgpack = new MessagePack();
|
|
59 ByteArrayOutputStream out = new ByteArrayOutputStream();
|
|
60 msgpack.write(out, src);
|
|
61 byte[] bytes = out.toByteArray();
|
|
62 ByteArrayInputStream in = new ByteArrayInputStream(bytes);
|
|
63 return msgpack.read(in, MyMessage03.class);
|
|
64 }
|
|
65 }
|
|
66
|
|
67 @Test
|
|
68 public void test0101() throws Exception {
|
|
69 new TestMessagePack().testOptional0101();
|
|
70 }
|
|
71 @Test
|
|
72 public void test0102() throws Exception {
|
|
73 new TestMessagePack().testOptional0102();
|
|
74 }
|
|
75 @Test
|
|
76 public void test0103() throws Exception {
|
|
77 new TestMessagePack().testOptional0103();
|
|
78 }
|
|
79 @Test
|
|
80 public void test0203() throws Exception {
|
|
81 new TestMessagePack().testOptional0203();
|
|
82 }
|
|
83 }
|