static Bean fill(Bean bean)
    {
        bean.name = "test";

        Item share = new Item("share");

        List<Item> firstList = newList(share, new Item("new_a"));
        bean.firstList = firstList;

        List<Item> secondList = newList(share, new Item("new_a"));
        bean.secondList = secondList;

        Item share2;
        bean.firstItem = bean.secondItem = share2 = new Item("share2");

        Item share3 = new Item("share3");
        Map<String, Item> firstMap = newMap();
        firstMap.put("share", share);
        firstMap.put("share3", share3);
        bean.firstMap = firstMap;

        Map<String, Item> secondMap = newMap();
        secondMap.put("share", share);
        secondMap.put("share3", share3);
        bean.secondMap = secondMap;

        Item share4, share5;
        bean.firstHasName = bean.secondHashname = share4 = new Item("share4");

        bean.firstNamed = bean.secondNamed = share5 = new Item("share5");

        bean.firstObject = bean.secondObject = new Object();

        Item share6 = new Item("share6");
        Map<String, Item> firstStringMap = newMap();
        firstStringMap.put("share", share);
        firstStringMap.put("share6", share6);
        bean.firstStringMap = firstStringMap;

        Map<String, Item> secondStringMap = newMap();
        secondStringMap.put("share", share);
        secondStringMap.put("share6", share6);
        bean.secondStringMap = secondStringMap;

        Item share7 = new Item("share7");
        Map<HasName, Item> firstHasNameMap = newMap();
        firstHasNameMap.put(share, share);
        firstHasNameMap.put(share7, share7);
        bean.firstHasNameMap = firstHasNameMap;

        Map<HasName, Item> secondHasNameMap = newMap();
        secondHasNameMap.put(share, share);
        secondHasNameMap.put(share7, share7);
        bean.secondHasNameMap = secondHasNameMap;

        Item share8 = new Item("share8");
        Map<Named, Item> firstNamedMap = newMap();
        firstNamedMap.put(share, share);
        firstNamedMap.put(share8, share8);
        bean.firstNamedMap = firstNamedMap;

        Map<Named, Item> secondNamedMap = newMap();
        secondNamedMap.put(share, share);
        secondNamedMap.put(share8, share8);
        bean.secondNamedMap = secondNamedMap;

        bean.firstIntArray = bean.secondIntArray = new int[] { 1, 2, 3 };

        Item share9 = new Item("share9");
        Set<String> set = newSet("share9");
        Map<Set<String>, Item> firstSetMap = newMap();
        firstSetMap.put(set, share9);
        bean.firstSetMap = firstSetMap;

        Map<Set<String>, Item> secondSetMap = newMap();
        secondSetMap.put(set, share9);
        bean.secondSetMap = secondSetMap;

        Item share10 = new Item("share10");
        List<Order> orderList = newList(Order.ASCENDING, Order.DESCENDING,
                Order.ASCENDING);

        Map<List<Order>, Item> firstListMap = newMap();
        firstListMap.put(orderList, share10);
        bean.firstListMap = firstListMap;

        Map<List<Order>, Item> secondListMap = newMap();
        secondListMap.put(orderList, share10);
        bean.secondListMap = secondListMap;

        Item share11 = new Item("share11");
        EnumSet<Order> orderEnumSet = EnumSet.allOf(Order.class);

        Map<EnumSet<Order>, Item> firstEnumSetMap = newMap();
        firstEnumSetMap.put(orderEnumSet, share11);
        bean.firstEnumSetMap = firstEnumSetMap;

        Map<EnumSet<Order>, Item> secondEnumSetMap = newMap();
        secondEnumSetMap.put(orderEnumSet, share11);
        bean.secondEnumSetMap = secondEnumSetMap;

        Item share12 = new Item("share12");
        Map<String, Item> itemMap = newMap();
        itemMap.put("share12", share12);
        itemMap.put("share", share);

        List<Map<String, ?>> firstMapList = newList();
        firstMapList.add(itemMap);
        bean.firstMapList = firstMapList;

        List<Map<String, ?>> secondMapList = newList();
        secondMapList.add(itemMap);
        bean.secondMapList = secondMapList;

        Item share13 = new Item("share13");
        EnumMap<Order, Item> orderMap = new EnumMap<Order, Item>(Order.class);
        orderMap.put(Order.ASCENDING, share13);
        orderMap.put(Order.DESCENDING, share);

        List<EnumMap<Order, Item>> firstEnumMapList = newList();
        firstEnumMapList.add(orderMap);
        bean.firstEnumMapList = firstEnumMapList;

        List<EnumMap<Order, Item>> secondEnumMapList = newList();
        secondEnumMapList.add(orderMap);
        bean.secondEnumMapList = secondEnumMapList;

        Item share14 = new Item("share14");
        bean.itemArray = bean.firstItemArray = bean.secondItemArray = new Item[] {
                share, share2, share3, share4, share5, share6, share7, share8,
                share9, share10, share11, share12, share13, share14 };

        bean.itemArray2d = new Item[1][];
        bean.itemArray2d[0] = bean.firstItemArray;

        bean.itemArrayWrapper = new Object[] { bean.itemArray,
                bean.itemArray2d, share };

        Item share15 = new Item("share15");
        Set<Item> firstSet = newSet(share15);
        bean.firstSet = firstSet;

        Set<Item> secondSet = newSet(share15);
        bean.secondSet = secondSet;

        IdentityHashMap<Item, Item> identityMap = new IdentityHashMap<Item, Item>();
        identityMap.put(share, share);

        bean.identityMap = identityMap;

        Item share16 = new Item("share16");
        IdentityHashMap<Order, Item> anotherIdentityMap = new IdentityHashMap<Order, Item>();
        anotherIdentityMap.put(Order.ASCENDING, share16);
        anotherIdentityMap.put(Order.DESCENDING, share);

        bean.anotherIdentityMap = anotherIdentityMap;

        return bean;
    }
Test cyclic ser/deser on fields where the type is dynamic.

@author David Yu
@created Oct 20, 2011
protostuff-runtime/src/test/java/io/protostuff/runtime/ObjectSchemaTest.java