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

        Foo fooCompare = foo;
        Foo dfoo = new Foo();

        byte[] deferred = toByteArray(fooCompare, schema);

        // ComputedSizeOutput is format compatible with protobuf
        // E.g collections are not serialized ... only its members/elements are.
        if (!RuntimeEnv.COLLECTION_SCHEMA_ON_REPEATED_FIELDS)
            assertTrue(deferred.length == ComputedSizeOutput.getSize(
                    fooCompare, schema));

        ProtostuffIOUtil.mergeFrom(deferred, dfoo, schema);
        SerializableObjects.assertEquals(fooCompare, dfoo);
    }
Serialization and deserialization test cases.

@author David Yu
@created Nov 18, 2009
protostuff-runtime/src/test/java/io/protostuff/runtime/SerDeserTest.java