mil.dod.th.ose.remote/test/mil/dod/th/ose/remote/transport/TestTransportChannelImpl.java
@Test
    public void testQueueMessage() throws IOException, CCommException
    {
        // must activate to setup queue
        activateChannel(false, true, null);
        
        // construct a single base namespace message to verify sent to socket
        TerraHarvestMessage message = TerraHarvestMessageHelper.createBaseMessage();
        
        when(m_MessageSender.queue(message)).thenReturn(false);
        
        // replay
        boolean result = m_SUT.queueMessage(message);
        
        // verify message is passed down to queue and result returned by queue is returned
        verify(m_MessageSender).queue(message);
        assertThat("message reported the same as returned by sender", result, is(false));
        
        // mock to return true instead, verify result is passed correctly
        when(m_MessageSender.queue(message)).thenReturn(true);
        
        // replay
        result = m_SUT.queueMessage(message);
        
        // verify message is passed down 2nd time to queue and result returned by queue is returned
        verify(m_MessageSender, times(2)).queue(message);
        assertThat("message reported the same as returned by sender", result, is(true));   
    }
/**
     * Verify the message is sent using the given socket in binary form if no error sending message.
     */
Verify the message is sent using the given socket in binary form if no error sending message.
Verify the message is sent using the given socket in binary form if no error sending message .
@Test
    public void testQueueMessage() throws IOException, CCommException
    {
        activateChannel(false, true, null);
        TerraHarvestMessage message = TerraHarvestMessageHelper.createBaseMessage();
        when(m_MessageSender.queue(message)).thenReturn(false);
        boolean result = m_SUT.queueMessage(message);
        verify(m_MessageSender).queue(message);
        assertThat("message reported the same as returned by sender", result, is(false));
        when(m_MessageSender.queue(message)).thenReturn(true);
        result = m_SUT.queueMessage(message);
        verify(m_MessageSender, times(2)).queue(message);
        assertThat("message reported the same as returned by sender", result, is(true));   
    }
@ Test public void testQueueMessage ( ) throws IOException , CCommException { activateChannel ( false , true , null ) ; TerraHarvestMessage message = TerraHarvestMessageHelper . createBaseMessage ( ) ; when ( m_MessageSender . queue ( message ) ) . thenReturn ( false ) ; boolean result = m_SUT . queueMessage ( message ) ; verify ( m_MessageSender ) . queue ( message ) ; assertThat ( "message reported the same as returned by sender" , result , is ( false ) ) ; when ( m_MessageSender . queue ( message ) ) . thenReturn ( true ) ; result = m_SUT . queueMessage ( message ) ; verify ( m_MessageSender , times ( 2 ) ) . queue ( message ) ; assertThat ( "message reported the same as returned by sender" , result , is ( true ) ) ; }
Verify the message is sent using the given socket in binary form if no error sending message.
Verify the message is sent using the given socket in binary form if no error sending message .
// must activate to setup queue // construct a single base namespace message to verify sent to socket // replay // verify message is passed down to queue and result returned by queue is returned // mock to return true instead, verify result is passed correctly // replay // verify message is passed down 2nd time to queue and result returned by queue is returned