/** * Test that the ListEvent iterator isn't adjusted by calling {@link * ListEventAssembler#forwardEvent}. */ public void testEventStateAfterForwardEvent() { EventList<String> source = new BasicEventList<String>(); ListConsistencyListener lcl = ListConsistencyListener.install(source); source.add("Hello"); assertEquals(1, lcl.getChangeCount(0)); }
/** * This test currently fails in the graph publisher implementation because we don't support * merging events in GraphDependenciesListEventPublisher. */ public void testMergingListEvents() { CompositeList<String> compositeList = new CompositeList<String>(); ListConsistencyListener<String> listConsistencyListener = ListConsistencyListener.install(compositeList); listConsistencyListener.setPreviousElementTracked(false); EventList<String> source = compositeList.createMemberList(); source.add("C"); source.add("A"); source.add("B"); SortedList<String> forwardSource = SortedList.create(source); SortedList<String> reverseSource = new SortedList<String>(source, GlazedLists.reverseComparator()); compositeList.addMemberList(forwardSource); compositeList.addMemberList(source); compositeList.addMemberList(reverseSource); assertEquals(compositeList, GlazedListsTests.stringToList("ABCCABCBA")); source.add(1, "D"); assertEquals(compositeList, GlazedListsTests.stringToList("ABCDCDABDCBA")); source.removeAll(GlazedListsTests.stringToList("AC")); assertEquals(compositeList, GlazedListsTests.stringToList("BDDBDB")); source.clear(); assertEquals(compositeList, GlazedListsTests.stringToList("")); source.addAll(GlazedListsTests.stringToList("CADB")); assertEquals(compositeList, GlazedListsTests.stringToList("ABCDCADBDCBA")); }