@Test
public void testMarshallAccount() throws Exception {
SerializationContext ctx = createContext();
Account account = new Account();
account.setId(1);
account.setDescription("test account");
Date creationDate = new Date();
account.setCreationDate(creationDate);
List<byte[]> blurb = new ArrayList<byte[]>();
blurb.add(new byte[0]);
blurb.add(new byte[]{1, 2, 3});
account.setBlurb(blurb);
byte[] bytes = ProtobufUtil.toByteArray(ctx, account);
Account decoded = ProtobufUtil.fromByteArray(ctx, bytes, Account.class);
assertEquals(1, decoded.getId());
assertEquals("test account", decoded.getDescription());
assertEquals(creationDate, decoded.getCreationDate());
assertNotNull(decoded.getBlurb());
assertEquals(2, decoded.getBlurb().size());
assertEquals(0, decoded.getBlurb().get(0).length);
assertEquals(3, decoded.getBlurb().get(1).length);
assertArrayEquals(new byte[]{1, 2, 3}, decoded.getBlurb().get(1));
}