mil.dod.th.ose.remote/test/mil/dod/th/ose/remote/base/TestBaseMessageService.java
@Test
    public final void testGetControllerCapRequest_InvalidFormat() throws Exception
    {
        //build request
        GetControllerCapabilitiesRequestData requestData = GetControllerCapabilitiesRequestData.newBuilder()
                .setControllerCapabilitiesFormat(RemoteTypesGen.LexiconFormat.Enum.XML).build();
        BaseNamespace baseNamespaceMessage = BaseNamespace.newBuilder()
                .setType(BaseMessageType.GetControllerCapabilitiesRequest)
                .setData(requestData.toByteString()).build();
        TerraHarvestPayload payload = createPayload(baseNamespaceMessage);
        TerraHarvestMessage message = createBaseMessage(baseNamespaceMessage);

        // mock the channel the message came from
        RemoteChannel channel = mock(RemoteChannel.class);

        // replay
        try
        {
            m_SUT.handleMessage(message, payload, channel);
            fail("Expecting exception as requested format is not supported");
        }
        catch (UnsupportedOperationException e)
        {
            
        }
    }
/**
     * Verify exception is thrown if requested format is invalid.
     */
Verify exception is thrown if requested format is invalid.
Verify exception is thrown if requested format is invalid .
@Test
    public final void testGetControllerCapRequest_InvalidFormat() throws Exception
    {
        GetControllerCapabilitiesRequestData requestData = GetControllerCapabilitiesRequestData.newBuilder()
                .setControllerCapabilitiesFormat(RemoteTypesGen.LexiconFormat.Enum.XML).build();
        BaseNamespace baseNamespaceMessage = BaseNamespace.newBuilder()
                .setType(BaseMessageType.GetControllerCapabilitiesRequest)
                .setData(requestData.toByteString()).build();
        TerraHarvestPayload payload = createPayload(baseNamespaceMessage);
        TerraHarvestMessage message = createBaseMessage(baseNamespaceMessage);
        RemoteChannel channel = mock(RemoteChannel.class);
        try
        {
            m_SUT.handleMessage(message, payload, channel);
            fail("Expecting exception as requested format is not supported");
        }
        catch (UnsupportedOperationException e)
        {
        }
    }
@ Test public final void testGetControllerCapRequest_InvalidFormat ( ) throws Exception { GetControllerCapabilitiesRequestData requestData = GetControllerCapabilitiesRequestData . newBuilder ( ) . setControllerCapabilitiesFormat ( RemoteTypesGen . LexiconFormat . Enum . XML ) . build ( ) ; BaseNamespace baseNamespaceMessage = BaseNamespace . newBuilder ( ) . setType ( BaseMessageType . GetControllerCapabilitiesRequest ) . setData ( requestData . toByteString ( ) ) . build ( ) ; TerraHarvestPayload payload = createPayload ( baseNamespaceMessage ) ; TerraHarvestMessage message = createBaseMessage ( baseNamespaceMessage ) ; RemoteChannel channel = mock ( RemoteChannel . class ) ; try { m_SUT . handleMessage ( message , payload , channel ) ; fail ( "Expecting exception as requested format is not supported" ) ; } catch ( UnsupportedOperationException e ) { } }
Verify exception is thrown if requested format is invalid.
Verify exception is thrown if requested format is invalid .
//build request // mock the channel the message came from // replay