public void testFooProtobuf() throws Exception
    {
        Foo fooCompare = foo;

        byte[] computed = toByteArrayComputedProtobuf(fooCompare, fooCompare.cachedSchema());
        byte[] buffered = toByteArrayBufferedProtobuf(fooCompare, fooCompare.cachedSchema());
        byte[] streamed = toByteArrayStreamedProtobuf(fooCompare, fooCompare.cachedSchema());

        assertTrue(computed.length == buffered.length);
        assertTrue(computed.length == streamed.length);

        String strComputed = new String(computed, "UTF-8");

        assertEquals(strComputed, new String(buffered, "UTF-8"));
        assertEquals(strComputed, new String(streamed, "UTF-8"));
    }
Benchmark to compare the serialization speed of 3 types. CodedOutput, BufferedOutput and DeferredOutput.

@author David Yu
@created Nov 13, 2009
protostuff-core/src/test/java/io/protostuff/CompareOutputsTest.java