mil.dod.th.ose.shared/test/mil/dod/th/ose/shared/TestSharedMessageUtils.java
@Test 
    public void testConvertMaptoDictionary()
    {
        //Create a list of map entries
        SimpleTypesMapEntry testEntry = SimpleTypesMapEntry.newBuilder().setKey("something").
                setValue(Multitype.newBuilder().setType(Type.STRING).setStringValue("test1")).build();
 
        SimpleTypesMapEntry testEntry1 = SimpleTypesMapEntry.newBuilder().setKey("something1").
                setValue(Multitype.newBuilder().
                        setType(Type.UUID).setUuidMostSigBitsValue(20L).setUuidLeastSigBitsValue(10L)).build();
        
        SimpleTypesMapEntry testEntry2 = SimpleTypesMapEntry.newBuilder().setKey("something2").
                setValue(Multitype.newBuilder().
                        setType(Type.BYTE).setByteValue(10)).build();
        
        SimpleTypesMapEntry testEntry3 = SimpleTypesMapEntry.newBuilder().setKey("something3").
                setValue(Multitype.newBuilder().
                        setType(Type.CHARACTER).setCharValue("t")).build();
        
        SimpleTypesMapEntry testEntry4 = SimpleTypesMapEntry.newBuilder().setKey("something4").
                setValue(Multitype.newBuilder().
                        setType(Type.FLOAT).setFloatValue(10f)).build();
        
        SimpleTypesMapEntry testEntry5 = SimpleTypesMapEntry.newBuilder().setKey("something5").
                setValue(Multitype.newBuilder().
                        setType(Type.BOOL).setBoolValue(false)).build();
        
        SimpleTypesMapEntry testEntry6 = SimpleTypesMapEntry.newBuilder().setKey("something6").
                setValue(Multitype.newBuilder().
                        setType(Type.DOUBLE).setDoubleValue(10)).build();
        
        SimpleTypesMapEntry testEntry7 = SimpleTypesMapEntry.newBuilder().setKey("something7").
                setValue(Multitype.newBuilder().
                        setType(Type.INT32).setInt32Value(10)).build();
        SimpleTypesMapEntry testEntry8 = SimpleTypesMapEntry.newBuilder().setKey("something8").
                setValue(Multitype.newBuilder().
                        setType(Type.INT64).setInt64Value(5000)).build();
        SimpleTypesMapEntry testEntry9 = SimpleTypesMapEntry.newBuilder().setKey("something9").
                setValue(Multitype.newBuilder().
                        setType(Type.SHORT).setShortValue(2)).build();
        
        List<SimpleTypesMapEntry> testList = new ArrayList<SimpleTypesMapEntry>();   
        testList.add(testEntry);
        testList.add(testEntry1);
        testList.add(testEntry2);
        testList.add(testEntry3);
        testList.add(testEntry4);
        testList.add(testEntry5);
        testList.add(testEntry6);
        testList.add(testEntry7);
        testList.add(testEntry8);
        testList.add(testEntry9);
        
        //convert the map list to dictionary object
        Dictionary<String, Object> convertedList = SharedMessageUtils.convertMaptoDictionary(testList);
        UUID resultUUID = (UUID) convertedList.get("something1");
        Byte resultByte = (Byte) convertedList.get("something2");
        Character resultChar = (Character)convertedList.get("something3");
        Short resultShort = (Short) convertedList.get("something9");
        //verify values
        assertThat(testList.get(0).getValue().getStringValue(), is(convertedList.get("something"))); 
        assertThat(testList.get(1).getValue().getUuidLeastSigBitsValue(), is(resultUUID.getLeastSignificantBits())); 
        assertThat(testList.get(2).getValue().getByteValue(), is(resultByte.intValue()));
        assertThat(testList.get(3).getValue().getCharValue(), is(resultChar.toString()));
        assertThat(testList.get(4).getValue().getFloatValue(), is(convertedList.get("something4")));
        assertThat(testList.get(5).getValue().getBoolValue(), is(convertedList.get("something5")));
        assertThat(testList.get(6).getValue().getDoubleValue(), is(convertedList.get("something6")));
        assertThat(testList.get(7).getValue().getInt32Value(), is(convertedList.get("something7")));
        assertThat(testList.get(8).getValue().getInt64Value(), is(convertedList.get("something8")));
        assertThat(testList.get(9).getValue().getShortValue(), is(resultShort.intValue()));
    }
/**
     * Test and verify that a list of SimpleTypesMapEntry is properly converted to a Java native type Dictionary object
     */
