mil.dod.th.ose.gui.webapp/test/mil/dod/th/ose/gui/webapp/controller/TestControllerMgrImpl.java
@Test
    public void testChannelHelperChannelRemoved()
    {
        //add the channel first so that it can be removed 
        int contId = 123;
        RemoteChannel channel = mock(RemoteChannel.class);
        Map<Integer, Set<RemoteChannel>> remoteAns = new HashMap<>();
        Set<RemoteChannel> setRC = new HashSet<>();
        setRC.add(channel);
        
        remoteAns.put(contId, setRC);

        when(m_ChannelLookup.getAllChannels()).thenReturn(remoteAns);
        
        Event event = createBasicChannelUpdatedEvent(channel, contId);
        
        m_ChannelHelper.handleEvent(event);
        
        assertThat(m_SUT.getController(contId), notNullValue());
        
        when(m_ChannelLookup.getChannels(contId)).thenReturn(new ArrayList<RemoteChannel>());
        
        Event eventRemoved = createBasicChannelRemovedEvent();
        m_ChannelHelper.handleEvent(eventRemoved);
        
        ArgumentCaptor<Event> eventCaptor = ArgumentCaptor.forClass(Event.class);
        verify(m_EventAdmin, times(2)).postEvent(eventCaptor.capture());
        
        assertThat(eventCaptor.getAllValues().get(1).getTopic(), is(ControllerMgr.TOPIC_CONTROLLER_REMOVED));
    }
/**
     * Verify when channel removed event is handled that the recorded controller is removed and the controller 
     * removed event is created.
     */
Verify when channel removed event is handled that the recorded controller is removed and the controller
removed event is created.
Verify when channel removed event is handled that the recorded controller is removed and the controller removed event is created .
@Test
    public void testChannelHelperChannelRemoved()
    {
        int contId = 123;
        RemoteChannel channel = mock(RemoteChannel.class);
        Map<Integer, Set<RemoteChannel>> remoteAns = new HashMap<>();
        Set<RemoteChannel> setRC = new HashSet<>();
        setRC.add(channel);
        remoteAns.put(contId, setRC);
        when(m_ChannelLookup.getAllChannels()).thenReturn(remoteAns);
        Event event = createBasicChannelUpdatedEvent(channel, contId);
        m_ChannelHelper.handleEvent(event);
        assertThat(m_SUT.getController(contId), notNullValue());
        when(m_ChannelLookup.getChannels(contId)).thenReturn(new ArrayList<RemoteChannel>());
        Event eventRemoved = createBasicChannelRemovedEvent();
        m_ChannelHelper.handleEvent(eventRemoved);
        ArgumentCaptor<Event> eventCaptor = ArgumentCaptor.forClass(Event.class);
        verify(m_EventAdmin, times(2)).postEvent(eventCaptor.capture());
        assertThat(eventCaptor.getAllValues().get(1).getTopic(), is(ControllerMgr.TOPIC_CONTROLLER_REMOVED));
    }
@ Test public void testChannelHelperChannelRemoved ( ) { int contId = 123 ; RemoteChannel channel = mock ( RemoteChannel . class ) ; Map < Integer , Set < RemoteChannel > > remoteAns = new HashMap < > ( ) ; Set < RemoteChannel > setRC = new HashSet < > ( ) ; setRC . add ( channel ) ; remoteAns . put ( contId , setRC ) ; when ( m_ChannelLookup . getAllChannels ( ) ) . thenReturn ( remoteAns ) ; Event event = createBasicChannelUpdatedEvent ( channel , contId ) ; m_ChannelHelper . handleEvent ( event ) ; assertThat ( m_SUT . getController ( contId ) , notNullValue ( ) ) ; when ( m_ChannelLookup . getChannels ( contId ) ) . thenReturn ( new ArrayList < RemoteChannel > ( ) ) ; Event eventRemoved = createBasicChannelRemovedEvent ( ) ; m_ChannelHelper . handleEvent ( eventRemoved ) ; ArgumentCaptor < Event > eventCaptor = ArgumentCaptor . forClass ( Event . class ) ; verify ( m_EventAdmin , times ( 2 ) ) . postEvent ( eventCaptor . capture ( ) ) ; assertThat ( eventCaptor . getAllValues ( ) . get ( 1 ) . getTopic ( ) , is ( ControllerMgr . TOPIC_CONTROLLER_REMOVED ) ) ; }
Verify when channel removed event is handled that the recorded controller is removed and the controller
 removed event is created.
Verify when channel removed event is handled that the recorded controller is removed and the controller removed event is created .
//add the channel first so that it can be removed 