mil.dod.th.ose.remote/test/mil/dod/th/ose/remote/ccomms/TestLinkLayerMessageService.java
@Test
    public void testPerformBITResponse() throws CCommException, IOException
    {
        // create request
        PerformBITResponseData request = PerformBITResponseData.newBuilder()
                .setLinkUuid(SharedMessageUtils.convertUUIDToProtoUUID(testUuid))
                .setPerformBitStatus(CustomCommsTypes.LinkStatus.OK)
                .build();
        
        LinkLayerNamespace llMessage = LinkLayerNamespace.newBuilder()
                .setType(LinkLayerMessageType.PerformBITResponse)
                .setData(request.toByteString())
                .build();
        
        TerraHarvestPayload payload = createPayload(llMessage);
        TerraHarvestMessage message = createLinkLayerMessage(llMessage);
        
        // mock the channel the message came from
        RemoteChannel channel = mock(RemoteChannel.class);
        
        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((PerformBITResponseData)event.getProperty(RemoteConstants.EVENT_PROP_DATA_MESSAGE),
                is(request));
    }
/**
     * Test Perform BIT response.
     * Verify event.
     */
Test Perform BIT response.
Verify event.
Test Perform BIT response . Verify event .
@Test
    public void testPerformBITResponse() throws CCommException, IOException
    {
        PerformBITResponseData request = PerformBITResponseData.newBuilder()
                .setLinkUuid(SharedMessageUtils.convertUUIDToProtoUUID(testUuid))
                .setPerformBitStatus(CustomCommsTypes.LinkStatus.OK)
                .build();
        LinkLayerNamespace llMessage = LinkLayerNamespace.newBuilder()
                .setType(LinkLayerMessageType.PerformBITResponse)
                .setData(request.toByteString())
                .build();
        TerraHarvestPayload payload = createPayload(llMessage);
        TerraHarvestMessage message = createLinkLayerMessage(llMessage);
        RemoteChannel channel = mock(RemoteChannel.class);
        m_SUT.handleMessage(message, payload, channel);
        ArgumentCaptor<Event> eventCaptor = ArgumentCaptor.forClass(Event.class);
        verify(m_EventAdmin).postEvent(eventCaptor.capture());
        Event event = eventCaptor.getValue();
        assertThat((PerformBITResponseData)event.getProperty(RemoteConstants.EVENT_PROP_DATA_MESSAGE),
                is(request));
    }
@ Test public void testPerformBITResponse ( ) throws CCommException , IOException { PerformBITResponseData request = PerformBITResponseData . newBuilder ( ) . setLinkUuid ( SharedMessageUtils . convertUUIDToProtoUUID ( testUuid ) ) . setPerformBitStatus ( CustomCommsTypes . LinkStatus . OK ) . build ( ) ; LinkLayerNamespace llMessage = LinkLayerNamespace . newBuilder ( ) . setType ( LinkLayerMessageType . PerformBITResponse ) . setData ( request . toByteString ( ) ) . build ( ) ; TerraHarvestPayload payload = createPayload ( llMessage ) ; TerraHarvestMessage message = createLinkLayerMessage ( llMessage ) ; RemoteChannel channel = mock ( RemoteChannel . class ) ; m_SUT . handleMessage ( message , payload , channel ) ; ArgumentCaptor < Event > eventCaptor = ArgumentCaptor . forClass ( Event . class ) ; verify ( m_EventAdmin ) . postEvent ( eventCaptor . capture ( ) ) ; Event event = eventCaptor . getValue ( ) ; assertThat ( ( PerformBITResponseData ) event . getProperty ( RemoteConstants . EVENT_PROP_DATA_MESSAGE ) , is ( request ) ) ; }
Test Perform BIT response.
Test Perform BIT response .
// create request // mock the channel the message came from // verify the event contains the data message