public void testRemoveAll() throws Exception { list.addAll(Arrays.asList(new String[] {"1", "2", "3", "4"})); assertEquals(4, bean.getList().size()); list.removeAll(Arrays.asList(new String[] {"2", "4"})); assertEquals(2, bean.getList().size()); assertEquals("1", bean.getList().get(0)); assertEquals("3", bean.getList().get(1)); }
public void testRemoveAllListChangeEvent() throws Exception { List elements = Arrays.asList(new String[] {"1", "2"}); list.addAll(elements); list.addAll(elements); ListChangeEventTracker listener = new ListChangeEventTracker(); list.addListChangeListener(listener); assertEquals(0, listener.count); list.removeAll(elements); ListChangeEvent event = listener.event; assertEquals(list, event.getObservableList()); assertSame(list, event.getObservableList()); assertDiff( event.diff, Arrays.asList(new Object[] {"1", "2", "1", "2"}), Collections.EMPTY_LIST); }