Skip to content

Instantly share code, notes, and snippets.

@nekop
Created October 7, 2011 03:29
Show Gist options
  • Save nekop/1269370 to your computer and use it in GitHub Desktop.
Save nekop/1269370 to your computer and use it in GitHub Desktop.
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