Created
October 7, 2011 03:29
-
-
Save nekop/1269370 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.msgpack; | |
import static org.junit.Assert.assertEquals; | |
import org.junit.Test; | |
import org.msgpack.annotation.Message; | |
import org.msgpack.MessagePack; | |
public class TestSimpleObject { | |
@Message | |
public static class SimpleObject { | |
private String name; | |
public String getName() { return name; } | |
public void setName(String name) { this.name = name; } | |
} | |
@Test | |
public void testSimpleObject() throws Exception { | |
MessagePack msgpack = new MessagePack(); | |
SimpleObject simpleObject = new SimpleObject(); | |
simpleObject.setName("foo"); | |
msgpack.register(SimpleObject.class); | |
byte[] bytes = msgpack.write(simpleObject); | |
SimpleObject simpleObjectUnpack = msgpack.read(bytes, SimpleObject.class); | |
assertEquals("foo", simpleObjectUnpack.getName()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment