mil.dod.th.ose.remote/test/mil/dod/th/ose/remote/base/TestBaseMessageService.java
@Test
    public void testGetControllerCapabilitiesResponse() throws 
        IOException, BundleException, UnmarshalException, ObjectConverterException
    {
        ControllerCapabilities caps = ControllerCapabilities.newBuilder().
                setBase(BaseCapabilitiesGen.BaseCapabilities.newBuilder().
                    setProductName("something").
                    setDescription("someDescription")).
                setLowPowerModeSupported(false).setVoltageReported(false).
                setBatteryAmpHourReported(false).build();
        GetControllerCapabilitiesResponseData responseData = 
            GetControllerCapabilitiesResponseData.newBuilder().setControllerCapabilitiesNative(caps).build();
        BaseNamespace baseNamespaceMessage = BaseNamespace.newBuilder().
                setType(BaseMessageType.GetControllerCapabilitiesResponse).setData(responseData.toByteString()).build();
        TerraHarvestPayload payload = createPayload(baseNamespaceMessage);
        
        TerraHarvestMessage message = createBaseMessage(baseNamespaceMessage);
        
        // mock the channel the message came from
        RemoteChannel channel = mock(RemoteChannel.class);

        m_SUT.handleMessage(message, payload, channel);

        // verify event is posted
        ArgumentCaptor<Event> eventCaptor = ArgumentCaptor.forClass(Event.class);
        verify(m_EventAdmin).postEvent(eventCaptor.capture());
        assertThat((String)eventCaptor.getValue().getProperty(RemoteConstants.EVENT_PROP_MESSAGE_TYPE), 
            is(baseNamespaceMessage.getType().toString()));
    }
/**
     * Verify that correct controller capabilities response is sent when controller capabilities request is received.
     * 
     */
Verify that correct controller capabilities response is sent when controller capabilities request is received.
Verify that correct controller capabilities response is sent when controller capabilities request is received .
@Test
    public void testGetControllerCapabilitiesResponse() throws 
        IOException, BundleException, UnmarshalException, ObjectConverterException
    {
        ControllerCapabilities caps = ControllerCapabilities.newBuilder().
                setBase(BaseCapabilitiesGen.BaseCapabilities.newBuilder().
                    setProductName("something").
                    setDescription("someDescription")).
                setLowPowerModeSupported(false).setVoltageReported(false).
                setBatteryAmpHourReported(false).build();
        GetControllerCapabilitiesResponseData responseData = 
            GetControllerCapabilitiesResponseData.newBuilder().setControllerCapabilitiesNative(caps).build();
        BaseNamespace baseNamespaceMessage = BaseNamespace.newBuilder().
                setType(BaseMessageType.GetControllerCapabilitiesResponse).setData(responseData.toByteString()).build();
        TerraHarvestPayload payload = createPayload(baseNamespaceMessage);
        TerraHarvestMessage message = createBaseMessage(baseNamespaceMessage);
        RemoteChannel channel = mock(RemoteChannel.class);
        m_SUT.handleMessage(message, payload, channel);
        ArgumentCaptor<Event> eventCaptor = ArgumentCaptor.forClass(Event.class);
        verify(m_EventAdmin).postEvent(eventCaptor.capture());
        assertThat((String)eventCaptor.getValue().getProperty(RemoteConstants.EVENT_PROP_MESSAGE_TYPE), 
            is(baseNamespaceMessage.getType().toString()));
    }
@ Test public void testGetControllerCapabilitiesResponse ( ) throws IOException , BundleException , UnmarshalException , ObjectConverterException { ControllerCapabilities caps = ControllerCapabilities . newBuilder ( ) . setBase ( BaseCapabilitiesGen . BaseCapabilities . newBuilder ( ) . setProductName ( "something" ) . setDescription ( "someDescription" ) ) . setLowPowerModeSupported ( false ) . setVoltageReported ( false ) . setBatteryAmpHourReported ( false ) . build ( ) ; GetControllerCapabilitiesResponseData responseData = GetControllerCapabilitiesResponseData . newBuilder ( ) . setControllerCapabilitiesNative ( caps ) . build ( ) ; BaseNamespace baseNamespaceMessage = BaseNamespace . newBuilder ( ) . setType ( BaseMessageType . GetControllerCapabilitiesResponse ) . setData ( responseData . toByteString ( ) ) . build ( ) ; TerraHarvestPayload payload = createPayload ( baseNamespaceMessage ) ; TerraHarvestMessage message = createBaseMessage ( baseNamespaceMessage ) ; RemoteChannel channel = mock ( RemoteChannel . class ) ; m_SUT . handleMessage ( message , payload , channel ) ; ArgumentCaptor < Event > eventCaptor = ArgumentCaptor . forClass ( Event . class ) ; verify ( m_EventAdmin ) . postEvent ( eventCaptor . capture ( ) ) ; assertThat ( ( String ) eventCaptor . getValue ( ) . getProperty ( RemoteConstants . EVENT_PROP_MESSAGE_TYPE ) , is ( baseNamespaceMessage . getType ( ) . toString ( ) ) ) ; }
Verify that correct controller capabilities response is sent when controller capabilities request is received.
Verify that correct controller capabilities response is sent when controller capabilities request is received .
// mock the channel the message came from // verify event is posted