mil.dod.th.ose.remote/test/mil/dod/th/ose/remote/observation/TestObservationMessageService.java
@Test
    public final void testGetObservationRequest_InvalidFormat() throws Exception
    {
        //build request
        Query query = Query.newBuilder().addObservationSubType(
                ObservationSubTypeEnumConverter.convertJavaEnumToProto(ObservationSubTypeEnum.AUDIO_METADATA)).build();
      
        GetObservationRequestData message = GetObservationRequestData.newBuilder()
                .setObservationFormat(RemoteTypesGen.LexiconFormat.Enum.XML)
                .setObsQuery(query).build();
        ObservationStoreNamespace namespace = ObservationStoreNamespace.newBuilder().
            setData(message.toByteString()).
            setType(ObservationStoreMessageType.GetObservationRequest).build();
        TerraHarvestPayload payload = createPayload(namespace);
        TerraHarvestMessage thMessage = createMessageObservationStore(namespace);

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

        // replay
        try
        {
            m_SUT.handleMessage(thMessage, 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 testGetObservationRequest_InvalidFormat() throws Exception
    {
        Query query = Query.newBuilder().addObservationSubType(
                ObservationSubTypeEnumConverter.convertJavaEnumToProto(ObservationSubTypeEnum.AUDIO_METADATA)).build();
        GetObservationRequestData message = GetObservationRequestData.newBuilder()
                .setObservationFormat(RemoteTypesGen.LexiconFormat.Enum.XML)
                .setObsQuery(query).build();
        ObservationStoreNamespace namespace = ObservationStoreNamespace.newBuilder().
            setData(message.toByteString()).
            setType(ObservationStoreMessageType.GetObservationRequest).build();
        TerraHarvestPayload payload = createPayload(namespace);
        TerraHarvestMessage thMessage = createMessageObservationStore(namespace);
        RemoteChannel channel = mock(RemoteChannel.class);
        try
        {
            m_SUT.handleMessage(thMessage, payload, channel);
            fail("Expecting exception as requested format is not supported");
        }
        catch (UnsupportedOperationException e)
        {
        }
    }
@ Test public final void testGetObservationRequest_InvalidFormat ( ) throws Exception { Query query = Query . newBuilder ( ) . addObservationSubType ( ObservationSubTypeEnumConverter . convertJavaEnumToProto ( ObservationSubTypeEnum . AUDIO_METADATA ) ) . build ( ) ; GetObservationRequestData message = GetObservationRequestData . newBuilder ( ) . setObservationFormat ( RemoteTypesGen . LexiconFormat . Enum . XML ) . setObsQuery ( query ) . build ( ) ; ObservationStoreNamespace namespace = ObservationStoreNamespace . newBuilder ( ) . setData ( message . toByteString ( ) ) . setType ( ObservationStoreMessageType . GetObservationRequest ) . build ( ) ; TerraHarvestPayload payload = createPayload ( namespace ) ; TerraHarvestMessage thMessage = createMessageObservationStore ( namespace ) ; RemoteChannel channel = mock ( RemoteChannel . class ) ; try { m_SUT . handleMessage ( thMessage , 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