mil.dod.th.ose.remote/test/mil/dod/th/ose/remote/util/TestRemotePropertyConverter.java
@Test
    public final void testMapToComplexTypesMap_BadObs() throws Exception
    {
        // mock
        Map<String, Object> props = new HashMap<String, Object>();
        Observation obs = mock(Observation.class);
        props.put("observation", obs);

        when(m_Converter.convertToProto(Mockito.any(ObservationGen.Observation.class))).
            thenThrow(new ObjectConverterException("object converter fail"));

        try
        {
            m_SUT.mapToComplexTypesMap(props, RemoteTypesGen.LexiconFormat.Enum.NATIVE);
            fail("Expected exception because of mocking.");
        }
        catch (ObjectConverterException e)
        {
            //expected exception
        }
    }
/**
     * Test creating a protocol buffer message equivalent of property map from an event.
     * 
     * Verify exception as observation fails to convert.
     */
Test creating a protocol buffer message equivalent of property map from an event.

Verify exception as observation fails to convert.
Test creating a protocol buffer message equivalent of property map from an event . Verify exception as observation fails to convert .
@Test
    public final void testMapToComplexTypesMap_BadObs() throws Exception
    {
        Map<String, Object> props = new HashMap<String, Object>();
        Observation obs = mock(Observation.class);
        props.put("observation", obs);
        when(m_Converter.convertToProto(Mockito.any(ObservationGen.Observation.class))).
            thenThrow(new ObjectConverterException("object converter fail"));
        try
        {
            m_SUT.mapToComplexTypesMap(props, RemoteTypesGen.LexiconFormat.Enum.NATIVE);
            fail("Expected exception because of mocking.");
        }
        catch (ObjectConverterException e)
        {
        }
    }
@ Test public final void testMapToComplexTypesMap_BadObs ( ) throws Exception { Map < String , Object > props = new HashMap < String , Object > ( ) ; Observation obs = mock ( Observation . class ) ; props . put ( "observation" , obs ) ; when ( m_Converter . convertToProto ( Mockito . any ( ObservationGen . Observation . class ) ) ) . thenThrow ( new ObjectConverterException ( "object converter fail" ) ) ; try { m_SUT . mapToComplexTypesMap ( props , RemoteTypesGen . LexiconFormat . Enum . NATIVE ) ; fail ( "Expected exception because of mocking." ) ; } catch ( ObjectConverterException e ) { } }
Test creating a protocol buffer message equivalent of property map from an event.
Test creating a protocol buffer message equivalent of property map from an event .
// mock //expected exception