public void testImmutablePojo() throws Exception
    {
        Schema<ImmutablePojo> schema = RuntimeSchema
                .getSchema(ImmutablePojo.class);
        ImmutablePojo p = new ImmutablePojo(3, "ip");

        byte[] data = ProtostuffIOUtil.toByteArray(p, schema, buf());

        ImmutablePojo p2 = schema.newMessage();
        ProtostuffIOUtil.mergeFrom(data, 0, data.length, p2, schema);

        assertEquals(p, p2);

        List<ImmutablePojo> list = new ArrayList<ImmutablePojo>();
        list.add(p);
        list.add(p2);

        ByteArrayOutputStream out = new ByteArrayOutputStream();
        ProtostuffIOUtil.writeListTo(out, list, schema, buf());
        byte[] listData = out.toByteArray();

        ByteArrayInputStream in = new ByteArrayInputStream(listData);
        List<ImmutablePojo> parsedList = ProtostuffIOUtil.parseListFrom(in,
                schema);

        assertEquals(list, parsedList);
    }
Test ser/deser for immutable objects.

@author David Yu
@created Feb 7, 2011
protostuff-runtime/src/test/java/io/protostuff/runtime/ImmutableObjectsTest.java