mil.dod.th.ose.gui.webapp/test/mil/dod/th/ose/gui/webapp/channel/TestChannelMgrImpl.java
@Test
    public void testCreateSocketChannel()
    {
        // mock lookup
        SocketChannel remoteChannel = mock(SocketChannel.class);
        when(m_RemoteChannelLookup.syncClientSocketChannel("localhost", 3001, 1957, true, false))
            .thenReturn(remoteChannel);
        
        // replay
        m_SUT.createSocketChannel(1957, "localhost", 3001, false);
        
        // verify channel is created and synced
        verify(m_RemoteChannelLookup).syncClientSocketChannel("localhost", 3001, 1957, true, false);
        
        // change sync call to throw exception
        when(m_RemoteChannelLookup.syncClientSocketChannel("localhost", 3001, 1957, true, false))
            .thenThrow(new ComponentException("fail"));
        m_SUT.createSocketChannel(1957, "localhost", 3001, false);
        
        // verify exception is caught and appropriately handled with a growl message
        verify(m_GrowlUtil).createLocalFacesMessage(eq(FacesMessage.SEVERITY_ERROR), anyString(), anyString(),
            Mockito.any(ComponentException.class));
    }
/**
     * Verify remote channel is created with the correct socket and then synced with lookup.
     * 
     * Verify system info request will be queued to new channel.
     * 
     * Verify controller manager is told about controller id.
     */
Verify remote channel is created with the correct socket and then synced with lookup.

Verify system info request will be queued to new channel.

Verify controller manager is told about controller id.
Verify remote channel is created with the correct socket and then synced with lookup . Verify system info request will be queued to new channel . Verify controller manager is told about controller id .
@Test
    public void testCreateSocketChannel()
    {
        SocketChannel remoteChannel = mock(SocketChannel.class);
        when(m_RemoteChannelLookup.syncClientSocketChannel("localhost", 3001, 1957, true, false))
            .thenReturn(remoteChannel);
        m_SUT.createSocketChannel(1957, "localhost", 3001, false);
        verify(m_RemoteChannelLookup).syncClientSocketChannel("localhost", 3001, 1957, true, false);
        when(m_RemoteChannelLookup.syncClientSocketChannel("localhost", 3001, 1957, true, false))
            .thenThrow(new ComponentException("fail"));
        m_SUT.createSocketChannel(1957, "localhost", 3001, false);
        verify(m_GrowlUtil).createLocalFacesMessage(eq(FacesMessage.SEVERITY_ERROR), anyString(), anyString(),
            Mockito.any(ComponentException.class));
    }
@ Test public void testCreateSocketChannel ( ) { SocketChannel remoteChannel = mock ( SocketChannel . class ) ; when ( m_RemoteChannelLookup . syncClientSocketChannel ( "localhost" , 3001 , 1957 , true , false ) ) . thenReturn ( remoteChannel ) ; m_SUT . createSocketChannel ( 1957 , "localhost" , 3001 , false ) ; verify ( m_RemoteChannelLookup ) . syncClientSocketChannel ( "localhost" , 3001 , 1957 , true , false ) ; when ( m_RemoteChannelLookup . syncClientSocketChannel ( "localhost" , 3001 , 1957 , true , false ) ) . thenThrow ( new ComponentException ( "fail" ) ) ; m_SUT . createSocketChannel ( 1957 , "localhost" , 3001 , false ) ; verify ( m_GrowlUtil ) . createLocalFacesMessage ( eq ( FacesMessage . SEVERITY_ERROR ) , anyString ( ) , anyString ( ) , Mockito . any ( ComponentException . class ) ) ; }
Verify remote channel is created with the correct socket and then synced with lookup.
Verify remote channel is created with the correct socket and then synced with lookup .
// mock lookup // replay // verify channel is created and synced // change sync call to throw exception // verify exception is caught and appropriately handled with a growl message