mil.dod.th.ose.remote/test/mil/dod/th/ose/remote/TestMessageRouterImpl.java
@Test
    public void testUnbindRemoteChannelLookup()
    {
        BaseNamespace baseNamespaceMessage = BaseNamespace.newBuilder()
                .setType(BaseMessageType.ControllerInfo)
                .build();
        
        TerraHarvestMessage baseMessage = 
                TerraHarvestMessageHelper.createTerraHarvestMessage(0, 500, Namespace.Base, 100, 
                        baseNamespaceMessage);
        
        RemoteChannel channel = mock(RemoteChannel.class);
        List<RemoteChannel> channels = new ArrayList<RemoteChannel>();
        channels.add(channel);
        when(m_RemoteChannelLookup.getChannels(500)).thenReturn(channels);
        
        m_SUT.unbindRemoteChannelLookup(m_RemoteChannelLookup);
        
        m_SUT.handleMessage(baseMessage);
        
        ArgumentCaptor<Event> eventCaptor = ArgumentCaptor.forClass(Event.class);
        verify(m_EventAdmin).postEvent(eventCaptor.capture());
        
        Event invalidDestEvent = eventCaptor.getValue();
        assertThat(invalidDestEvent.getTopic(), is(RemoteConstants.TOPIC_MESSAGE_RECEIVED_UNREACHABLE_DEST));
        assertThat(invalidDestEvent.getProperty(RemoteConstants.EVENT_PROP_SOURCE_ID), is(0));
        assertThat(invalidDestEvent.getProperty(RemoteConstants.EVENT_PROP_DEST_ID), is(500));
        assertThat(invalidDestEvent.getProperty(RemoteConstants.EVENT_PROP_MESSAGE), is(baseMessage));
    }
/**
     * Verify that the remote channel lookup is unbound appropriately.
     */
Verify that the remote channel lookup is unbound appropriately.
Verify that the remote channel lookup is unbound appropriately .
@Test
    public void testUnbindRemoteChannelLookup()
    {
        BaseNamespace baseNamespaceMessage = BaseNamespace.newBuilder()
                .setType(BaseMessageType.ControllerInfo)
                .build();
        TerraHarvestMessage baseMessage = 
                TerraHarvestMessageHelper.createTerraHarvestMessage(0, 500, Namespace.Base, 100, 
                        baseNamespaceMessage);
        RemoteChannel channel = mock(RemoteChannel.class);
        List<RemoteChannel> channels = new ArrayList<RemoteChannel>();
        channels.add(channel);
        when(m_RemoteChannelLookup.getChannels(500)).thenReturn(channels);
        m_SUT.unbindRemoteChannelLookup(m_RemoteChannelLookup);
        m_SUT.handleMessage(baseMessage);
        ArgumentCaptor<Event> eventCaptor = ArgumentCaptor.forClass(Event.class);
        verify(m_EventAdmin).postEvent(eventCaptor.capture());
        Event invalidDestEvent = eventCaptor.getValue();
        assertThat(invalidDestEvent.getTopic(), is(RemoteConstants.TOPIC_MESSAGE_RECEIVED_UNREACHABLE_DEST));
        assertThat(invalidDestEvent.getProperty(RemoteConstants.EVENT_PROP_SOURCE_ID), is(0));
        assertThat(invalidDestEvent.getProperty(RemoteConstants.EVENT_PROP_DEST_ID), is(500));
        assertThat(invalidDestEvent.getProperty(RemoteConstants.EVENT_PROP_MESSAGE), is(baseMessage));
    }
@ Test public void testUnbindRemoteChannelLookup ( ) { BaseNamespace baseNamespaceMessage = BaseNamespace . newBuilder ( ) . setType ( BaseMessageType . ControllerInfo ) . build ( ) ; TerraHarvestMessage baseMessage = TerraHarvestMessageHelper . createTerraHarvestMessage ( 0 , 500 , Namespace . Base , 100 , baseNamespaceMessage ) ; RemoteChannel channel = mock ( RemoteChannel . class ) ; List < RemoteChannel > channels = new ArrayList < RemoteChannel > ( ) ; channels . add ( channel ) ; when ( m_RemoteChannelLookup . getChannels ( 500 ) ) . thenReturn ( channels ) ; m_SUT . unbindRemoteChannelLookup ( m_RemoteChannelLookup ) ; m_SUT . handleMessage ( baseMessage ) ; ArgumentCaptor < Event > eventCaptor = ArgumentCaptor . forClass ( Event . class ) ; verify ( m_EventAdmin ) . postEvent ( eventCaptor . capture ( ) ) ; Event invalidDestEvent = eventCaptor . getValue ( ) ; assertThat ( invalidDestEvent . getTopic ( ) , is ( RemoteConstants . TOPIC_MESSAGE_RECEIVED_UNREACHABLE_DEST ) ) ; assertThat ( invalidDestEvent . getProperty ( RemoteConstants . EVENT_PROP_SOURCE_ID ) , is ( 0 ) ) ; assertThat ( invalidDestEvent . getProperty ( RemoteConstants . EVENT_PROP_DEST_ID ) , is ( 500 ) ) ; assertThat ( invalidDestEvent . getProperty ( RemoteConstants . EVENT_PROP_MESSAGE ) , is ( baseMessage ) ) ; }
Verify that the remote channel lookup is unbound appropriately.
Verify that the remote channel lookup is unbound appropriately .