mil.dod.th.ose.remote/test/mil/dod/th/ose/remote/TestServerSocketChannel.java
@Test
    public void testGetChannelType() throws IOException
    {
        // mock the socket
        Socket socket = mock(Socket.class);
        SocketAddress socketAddress = mock(SocketAddress.class);
        when(socketAddress.toString()).thenReturn(REMOTE_SOCKET_ADDR);
        when(socket.getRemoteSocketAddress()).thenReturn(socketAddress);
        
        // activate the component
        Map<String, Object> props = new HashMap<String, Object>();
        props.put(ServerSocketChannel.SOCKET_PROP_KEY, socket);
        m_SUT.activate(props);
        
        assertThat(m_SUT.getChannelType(), is(RemoteChannelTypeEnum.SOCKET));
    }
/**
     * Verify that the channel type is set at initialization of the component.
     */
Verify that the channel type is set at initialization of the component.
Verify that the channel type is set at initialization of the component .
@Test
    public void testGetChannelType() throws IOException
    {
        Socket socket = mock(Socket.class);
        SocketAddress socketAddress = mock(SocketAddress.class);
        when(socketAddress.toString()).thenReturn(REMOTE_SOCKET_ADDR);
        when(socket.getRemoteSocketAddress()).thenReturn(socketAddress);
        Map<String, Object> props = new HashMap<String, Object>();
        props.put(ServerSocketChannel.SOCKET_PROP_KEY, socket);
        m_SUT.activate(props);
        assertThat(m_SUT.getChannelType(), is(RemoteChannelTypeEnum.SOCKET));
    }
@ Test public void testGetChannelType ( ) throws IOException { Socket socket = mock ( Socket . class ) ; SocketAddress socketAddress = mock ( SocketAddress . class ) ; when ( socketAddress . toString ( ) ) . thenReturn ( REMOTE_SOCKET_ADDR ) ; when ( socket . getRemoteSocketAddress ( ) ) . thenReturn ( socketAddress ) ; Map < String , Object > props = new HashMap < String , Object > ( ) ; props . put ( ServerSocketChannel . SOCKET_PROP_KEY , socket ) ; m_SUT . activate ( props ) ; assertThat ( m_SUT . getChannelType ( ) , is ( RemoteChannelTypeEnum . SOCKET ) ) ; }
Verify that the channel type is set at initialization of the component.
Verify that the channel type is set at initialization of the component .
// mock the socket // activate the component