public void testProtobuf() throws Exception
    {
        Schema<Zoo> schema = RuntimeSchema.getSchema(Zoo.class);
        Zoo p = filledZoo();

        byte[] data = ProtobufIOUtil.toByteArray(p, schema, buf());
        // System.err.println("protobuf: " + data.length);

        Zoo p2 = new Zoo();
        ProtobufIOUtil.mergeFrom(data, p2, schema);

        assertEquals(p, p2);

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

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

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

        assertEquals(list, parsedList);
    }
Test for polymorphic serialization.
<p>
See {@link RuntimeDerivativeField} for details.

@author David Yu
@created Jan 15, 2011
protostuff-runtime/src/test/java/io/protostuff/runtime/PolymorphicSerializationTest.java