@@ -0,0 +1,2951 @@
+package ie.omk.smpp.event;%0D%0A%0D%0Aimport ie.omk.smpp.Connection;%0D%0Aimport ie.omk.smpp.message.SMPPPacket;%0D%0Aimport junit.framework.TestCase;%0D%0A%0D%0A/**%0D%0A * @version $Id:$%0D%0A */%0D%0Apublic class SimpleEventDispatcherTest extends TestCase %7B%0D%0A%0D%0A    public void testGrowArray() %7B%0D%0A        SimpleEventDispatcher dispatcher = new SimpleEventDispatcher();%0D%0A        assertEquals(SimpleEventDispatcher.INCREMENT, dispatcher.capacity());%0D%0A        assertEquals(0, dispatcher.size());%0D%0A        for (int i = 0; i %3C SimpleEventDispatcher.INCREMENT + 1; i++) %7B%0D%0A            dispatcher.addObserver(new TestConnectionObserver());%0D%0A        %7D%0D%0A        assertEquals(%0D%0A                SimpleEventDispatcher.INCREMENT * 2, dispatcher.capacity());%0D%0A        assertEquals(SimpleEventDispatcher.INCREMENT + 1, dispatcher.size());%0D%0A    %7D%0D%0A%0D%0A    public void testAddObserver() %7B%0D%0A        SimpleEventDispatcher dispatcher = new SimpleEventDispatcher();%0D%0A        TestConnectionObserver observer = new TestConnectionObserver();%0D%0A        dispatcher.addObserver(observer);%0D%0A        assertTrue(dispatcher.contains(observer));%0D%0A        assertSame(observer, dispatcher.observerIterator().next());%0D%0A    %7D%0D%0A%0D%0A    public void testAddObserverDetectsDuplicates() %7B%0D%0A        SimpleEventDispatcher dispatcher = new SimpleEventDispatcher();%0D%0A        TestConnectionObserver observer = new TestConnectionObserver();%0D%0A        dispatcher.addObserver(observer);%0D%0A        assertEquals(1, dispatcher.size());%0D%0A        dispatcher.addObserver(observer);%0D%0A        assertEquals(1, dispatcher.size());%0D%0A    %7D%0D%0A    %0D%0A    public void testRemove() %7B%0D%0A        TestConnectionObserver ob1 = new TestConnectionObserver();%0D%0A        TestConnectionObserver ob2 = new TestConnectionObserver();%0D%0A        TestConnectionObserver ob3 = new TestConnectionObserver();%0D%0A        TestConnectionObserver ob4 = new TestConnectionObserver();%0D%0A        %0D%0A        SimpleEventDispatcher dispatcher = new SimpleEventDispatcher();%0D%0A        dispatcher.addObserver(ob1);%0D%0A        dispatcher.addObserver(ob2);%0D%0A        dispatcher.addObserver(ob3);%0D%0A        dispatcher.addObserver(ob4);%0D%0A        assertEquals(4, dispatcher.size());%0D%0A        %0D%0A        dispatcher.removeObserver(ob2);%0D%0A        dispatcher.removeObserver(ob3);%0D%0A        assertTrue(dispatcher.contains(ob1));%0D%0A        assertFalse(dispatcher.contains(ob2));%0D%0A        assertFalse(dispatcher.contains(ob3));%0D%0A        assertTrue(dispatcher.contains(ob4));%0D%0A%0D%0A        dispatcher.removeObserver(ob1);%0D%0A        assertEquals(1, dispatcher.size());%0D%0A        assertFalse(dispatcher.contains(ob1));%0D%0A        assertFalse(dispatcher.contains(ob2));%0D%0A        assertFalse(dispatcher.contains(ob3));%0D%0A        assertTrue(dispatcher.contains(ob4));%0D%0A    %7D%0D%0A    %0D%0A    private class TestConnectionObserver implements ConnectionObserver %7B%0D%0A        public void packetReceived(Connection source, SMPPPacket packet) %7B%0D%0A        %7D%0D%0A        public void update(Connection source, SMPPEvent event) %7B%0D%0A        %7D%0D%0A    %7D%0D%0A%7D%0D%0A

Add a unit test for SimpleEventDispatcher.