mil.dod.th.ose.remote/test/mil/dod/th/ose/remote/TestServerSocketChannel.java
@Test
    public void testEmptyQueue()
    {
        // activate the component with mocked socket
        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);
        
        m_SUT.clearQueuedMessages();
        
        verify(m_MessageSender).clearQueue();
    }
/**
     * Verify the queue can be emptied for a particular channel. 
     * 
     * Verify message senders clear queue call is made.
     */
Verify the queue can be emptied for a particular channel.

Verify message senders clear queue call is made.
Verify the queue can be emptied for a particular channel . Verify message senders clear queue call is made .
@Test
    public void testEmptyQueue()
    {
        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);
        m_SUT.clearQueuedMessages();
        verify(m_MessageSender).clearQueue();
    }
@ Test public void testEmptyQueue ( ) { 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 ) ; m_SUT . clearQueuedMessages ( ) ; verify ( m_MessageSender ) . clearQueue ( ) ; }
Verify the queue can be emptied for a particular channel.
Verify the queue can be emptied for a particular channel .
// activate the component with mocked socket