mil.dod.th.ose.remote/test/mil/dod/th/ose/remote/asset/TestAssetMessageService.java
@Test
    public final void testGetLastStatus_InvalidFormat() throws Exception
    {
        //build request
        PerformBitRequestData request = PerformBitRequestData.newBuilder()
                .setUuid(SharedMessageUtils.convertUUIDToProtoUUID(m_AssetUuid))
                .setStatusObservationFormat(RemoteTypesGen.LexiconFormat.Enum.XML).build();
        AssetNamespace assetMessage = AssetNamespace.newBuilder().
                setType(AssetMessageType.GetLastStatusRequest).
                setData(request.toByteString()).build();
        TerraHarvestPayload payload = createPayload(assetMessage);
        TerraHarvestMessage message = createMessage(assetMessage);

        // 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 testGetLastStatus_InvalidFormat() throws Exception
    {
        PerformBitRequestData request = PerformBitRequestData.newBuilder()
                .setUuid(SharedMessageUtils.convertUUIDToProtoUUID(m_AssetUuid))
                .setStatusObservationFormat(RemoteTypesGen.LexiconFormat.Enum.XML).build();
        AssetNamespace assetMessage = AssetNamespace.newBuilder().
                setType(AssetMessageType.GetLastStatusRequest).
                setData(request.toByteString()).build();
        TerraHarvestPayload payload = createPayload(assetMessage);
        TerraHarvestMessage message = createMessage(assetMessage);
        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 testGetLastStatus_InvalidFormat ( ) throws Exception { PerformBitRequestData request = PerformBitRequestData . newBuilder ( ) . setUuid ( SharedMessageUtils . convertUUIDToProtoUUID ( m_AssetUuid ) ) . setStatusObservationFormat ( RemoteTypesGen . LexiconFormat . Enum . XML ) . build ( ) ; AssetNamespace assetMessage = AssetNamespace . newBuilder ( ) . setType ( AssetMessageType . GetLastStatusRequest ) . setData ( request . toByteString ( ) ) . build ( ) ; TerraHarvestPayload payload = createPayload ( assetMessage ) ; TerraHarvestMessage message = createMessage ( assetMessage ) ; 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