mil.dod.th.ose.remote/test/mil/dod/th/ose/remote/TestRemoteChannelLookupImpl.java
@Test
    public void testCheckChannelTransportExists()
    {
        //Empty
        assertThat(m_SUT.checkChannelTransportExists("1111", "1111"), is(false));
        
        //add a socket channel
        SocketChannel sChan = mockSocketChannel("localhost", 4000, false);
        
        m_SUT.syncChannel(sChan, 1);
        assertThat(m_SUT.checkChannelTransportExists("1111", "1111"), is(false));
        
        //add the transport and find
        TransportChannel tChan = mock(TransportChannel.class);
        when(tChan.getLocalMessageAddress()).thenReturn("1111");
        when(tChan.getRemoteMessageAddress()).thenReturn("1111");
        when(tChan.getTransportLayerName()).thenReturn("name");
        
        m_SUT.syncChannel(tChan, 1);
        assertThat(m_SUT.checkChannelTransportExists("3333", "3333"), is(false));
        assertThat(m_SUT.checkChannelTransportExists("1111", "3333"), is(false));
        assertThat(m_SUT.checkChannelTransportExists("3333", "1111"), is(false));
        assertThat(m_SUT.checkChannelTransportExists("1111", "1111"), is(true));
    }
/**
     * Verify that a proper transport duplicate can be found.
     */
Verify that a proper transport duplicate can be found.
Verify that a proper transport duplicate can be found .
@Test
    public void testCheckChannelTransportExists()
    {
        assertThat(m_SUT.checkChannelTransportExists("1111", "1111"), is(false));
        SocketChannel sChan = mockSocketChannel("localhost", 4000, false);
        m_SUT.syncChannel(sChan, 1);
        assertThat(m_SUT.checkChannelTransportExists("1111", "1111"), is(false));
        TransportChannel tChan = mock(TransportChannel.class);
        when(tChan.getLocalMessageAddress()).thenReturn("1111");
        when(tChan.getRemoteMessageAddress()).thenReturn("1111");
        when(tChan.getTransportLayerName()).thenReturn("name");
        m_SUT.syncChannel(tChan, 1);
        assertThat(m_SUT.checkChannelTransportExists("3333", "3333"), is(false));
        assertThat(m_SUT.checkChannelTransportExists("1111", "3333"), is(false));
        assertThat(m_SUT.checkChannelTransportExists("3333", "1111"), is(false));
        assertThat(m_SUT.checkChannelTransportExists("1111", "1111"), is(true));
    }
@ Test public void testCheckChannelTransportExists ( ) { assertThat ( m_SUT . checkChannelTransportExists ( "1111" , "1111" ) , is ( false ) ) ; SocketChannel sChan = mockSocketChannel ( "localhost" , 4000 , false ) ; m_SUT . syncChannel ( sChan , 1 ) ; assertThat ( m_SUT . checkChannelTransportExists ( "1111" , "1111" ) , is ( false ) ) ; TransportChannel tChan = mock ( TransportChannel . class ) ; when ( tChan . getLocalMessageAddress ( ) ) . thenReturn ( "1111" ) ; when ( tChan . getRemoteMessageAddress ( ) ) . thenReturn ( "1111" ) ; when ( tChan . getTransportLayerName ( ) ) . thenReturn ( "name" ) ; m_SUT . syncChannel ( tChan , 1 ) ; assertThat ( m_SUT . checkChannelTransportExists ( "3333" , "3333" ) , is ( false ) ) ; assertThat ( m_SUT . checkChannelTransportExists ( "1111" , "3333" ) , is ( false ) ) ; assertThat ( m_SUT . checkChannelTransportExists ( "3333" , "1111" ) , is ( false ) ) ; assertThat ( m_SUT . checkChannelTransportExists ( "1111" , "1111" ) , is ( true ) ) ; }
Verify that a proper transport duplicate can be found.
Verify that a proper transport duplicate can be found .
//Empty //add a socket channel //add the transport and find