Test and verify that a list of SimpleTypesMapEntry is properly converted to a Java native type Dictionary object
Test and verify that a list of SimpleTypesMapEntry is properly converted to a Java native type Dictionary object
@Test 
    public void testConvertMaptoDictionary()
    {
        SimpleTypesMapEntry testEntry = SimpleTypesMapEntry.newBuilder().setKey("something").
                setValue(Multitype.newBuilder().setType(Type.STRING).setStringValue("test1")).build();
        SimpleTypesMapEntry testEntry1 = SimpleTypesMapEntry.newBuilder().setKey("something1").
                setValue(Multitype.newBuilder().
                        setType(Type.UUID).setUuidMostSigBitsValue(20L).setUuidLeastSigBitsValue(10L)).build();
        SimpleTypesMapEntry testEntry2 = SimpleTypesMapEntry.newBuilder().setKey("something2").
                setValue(Multitype.newBuilder().
                        setType(Type.BYTE).setByteValue(10)).build();
        SimpleTypesMapEntry testEntry3 = SimpleTypesMapEntry.newBuilder().setKey("something3").
                setValue(Multitype.newBuilder().
                        setType(Type.CHARACTER).setCharValue("t")).build();
        SimpleTypesMapEntry testEntry4 = SimpleTypesMapEntry.newBuilder().setKey("something4").
                setValue(Multitype.newBuilder().
                        setType(Type.FLOAT).setFloatValue(10f)).build();
        SimpleTypesMapEntry testEntry5 = SimpleTypesMapEntry.newBuilder().setKey("something5").
                setValue(Multitype.newBuilder().
                        setType(Type.BOOL).setBoolValue(false)).build();
        SimpleTypesMapEntry testEntry6 = SimpleTypesMapEntry.newBuilder().setKey("something6").
                setValue(Multitype.newBuilder().
                        setType(Type.DOUBLE).setDoubleValue(10)).build();
        SimpleTypesMapEntry testEntry7 = SimpleTypesMapEntry.newBuilder().setKey("something7").
                setValue(Multitype.newBuilder().
                        setType(Type.INT32).setInt32Value(10)).build();
        SimpleTypesMapEntry testEntry8 = SimpleTypesMapEntry.newBuilder().setKey("something8").
                setValue(Multitype.newBuilder().
                        setType(Type.INT64).setInt64Value(5000)).build();
        SimpleTypesMapEntry testEntry9 = SimpleTypesMapEntry.newBuilder().setKey("something9").
                setValue(Multitype.newBuilder().
                        setType(Type.SHORT).setShortValue(2)).build();
        List<SimpleTypesMapEntry> testList = new ArrayList<SimpleTypesMapEntry>();   
        testList.add(testEntry);
        testList.add(testEntry1);
        testList.add(testEntry2);
        testList.add(testEntry3);
        testList.add(testEntry4);
        testList.add(testEntry5);
        testList.add(testEntry6);
        testList.add(testEntry7);
        testList.add(testEntry8);
        testList.add(testEntry9);
        Dictionary<String, Object> convertedList = SharedMessageUtils.convertMaptoDictionary(testList);
        UUID resultUUID = (UUID) convertedList.get("something1");
        Byte resultByte = (Byte) convertedList.get("something2");
        Character resultChar = (Character)convertedList.get("something3");
        Short resultShort = (Short) convertedList.get("something9");
        assertThat(testList.get(0).getValue().getStringValue(), is(convertedList.get("something"))); 
        assertThat(testList.get(1).getValue().getUuidLeastSigBitsValue(), is(resultUUID.getLeastSignificantBits())); 
        assertThat(testList.get(2).getValue().getByteValue(), is(resultByte.intValue()));
        assertThat(testList.get(3).getValue().getCharValue(), is(resultChar.toString()));
        assertThat(testList.get(4).getValue().getFloatValue(), is(convertedList.get("something4")));
        assertThat(testList.get(5).getValue().getBoolValue(), is(convertedList.get("something5")));
        assertThat(testList.get(6).getValue().getDoubleValue(), is(convertedList.get("something6")));
        assertThat(testList.get(7).getValue().getInt32Value(), is(convertedList.get("something7")));
        assertThat(testList.get(8).getValue().getInt64Value(), is(convertedList.get("something8")));
        assertThat(testList.get(9).getValue().getShortValue(), is(resultShort.intValue()));
    }
