mil.dod.th.ose.remote/test/mil/dod/th/ose/remote/ccomms/TestPhysicalLinkMessageService.java
@Test
    public void testIsOpen() throws IOException
    {
        IsOpenRequestData request = IsOpenRequestData.newBuilder()
                .setUuid(SharedMessageUtils.convertUUIDToProtoUUID(testUuid))
                .build();
        
        PhysicalLinkNamespace ccommMessage = PhysicalLinkNamespace.newBuilder()
                .setType(PhysicalLinkMessageType.IsOpenRequest)
                .setData(request.toByteString())
                .build();
        
        TerraHarvestMessage message = createPhysicalLinkMessage(ccommMessage);
        TerraHarvestPayload payload = createPayload(ccommMessage);
        
        // mock the channel the message came from
        RemoteChannel channel = mock(RemoteChannel.class);
        
        // mock physical link
        when(m_CustomCommsService.getPhysicalLinkName(testUuid)).thenReturn("rawr");
        when(m_CustomCommsService.isPhysicalLinkOpen("rawr")).thenReturn(true);
        
        m_SUT.handleMessage(message, payload, channel);
        
        //capture and verify response
        ArgumentCaptor<IsOpenResponseData> messageCaptor = ArgumentCaptor.forClass(IsOpenResponseData.class);  
        
        verify(m_MessageFactory).createPhysicalLinkResponseMessage(eq(message), 
                eq(PhysicalLinkMessageType.IsOpenResponse), messageCaptor.capture());
        verify(m_ResponseWrapper).queue(channel);
        
        IsOpenResponseData response = messageCaptor.getValue();
 
        assertThat(response.getIsOpen(), is(true));
    }
/**
     * 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 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 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 testIsOpen() throws IOException
    {
        IsOpenRequestData request = IsOpenRequestData.newBuilder()
                .setUuid(SharedMessageUtils.convertUUIDToProtoUUID(testUuid))
                .build();
        PhysicalLinkNamespace ccommMessage = PhysicalLinkNamespace.newBuilder()
                .setType(PhysicalLinkMessageType.IsOpenRequest)
                .setData(request.toByteString())
                .build();
        TerraHarvestMessage message = createPhysicalLinkMessage(ccommMessage);
        TerraHarvestPayload payload = createPayload(ccommMessage);
        RemoteChannel channel = mock(RemoteChannel.class);
        when(m_CustomCommsService.getPhysicalLinkName(testUuid)).thenReturn("rawr");
        when(m_CustomCommsService.isPhysicalLinkOpen("rawr")).thenReturn(true);
        m_SUT.handleMessage(message, payload, channel);
        ArgumentCaptor<IsOpenResponseData> messageCaptor = ArgumentCaptor.forClass(IsOpenResponseData.class);  
        verify(m_MessageFactory).createPhysicalLinkResponseMessage(eq(message), 
                eq(PhysicalLinkMessageType.IsOpenResponse), messageCaptor.capture());
        verify(m_ResponseWrapper).queue(channel);
        IsOpenResponseData response = messageCaptor.getValue();
        assertThat(response.getIsOpen(), is(true));
    }
@ Test public void testIsOpen ( ) throws IOException { IsOpenRequestData request = IsOpenRequestData . newBuilder ( ) . setUuid ( SharedMessageUtils . convertUUIDToProtoUUID ( testUuid ) ) . build ( ) ; PhysicalLinkNamespace ccommMessage = PhysicalLinkNamespace . newBuilder ( ) . setType ( PhysicalLinkMessageType . IsOpenRequest ) . setData ( request . toByteString ( ) ) . build ( ) ; TerraHarvestMessage message = createPhysicalLinkMessage ( ccommMessage ) ; TerraHarvestPayload payload = createPayload ( ccommMessage ) ; RemoteChannel channel = mock ( RemoteChannel . class ) ; when ( m_CustomCommsService . getPhysicalLinkName ( testUuid ) ) . thenReturn ( "rawr" ) ; when ( m_CustomCommsService . isPhysicalLinkOpen ( "rawr" ) ) . thenReturn ( true ) ; m_SUT . handleMessage ( message , payload , channel ) ; ArgumentCaptor < IsOpenResponseData > messageCaptor = ArgumentCaptor . forClass ( IsOpenResponseData . class ) ; verify ( m_MessageFactory ) . createPhysicalLinkResponseMessage ( eq ( message ) , eq ( PhysicalLinkMessageType . IsOpenResponse ) , messageCaptor . capture ( ) ) ; verify ( m_ResponseWrapper ) . queue ( channel ) ; IsOpenResponseData response = messageCaptor . getValue ( ) ; assertThat ( response . getIsOpen ( ) , is ( true ) ) ; }
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 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 // mock physical link //capture and verify response