public void returns_all_channels_going_forward() { ChannelIterator it = tv.iterator(); int i = 0; while (it.hasNext()) { String currentChannel = it.currentChannel(); Assert.assertEquals(channels.get(i), currentChannel); i++; it.next(); } }
public void returns_all_channels_going_backwards() { ChannelIterator it = tv.iterator(); it.setPosition(2); int i = 2; while (it.hasPrevious()) { String currentChannel = it.currentChannel(); Assert.assertEquals(channels.get(i), currentChannel); i--; it.previous(); } }
public static void main(String[] args) { ChannelCollection listeChannel = new ChannelCollectionImpl(); listeChannel.addChannel(new Channel("M6 Kids", ChannelTypeEnum.KIDS)); listeChannel.addChannel(new Channel("M6 Music", ChannelTypeEnum.MUSIC)); listeChannel.addChannel(new Channel("M6 Pipo", ChannelTypeEnum.NEWS)); listeChannel.addChannel(new Channel("M6", ChannelTypeEnum.GENERAL)); ChannelIterator it = listeChannel.iterator(ChannelTypeEnum.GENERAL); while (it.hasNext()) { Channel c = it.next(); System.out.println(c.toString()); } System.out.println("****"); it = listeChannel.iterator(ChannelTypeEnum.KIDS); while (it.hasNext()) { Channel c = it.next(); System.out.println(c.toString()); } }
public void returns_first_channel() { ChannelIterator it = tv.iterator(); String currentChannel = it.currentChannel(); Assert.assertEquals("cnn", currentChannel); }