@ Test public void testConvertMaptoDictionary ( ) { SimpleTypesMapEntry testEntry = SimpleTypesMapEntry . newBuilder ( ) . setKey ( "something" ) . setValue ( Multitype . newBuilder ( ) . setType ( Type . STRING ) . setStringValue ( "test1" ) ) . build ( ) ; SimpleTypesMapEntry testEntry1 = SimpleTypesMapEntry . newBuilder ( ) . setKey ( "something1" ) . setValue ( Multitype . newBuilder ( ) . setType ( Type . UUID ) . setUuidMostSigBitsValue ( 20L ) . setUuidLeastSigBitsValue ( 10L ) ) . build ( ) ; SimpleTypesMapEntry testEntry2 = SimpleTypesMapEntry . newBuilder ( ) . setKey ( "something2" ) . setValue ( Multitype . newBuilder ( ) . setType ( Type . BYTE ) . setByteValue ( 10 ) ) . build ( ) ; SimpleTypesMapEntry testEntry3 = SimpleTypesMapEntry . newBuilder ( ) . setKey ( "something3" ) . setValue ( Multitype . newBuilder ( ) . setType ( Type . CHARACTER ) . setCharValue ( "t" ) ) . build ( ) ; SimpleTypesMapEntry testEntry4 = SimpleTypesMapEntry . newBuilder ( ) . setKey ( "something4" ) . setValue ( Multitype . newBuilder ( ) . setType ( Type . FLOAT ) . setFloatValue ( 10f ) ) . build ( ) ; SimpleTypesMapEntry testEntry5 = SimpleTypesMapEntry . newBuilder ( ) . setKey ( "something5" ) . setValue ( Multitype . newBuilder ( ) . setType ( Type . BOOL ) . setBoolValue ( false ) ) . build ( ) ; SimpleTypesMapEntry testEntry6 = SimpleTypesMapEntry . newBuilder ( ) . setKey ( "something6" ) . setValue ( Multitype . newBuilder ( ) . setType ( Type . DOUBLE ) . setDoubleValue ( 10 ) ) . build ( ) ; SimpleTypesMapEntry testEntry7 = SimpleTypesMapEntry . newBuilder ( ) . setKey ( "something7" ) . setValue ( Multitype . newBuilder ( ) . setType ( Type . INT32 ) . setInt32Value ( 10 ) ) . build ( ) ; SimpleTypesMapEntry testEntry8 = SimpleTypesMapEntry . newBuilder ( ) . setKey ( "something8" ) . setValue ( Multitype . newBuilder ( ) . setType ( Type . INT64 ) . setInt64Value ( 5000 ) ) . build ( ) ; SimpleTypesMapEntry testEntry9 = SimpleTypesMapEntry . newBuilder ( ) . setKey ( "something9" ) . setValue ( Multitype . newBuilder ( ) . setType ( Type . SHORT ) . setShortValue ( 2 ) ) . build ( ) ; List < SimpleTypesMapEntry > testList = new ArrayList < SimpleTypesMapEntry > ( ) ; testList . add ( testEntry ) ; testList . add ( testEntry1 ) ; testList . add ( testEntry2 ) ; testList . add ( testEntry3 ) ; testList . add ( testEntry4 ) ; testList . add ( testEntry5 ) ; testList . add ( testEntry6 ) ; testList . add ( testEntry7 ) ; testList . add ( testEntry8 ) ; testList . add ( testEntry9 ) ; Dictionary < String , Object > convertedList = SharedMessageUtils . convertMaptoDictionary ( testList ) ; UUID resultUUID = ( UUID ) convertedList . get ( "something1" ) ; Byte resultByte = ( Byte ) convertedList . get ( "something2" ) ; Character resultChar = ( Character ) convertedList . get ( "something3" ) ; Short resultShort = ( Short ) convertedList . get ( "something9" ) ; assertThat ( testList . get ( 0 ) . getValue ( ) . getStringValue ( ) , is ( convertedList . get ( "something" ) ) ) ; assertThat ( testList . get ( 1 ) . getValue ( ) . getUuidLeastSigBitsValue ( ) , is ( resultUUID . getLeastSignificantBits ( ) ) ) ; assertThat ( testList . get ( 2 ) . getValue ( ) . getByteValue ( ) , is ( resultByte . intValue ( ) ) ) ; assertThat ( testList . get ( 3 ) . getValue ( ) . getCharValue ( ) , is ( resultChar . toString ( ) ) ) ; assertThat ( testList . get ( 4 ) . getValue ( ) . getFloatValue ( ) , is ( convertedList . get ( "something4" ) ) ) ; assertThat ( testList . get ( 5 ) . getValue ( ) . getBoolValue ( ) , is ( convertedList . get ( "something5" ) ) ) ; assertThat ( testList . get ( 6 ) . getValue ( ) . getDoubleValue ( ) , is ( convertedList . get ( "something6" ) ) ) ; assertThat ( testList . get ( 7 ) . getValue ( ) . getInt32Value ( ) , is ( convertedList . get ( "something7" ) ) ) ; assertThat ( testList . get ( 8 ) . getValue ( ) . getInt64Value ( ) , is ( convertedList . get ( "something8" ) ) ) ; assertThat ( testList . get ( 9 ) . getValue ( ) . getShortValue ( ) , is ( resultShort . intValue ( ) ) ) ; }
Test and verify that a list of SimpleTypesMapEntry is properly converted to a Java native type Dictionary object
Test and verify that a list of SimpleTypesMapEntry is properly converted to a Java native type Dictionary object
//Create a list of map entries //convert the map list to dictionary object //verify values