public void testBar() throws Exception
    {
        for (Bar barCompare : new Bar[] { bar, negativeBar })
        {
            byte[] data = toByteArray(barCompare, barCompare.cachedSchema());

            ByteArrayOutputStream out = new ByteArrayOutputStream();
            int total = writeTo(out, barCompare, barCompare.cachedSchema());

            assertTrue(data.length == total);

            byte[] data2 = out.toByteArray();

            assertTrue(data.length == data2.length);

            String text = STRING.deser(data);
            String text2 = STRING.deser(data2);

            assertEquals(text, text2);
        }
    }
Serialization tests for yaml.

@author David Yu
@created Jun 28, 2010
protostuff-yaml/src/test/java/io/protostuff/YamlSerTest.java