mil.dod.th.ose.gui.webapp/test/mil/dod/th/ose/gui/webapp/channel/TestChannelMgrImpl.java
@Test
    public void testClearSocketChannelQueue()
    {
        //create mock socket
        SocketChannel channel = createMockSocketChannel("localhost", 3001, ChannelStatus.Active);
        
        List<RemoteChannel> listChans = new ArrayList<RemoteChannel>();
        listChans.add(channel);
        
        //mocking behavior
        when(m_RemoteChannelLookup.getChannels(8523)).thenReturn(listChans);
        List<Channel> channels = m_SUT.getChannelsForController(8523);
        when(m_RemoteChannelLookup.getSocketChannel("localhost", 3001)).thenReturn(channel);
        
        //ask the channel manager to clear the channels queue
        m_SUT.clearChannelQueue(channels.get(0));
        
        //verify
        verify(channel).clearQueuedMessages();
    }
/**
     * Test that the request to clear a socket channel's message queue.
     * Verify clear called on the appropriate channel.
     */
Test that the request to clear a socket channel's message queue.
Verify clear called on the appropriate channel.
Test that the request to clear a socket channel ' s message queue . Verify clear called on the appropriate channel .
@Test
    public void testClearSocketChannelQueue()
    {
        SocketChannel channel = createMockSocketChannel("localhost", 3001, ChannelStatus.Active);
        List<RemoteChannel> listChans = new ArrayList<RemoteChannel>();
        listChans.add(channel);
        when(m_RemoteChannelLookup.getChannels(8523)).thenReturn(listChans);
        List<Channel> channels = m_SUT.getChannelsForController(8523);
        when(m_RemoteChannelLookup.getSocketChannel("localhost", 3001)).thenReturn(channel);
        m_SUT.clearChannelQueue(channels.get(0));
        verify(channel).clearQueuedMessages();
    }
@ Test public void testClearSocketChannelQueue ( ) { SocketChannel channel = createMockSocketChannel ( "localhost" , 3001 , ChannelStatus . Active ) ; List < RemoteChannel > listChans = new ArrayList < RemoteChannel > ( ) ; listChans . add ( channel ) ; when ( m_RemoteChannelLookup . getChannels ( 8523 ) ) . thenReturn ( listChans ) ; List < Channel > channels = m_SUT . getChannelsForController ( 8523 ) ; when ( m_RemoteChannelLookup . getSocketChannel ( "localhost" , 3001 ) ) . thenReturn ( channel ) ; m_SUT . clearChannelQueue ( channels . get ( 0 ) ) ; verify ( channel ) . clearQueuedMessages ( ) ; }
Test that the request to clear a socket channel's message queue.
Test that the request to clear a socket channel ' s message queue .
//create mock socket //mocking behavior //ask the channel manager to clear the channels queue //verify