public void testCyclic() throws Exception
    {
        ClubFounder founder = new ClubFounder();
        founder.setName("some_glee_club_founder");

        Club gleeClub = new Club();
        gleeClub.setName("glee");

        founder.setClub(gleeClub);

        addPartnerStudentTo(gleeClub, "jake");

        // cyclic
        Student john = new Student();
        john.setName("john");
        john.addClub(gleeClub);
        gleeClub.addStudent(john);

        Student jane = new Student();
        jane.setName("jane");
        jane.addClub(gleeClub);
        gleeClub.addStudent(jane);

        // check that our scenario is coded correctly.
        checkLinks(founder);

        byte[] data = toByteArray(founder, ClubFounder.getSchema());

        // from byte array

        ClubFounder founderFromByteArray = new ClubFounder();
        mergeFrom(data, 0, data.length, founderFromByteArray, ClubFounder.getSchema());

        // verify parsed message
        checkLinks(founderFromByteArray);

        // from inputstream

        ClubFounder founderFromStream = new ClubFounder();
        ByteArrayInputStream in = new ByteArrayInputStream(data);
        mergeFrom(in, founderFromStream, ClubFounder.getSchema());

        // verify parsed message
        checkLinks(founderFromStream);
    }
Test ser/deser of graph objects (references and cyclic dependencies).

@author David Yu
@created Dec 10, 2010
protostuff-core/src/test/java/io/protostuff/GraphTest.java