public void testShareFieldNumberAndTypeAndSkipMessage() throws Exception
    {
        final CustomSchema<Bar> barSchema = new CustomSchema<Bar>(bar.cachedSchema())
        {
            @Override
            public void writeTo(Output output, Bar message) throws IOException
            {
                output.writeObject(10, baz, Baz.getSchema(), false);
                super.writeTo(output, message);
            }
        };

        final Baz baz = new Baz();
        baz.setId(1);
        baz.setName("baz");
        final Bar bar = new Bar();
        bar.setSomeBaz(baz);
        bar.setSomeInt(2);
        bar.setSomeString("bar");
        bar.setSomeDouble(100.001d);
        bar.setSomeFloat(10.01f);

        byte[] coded = toByteArray(bar, barSchema);

        Foo foo = new Foo();
        // we expect this to succeed, skipping the baz field.
        mergeFrom(coded, 0, coded.length, foo, foo.cachedSchema());

        assertTrue(bar.getSomeInt() == foo.getSomeInt().get(0));
        assertEquals(bar.getSomeString(), foo.getSomeString().get(0));
        assertTrue(bar.getSomeDouble() == foo.getSomeDouble().get(0));
        assertTrue(bar.getSomeFloat() == foo.getSomeFloat().get(0));
    }
Foo shares field numbers (and type) with Bar except that foo's fields are all repeated (w/c is alright). Bar also
shares the same field and type (1&2) with Baz.
protostuff-core/src/test/java/io/protostuff/SerDeserTest.java