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

        for (Bar barCompare : new Bar[] { bar, negativeBar })
        {
            Bar dbar = new Bar();

            ByteArrayOutputStream out = new ByteArrayOutputStream();
            LinkedBuffer buffer = buf();
            try
            {
                JsonXIOUtil.writeTo(out, barCompare, schema, true, buffer);
            }
            finally
            {
                buffer.clear();
            }
            byte[] data = out.toByteArray();

            JsonIOUtil.mergeFrom(data, dbar, schema, true);
            SerializableObjects.assertEquals(barCompare, dbar);
        }
    }
Test for JsonXOutput on runtime pojos (polymorphic too).

@author David Yu
@created Jan 16, 2011
protostuff-json/src/test/java/io/protostuff/JsonXNumericRuntimeTest.java