public void testAddAllAtIndex() throws Exception { List elements = Arrays.asList(new String[] {"1", "2"}); list.addAll(elements); assertEquals(2, list.size()); list.addAll(2, elements); assertEquals(4, bean.getList().size()); assertEquals(elements.get(0), bean.getList().get(0)); assertEquals(elements.get(1), bean.getList().get(1)); }
public void testAddAll() throws Exception { Collection elements = Arrays.asList(new String[] {"1", "2"}); assertEquals(0, list.size()); list.addAll(elements); assertEquals(2, bean.getList().size()); }
@Override public IObservableList getLanguageList() { if (myLanguageList == null) { myLanguageList = WritableList.withElementType(EcorePackage.Literals.ESTRING); myLanguageList.addAll(getEngines().keySet()); // TODO monitor changes.. } return myLanguageList; }
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 testAddAllAtIndexListChangeEvent() throws Exception { List elements = Arrays.asList(new String[] {"1", "2"}); list.addAll(elements); ListChangeEventTracker listener = new ListChangeEventTracker(); list.addListChangeListener(listener); assertEquals(0, listener.count); list.addAll(2, elements); assertEquals(1, listener.count); ListChangeEvent event = listener.event; assertSame(list, event.getObservableList()); assertDiff( event.diff, Arrays.asList(new Object[] {"1", "2"}), Arrays.asList(new Object[] {"1", "2", "1", "2"})); }
public void testRetainAllPropertyChangeEvent() throws Exception { list.addAll(Arrays.asList(new String[] {"0", "1"})); assertPropertyChangeEvent( bean, new Runnable() { @Override public void run() { list.retainAll(Arrays.asList(new String[] {"0"})); } }); }
public void testRetailAll() throws Exception { List elements = Arrays.asList(new String[] {"0", "1", "2", "3"}); list.addAll(elements); assertEquals(4, bean.getList().size()); list.retainAll(elements.subList(0, 2)); assertEquals(2, bean.getList().size()); assertEquals(elements.get(0), bean.getList().get(0)); assertEquals(elements.get(1), bean.getList().get(1)); }
/** * Updates the available brokers from a {@link BrokersStatus} event. * * @param statuses the new statuses */ public synchronized void setBrokersStatus(BrokersStatus statuses) { mBrokerMap.clear(); mAvailableBrokers.clear(); List<Broker> availableBrokers = Lists.newArrayList(); availableBrokers.add(AUTO_SELECT_BROKER); for (BrokerStatus status : statuses.getBrokers()) { if (status.getLoggedOn()) { Broker broker = new Broker(status.getName(), status.getId()); mBrokerMap.put(status.getId(), broker); availableBrokers.add(broker); } } mAvailableBrokers.addAll(availableBrokers); }
public void testAddAllListChangEvent() throws Exception { List elements = Arrays.asList(new String[] {"1", "2"}); assertEquals(0, list.size()); ListChangeEventTracker listener = new ListChangeEventTracker(); list.addListChangeListener(listener); assertEquals(0, listener.count); list.addAll(elements); assertEquals(1, listener.count); ListChangeEvent event = listener.event; assertSame(list, event.getObservableList()); assertDiff(event.diff, Collections.EMPTY_LIST, Arrays.asList(new String[] {"1", "2"})); }