mil.dod.th.ose.remote/test/mil/dod/th/ose/remote/util/TestRemotePropertyConverter.java
@Test
    public final void testMapToComplexTypesMap_CommandResponse() throws Exception
    {
        // mock
        Map<String, Object> props = new HashMap<String, Object>();
        GetVersionResponse versionResponse = new GetVersionResponse(null, null, "version");
        props.put(Asset.EVENT_PROP_ASSET_COMMAND_RESPONSE, versionResponse);
        
        //command converter mocking
        JaxbProtoObjectConverter converter = mock(JaxbProtoObjectConverter.class);
        GetVersionResponseGen.GetVersionResponse protoVersion = 
                GetVersionResponseGen.GetVersionResponse.newBuilder()
                .setBase(BaseTypesGen.Response.getDefaultInstance())
                .setCurrentVersion("piggies")
                .build();
        when(converter.convertToProto(versionResponse)).thenReturn(protoVersion);
        when(m_CommandConverter.getCommandResponseEnumFromClassName(GetVersionResponse.class.getName())).
            thenReturn(CommandResponseEnum.GET_VERSION_RESPONSE);
        
        m_SUT.setJaxbProtoObjectConverter(converter);

        List<ComplexTypesMapEntry> complexMap = m_SUT.mapToComplexTypesMap(props, null);
        
        // verify
        boolean commandByteStringFound = false;
        for (ComplexTypesMapEntry entry : complexMap)
        {
            if (entry.getKey().equals(Asset.EVENT_PROP_ASSET_COMMAND_RESPONSE))
            {
                commandByteStringFound = true;
                assertThat(entry.getMulti().getByteStringValue(), is(protoVersion.toByteString()));
            }
        }
        assertThat(commandByteStringFound, is(true));
    }
/**
     * Test creating a protocol buffer message equivalent of property map which was a command response event.
     * 
     * Verify expected values are converted and verify interactions with command converter.
     */
Test creating a protocol buffer message equivalent of property map which was a command response event.

Verify expected values are converted and verify interactions with command converter.
Test creating a protocol buffer message equivalent of property map which was a command response event . Verify expected values are converted and verify interactions with command converter .
@Test
    public final void testMapToComplexTypesMap_CommandResponse() throws Exception
    {
        Map<String, Object> props = new HashMap<String, Object>();
        GetVersionResponse versionResponse = new GetVersionResponse(null, null, "version");
        props.put(Asset.EVENT_PROP_ASSET_COMMAND_RESPONSE, versionResponse);
        JaxbProtoObjectConverter converter = mock(JaxbProtoObjectConverter.class);
        GetVersionResponseGen.GetVersionResponse protoVersion = 
                GetVersionResponseGen.GetVersionResponse.newBuilder()
                .setBase(BaseTypesGen.Response.getDefaultInstance())
                .setCurrentVersion("piggies")
                .build();
        when(converter.convertToProto(versionResponse)).thenReturn(protoVersion);
        when(m_CommandConverter.getCommandResponseEnumFromClassName(GetVersionResponse.class.getName())).
            thenReturn(CommandResponseEnum.GET_VERSION_RESPONSE);
        m_SUT.setJaxbProtoObjectConverter(converter);
        List<ComplexTypesMapEntry> complexMap = m_SUT.mapToComplexTypesMap(props, null);
        boolean commandByteStringFound = false;
        for (ComplexTypesMapEntry entry : complexMap)
        {
            if (entry.getKey().equals(Asset.EVENT_PROP_ASSET_COMMAND_RESPONSE))
            {
                commandByteStringFound = true;
                assertThat(entry.getMulti().getByteStringValue(), is(protoVersion.toByteString()));
            }
        }
        assertThat(commandByteStringFound, is(true));
    }
@ Test public final void testMapToComplexTypesMap_CommandResponse ( ) throws Exception { Map < String , Object > props = new HashMap < String , Object > ( ) ; GetVersionResponse versionResponse = new GetVersionResponse ( null , null , "version" ) ; props . put ( Asset . EVENT_PROP_ASSET_COMMAND_RESPONSE , versionResponse ) ; JaxbProtoObjectConverter converter = mock ( JaxbProtoObjectConverter . class ) ; GetVersionResponseGen . GetVersionResponse protoVersion = GetVersionResponseGen . GetVersionResponse . newBuilder ( ) . setBase ( BaseTypesGen . Response . getDefaultInstance ( ) ) . setCurrentVersion ( "piggies" ) . build ( ) ; when ( converter . convertToProto ( versionResponse ) ) . thenReturn ( protoVersion ) ; when ( m_CommandConverter . getCommandResponseEnumFromClassName ( GetVersionResponse . class . getName ( ) ) ) . thenReturn ( CommandResponseEnum . GET_VERSION_RESPONSE ) ; m_SUT . setJaxbProtoObjectConverter ( converter ) ; List < ComplexTypesMapEntry > complexMap = m_SUT . mapToComplexTypesMap ( props , null ) ; boolean commandByteStringFound = false ; for ( ComplexTypesMapEntry entry : complexMap ) { if ( entry . getKey ( ) . equals ( Asset . EVENT_PROP_ASSET_COMMAND_RESPONSE ) ) { commandByteStringFound = true ; assertThat ( entry . getMulti ( ) . getByteStringValue ( ) , is ( protoVersion . toByteString ( ) ) ) ; } } assertThat ( commandByteStringFound , is ( true ) ) ; }
Test creating a protocol buffer message equivalent of property map which was a command response event.
Test creating a protocol buffer message equivalent of property map which was a command response event .
// mock //command converter mocking // verify