ChannelList extends AbstractCollection<Channel> implements ComponentLifecycle, List<Channel>,
    ComponentLifecycleExtension { public void setChannels(List<Channel> l) { channels = Args.notNull(l, "channels"); addressableChannels.clear(); for (Channel c : l) { register(c); } } ChannelList();  ChannelList(Collection<Channel> coll); @Override void prepare(); @Override void init(); @Override void start(); @Override void stop(); @Override void close(); List<Channel> getChannels(); void setChannels(List<Channel> l); void addChannel(Channel channel); Channel getChannel(int pos); @Override int size(); Channel getChannel(String uniqueId); ChannelLifecycleStrategy getLifecycleStrategy(); void setLifecycleStrategy(ChannelLifecycleStrategy css); @Override Iterator<Channel> iterator(); @Override boolean remove(Object o); boolean removeChannel(Channel channel); @Override boolean add(Channel element); @Override void add(int index, Channel element); @Override boolean addAll(int index, Collection<? extends Channel> c); @Override Channel get(int index); @Override int indexOf(Object o); @Override int lastIndexOf(Object o); @Override void clear(); @Override ListIterator<Channel> listIterator(); @Override ListIterator<Channel> listIterator(int index); @Override Channel remove(int index); @Override Channel set(int index, Channel element); @Override List<Channel> subList(int fromIndex, int toIndex);  }
@Test public void testSetChannels() throws Exception { ChannelList list = new ChannelList(); try { list.setChannels(null); } catch (IllegalArgumentException expected) { } list.setChannels(Arrays.asList(new Channel[] { new Channel() })); assertEquals(1, list.size()); }
@Test public void testSetChannelsWithDuplicateID() { ChannelList list = new ChannelList(); try { list.setChannels(Arrays.asList(new Channel[] { new Channel() { @Override public String getUniqueId() { return "channel1"; } }, new Channel() { @Override public String getUniqueId() { return "channel1"; } } })); fail(); } catch (IllegalArgumentException expected) { } }