1 26 28 package de.nava.informa.utils; 29 30 import de.nava.informa.core.ChannelIF; 31 import de.nava.informa.core.ChannelObservableIF; 32 import de.nava.informa.core.ItemIF; 33 import de.nava.informa.impl.basic.Channel; 34 import de.nava.informa.impl.basic.Item; 35 36 public class TestChannelObserver extends InformaTestCase { 37 38 public TestChannelObserver(String name) { 39 super("TestChannelObserver", name); 40 } 41 42 public void testObserve() { 43 ChannelIF channel = new Channel("Niko's log"); 44 SimpleChannelObserver observer = new SimpleChannelObserver(); 45 ((ChannelObservableIF) channel).addObserver(observer); 46 assertEquals(0, channel.getItems().size()); 47 ItemIF item = new Item("Bongo", "Rongoo", null); 48 channel.addItem(item); 49 assertEquals(1, channel.getItems().size()); 50 assertTrue(channel.getItems().contains(item)); 51 assertEquals(item, observer.getMyAddedItem()); 52 53 } 54 55 } 56 | Popular Tags |