mil.dod.th.ose.remote/test/mil/dod/th/ose/remote/ccomms/TestTransportLayerMessageService.java
@Test
    public void testIsReceiving() throws IOException
    {
        IsReceivingRequestData request = IsReceivingRequestData.newBuilder()
                .setUuid(SharedMessageUtils.convertUUIDToProtoUUID(testUuid))
                .build();
        
        TransportLayerNamespace transportMessage = TransportLayerNamespace.newBuilder()
                .setType(TransportLayerMessageType.IsReceivingRequest)
                .setData(request.toByteString())
                .build();
        
        TerraHarvestMessage message = createTransportLayerMessage(transportMessage);
        TerraHarvestPayload payload = createPayload(transportMessage);
        
        // mock the channel the message came from
        RemoteChannel channel = mock(RemoteChannel.class);
        
        when(testLayer.isReceiving()).thenReturn(true);
        
        m_SUT.handleMessage(message, payload, channel);
        
        // verify the event contains the data message
        ArgumentCaptor<Event> eventCaptor = ArgumentCaptor.forClass(Event.class);
        verify(m_EventAdmin).postEvent(eventCaptor.capture());
        Event event = eventCaptor.getValue();
        
        assertThat((IsReceivingRequestData)event.getProperty(RemoteConstants.EVENT_PROP_DATA_MESSAGE),
                is(request));
        
        //capture and verify response
        ArgumentCaptor<IsReceivingResponseData> messageCaptor = ArgumentCaptor.forClass(
                IsReceivingResponseData.class);  
        verify(m_MessageFactory).createTransportLayerResponseMessage(eq(message), 
                eq(TransportLayerMessageType.IsReceivingResponse), messageCaptor.capture());
        verify(m_ResponseWrapper).queue(channel);
        
        IsReceivingResponseData response = messageCaptor.getValue();
 
        assertThat(response.getIsReceiving(), is(true));
    }
/**
     * Verify a link layer's receiving status can be retrieved, verify event posted for request message, 
     * verify event property key in the posted event is the correct request for the message that was sent, also 
     * capture argument values for the response message and make sure that the data sent is correct.
     */
Verify a link layer's receiving status can be retrieved, verify event posted for request message,
verify event property key in the posted event is the correct request for the message that was sent, also
capture argument values for the response message and make sure that the data sent is correct.
Verify a link layer ' s receiving status can be retrieved verify event posted for request message verify event property key in the posted event is the correct request for the message that was sent also capture argument values for the response message and make sure that the data sent is correct .
@Test
    public void testIsReceiving() throws IOException
    {
        IsReceivingRequestData request = IsReceivingRequestData.newBuilder()
                .setUuid(SharedMessageUtils.convertUUIDToProtoUUID(testUuid))
                .build();
        TransportLayerNamespace transportMessage = TransportLayerNamespace.newBuilder()
                .setType(TransportLayerMessageType.IsReceivingRequest)
                .setData(request.toByteString())
                .build();
        TerraHarvestMessage message = createTransportLayerMessage(transportMessage);
        TerraHarvestPayload payload = createPayload(transportMessage);
        RemoteChannel channel = mock(RemoteChannel.class);
        when(testLayer.isReceiving()).thenReturn(true);
        m_SUT.handleMessage(message, payload, channel);
        ArgumentCaptor<Event> eventCaptor = ArgumentCaptor.forClass(Event.class);
        verify(m_EventAdmin).postEvent(eventCaptor.capture());
        Event event = eventCaptor.getValue();
        assertThat((IsReceivingRequestData)event.getProperty(RemoteConstants.EVENT_PROP_DATA_MESSAGE),
                is(request));
        ArgumentCaptor<IsReceivingResponseData> messageCaptor = ArgumentCaptor.forClass(
                IsReceivingResponseData.class);  
        verify(m_MessageFactory).createTransportLayerResponseMessage(eq(message), 
                eq(TransportLayerMessageType.IsReceivingResponse), messageCaptor.capture());
        verify(m_ResponseWrapper).queue(channel);
        IsReceivingResponseData response = messageCaptor.getValue();
        assertThat(response.getIsReceiving(), is(true));
    }
@ Test public void testIsReceiving ( ) throws IOException { IsReceivingRequestData request = IsReceivingRequestData . newBuilder ( ) . setUuid ( SharedMessageUtils . convertUUIDToProtoUUID ( testUuid ) ) . build ( ) ; TransportLayerNamespace transportMessage = TransportLayerNamespace . newBuilder ( ) . setType ( TransportLayerMessageType . IsReceivingRequest ) . setData ( request . toByteString ( ) ) . build ( ) ; TerraHarvestMessage message = createTransportLayerMessage ( transportMessage ) ; TerraHarvestPayload payload = createPayload ( transportMessage ) ; RemoteChannel channel = mock ( RemoteChannel . class ) ; when ( testLayer . isReceiving ( ) ) . thenReturn ( true ) ; m_SUT . handleMessage ( message , payload , channel ) ; ArgumentCaptor < Event > eventCaptor = ArgumentCaptor . forClass ( Event . class ) ; verify ( m_EventAdmin ) . postEvent ( eventCaptor . capture ( ) ) ; Event event = eventCaptor . getValue ( ) ; assertThat ( ( IsReceivingRequestData ) event . getProperty ( RemoteConstants . EVENT_PROP_DATA_MESSAGE ) , is ( request ) ) ; ArgumentCaptor < IsReceivingResponseData > messageCaptor = ArgumentCaptor . forClass ( IsReceivingResponseData . class ) ; verify ( m_MessageFactory ) . createTransportLayerResponseMessage ( eq ( message ) , eq ( TransportLayerMessageType . IsReceivingResponse ) , messageCaptor . capture ( ) ) ; verify ( m_ResponseWrapper ) . queue ( channel ) ; IsReceivingResponseData response = messageCaptor . getValue ( ) ; assertThat ( response . getIsReceiving ( ) , is ( true ) ) ; }
Verify a link layer's receiving status can be retrieved, verify event posted for request message,
 verify event property key in the posted event is the correct request for the message that was sent, also
 capture argument values for the response message and make sure that the data sent is correct.
Verify a link layer ' s receiving status can be retrieved verify event posted for request message verify event property key in the posted event is the correct request for the message that was sent also capture argument values for the response message and make sure that the data sent is correct .
// mock the channel the message came from // verify the event contains the data message //capture and verify response