mil.dod.th.ose.remote/test/mil/dod/th/ose/remote/transport/TestTransportChannelImpl.java
@Test
    public void testTrySendMessageInvalidTransport() throws IOException, CCommException
    {
        // Connection-less channel that is available
        activateChannel(false, true, null);
        
        // construct a single base namespace message to verify sent to socket
        TerraHarvestMessage message = TerraHarvestMessageHelper.createBaseMessage();
        
        // mock items need to send data
        when(m_CustomCommsService.getTransportLayer("tl1")).thenThrow(new IllegalArgumentException());
        
        // replay
        boolean sent = m_SUT.trySendMessage(message);
        assertThat("failed to send message as transport is invalid", sent, is(false));
        
        //check that status is unavailable
        assertThat(m_SUT.getStatus(), is(ChannelStatus.Unavailable));
    }
/**
     * Verify the exception is thrown if inner exception is thrown when looking up transport layer
     */
Verify the exception is thrown if inner exception is thrown when looking up transport layer
Verify the exception is thrown if inner exception is thrown when looking up transport layer
@Test
    public void testTrySendMessageInvalidTransport() throws IOException, CCommException
    {
        activateChannel(false, true, null);
        TerraHarvestMessage message = TerraHarvestMessageHelper.createBaseMessage();
        when(m_CustomCommsService.getTransportLayer("tl1")).thenThrow(new IllegalArgumentException());
        boolean sent = m_SUT.trySendMessage(message);
        assertThat("failed to send message as transport is invalid", sent, is(false));
        assertThat(m_SUT.getStatus(), is(ChannelStatus.Unavailable));
    }
@ Test public void testTrySendMessageInvalidTransport ( ) throws IOException , CCommException { activateChannel ( false , true , null ) ; TerraHarvestMessage message = TerraHarvestMessageHelper . createBaseMessage ( ) ; when ( m_CustomCommsService . getTransportLayer ( "tl1" ) ) . thenThrow ( new IllegalArgumentException ( ) ) ; boolean sent = m_SUT . trySendMessage ( message ) ; assertThat ( "failed to send message as transport is invalid" , sent , is ( false ) ) ; assertThat ( m_SUT . getStatus ( ) , is ( ChannelStatus . Unavailable ) ) ; }
Verify the exception is thrown if inner exception is thrown when looking up transport layer
Verify the exception is thrown if inner exception is thrown when looking up transport layer
// Connection-less channel that is available // construct a single base namespace message to verify sent to socket // mock items need to send data // replay //check that status is unavailable