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

        Zoo zoo = new Zoo();
        zoo.largestAnimal = filledBear();

        // overwriteZoo

        Zoo overwriteZoo = new Zoo();
        overwriteZoo.largestAnimal = filledTiger();

        // ser
        byte[] data = ProtostuffIOUtil.toByteArray(overwriteZoo, schema, buf());
        // deser
        ProtostuffIOUtil.mergeFrom(data, zoo, schema);

        // test that it was overwritten
        assertTrue(zoo.largestAnimal instanceof Tiger);
    }
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