mil.dod.th.ose.core/test/mil/dod/th/ose/core/impl/asset/data/TestAssetFactoryObjectDataManagerImpl.java
@Test
    public void testGetOrientationBySensorId() throws FactoryObjectInformationException, ObjectConverterException,
        IllegalArgumentException, PersistenceFailedException, InvalidProtocolBufferException
    {
        //activate to create converters 
        m_SUT.activate();
        
        //persisted message with additional entry
        m_ProtoOrienList.add(OrientationEntry.newBuilder()
                .setKey("example-sensor-id")
                .setValue(m_ProtoOrien2)
                .build());
        m_OrienMap.put("example-sensor-id", m_Orientation2);
        m_FactData = FactoryObjectData.newBuilder().
                setName("original").
                setExtension(AssetObjectData.orientation, m_ProtoOrienList).build();
        when(m_PersistentData.getEntity()).thenReturn(m_FactData.toByteArray());
        when(m_PersistentData.getUUID()).thenReturn(m_UUID);
        
        when(m_PersistentDataStore.find(m_UUID)).thenReturn(m_PersistentData);

        when(m_JaxbConverter.convertToJaxb(m_ProtoOrien)).thenReturn(m_Orientation);
        when(m_JaxbConverter.convertToJaxb(m_ProtoOrien2)).thenReturn(m_Orientation2);
        
        Map<String, Orientation> newOrien = m_SUT.getOrientation(m_UUID);
        
        //verify orientation is returned
        assertThat(newOrien, is(m_OrienMap));
    }
/**
     * Verify getting of orientation for an asset when using a sensor ID.
     */
Verify getting of orientation for an asset when using a sensor ID.
Verify getting of orientation for an asset when using a sensor ID .
@Test
    public void testGetOrientationBySensorId() throws FactoryObjectInformationException, ObjectConverterException,
        IllegalArgumentException, PersistenceFailedException, InvalidProtocolBufferException
    {
        m_SUT.activate();
        m_ProtoOrienList.add(OrientationEntry.newBuilder()
                .setKey("example-sensor-id")
                .setValue(m_ProtoOrien2)
                .build());
        m_OrienMap.put("example-sensor-id", m_Orientation2);
        m_FactData = FactoryObjectData.newBuilder().
                setName("original").
                setExtension(AssetObjectData.orientation, m_ProtoOrienList).build();
        when(m_PersistentData.getEntity()).thenReturn(m_FactData.toByteArray());
        when(m_PersistentData.getUUID()).thenReturn(m_UUID);
        when(m_PersistentDataStore.find(m_UUID)).thenReturn(m_PersistentData);
        when(m_JaxbConverter.convertToJaxb(m_ProtoOrien)).thenReturn(m_Orientation);
        when(m_JaxbConverter.convertToJaxb(m_ProtoOrien2)).thenReturn(m_Orientation2);
        Map<String, Orientation> newOrien = m_SUT.getOrientation(m_UUID);
        assertThat(newOrien, is(m_OrienMap));
    }
@ Test public void testGetOrientationBySensorId ( ) throws FactoryObjectInformationException , ObjectConverterException , IllegalArgumentException , PersistenceFailedException , InvalidProtocolBufferException { m_SUT . activate ( ) ; m_ProtoOrienList . add ( OrientationEntry . newBuilder ( ) . setKey ( "example-sensor-id" ) . setValue ( m_ProtoOrien2 ) . build ( ) ) ; m_OrienMap . put ( "example-sensor-id" , m_Orientation2 ) ; m_FactData = FactoryObjectData . newBuilder ( ) . setName ( "original" ) . setExtension ( AssetObjectData . orientation , m_ProtoOrienList ) . build ( ) ; when ( m_PersistentData . getEntity ( ) ) . thenReturn ( m_FactData . toByteArray ( ) ) ; when ( m_PersistentData . getUUID ( ) ) . thenReturn ( m_UUID ) ; when ( m_PersistentDataStore . find ( m_UUID ) ) . thenReturn ( m_PersistentData ) ; when ( m_JaxbConverter . convertToJaxb ( m_ProtoOrien ) ) . thenReturn ( m_Orientation ) ; when ( m_JaxbConverter . convertToJaxb ( m_ProtoOrien2 ) ) . thenReturn ( m_Orientation2 ) ; Map < String , Orientation > newOrien = m_SUT . getOrientation ( m_UUID ) ; assertThat ( newOrien , is ( m_OrienMap ) ) ; }
Verify getting of orientation for an asset when using a sensor ID.
Verify getting of orientation for an asset when using a sensor ID .
//activate to create converters  //persisted message with additional entry //verify orientation is returned