edu.udayton.udri.asset.novatel/test/edu/udayton/udri/asset/novatel/TestNovatelAsset.java
@Test
    public void testHandleInsPvaMessage() throws AssetException, IOException, 
        NovatelMessageException, IllegalArgumentException, IllegalStateException, FactoryException, 
        ValidationFailedException
    {
        final Map<String, Object> configProps = createConfigProps();
        configProps.put(NovatelAssetAttributes.CONFIG_PROP_HANDLE_MESSAGE_FREQUENCY, 1);
        m_SUT.updated(configProps);

        m_SUT.onActivate();
        
        //mock message
        when(m_Parser.parseInsMessage(m_InsData)).thenReturn(m_Message);
        
        //now handle the ins message
        m_SUT.handleDataString(m_InsData);
        
        ArgumentCaptor<Long> captor = ArgumentCaptor.forClass(Long.class);
        verify(m_TimeChangeService).changeTime(captor.capture());
        
        assertThat(captor.getValue(), is(1L));
        
        ArgumentCaptor<Observation> obsCap = ArgumentCaptor.forClass(Observation.class);
        verify(m_AssetContext).persistObservation(obsCap.capture());
        
        Observation obs = obsCap.getValue();
        assertThat(obs.getAssetLocation().getLongitude().getValue(), is(-80.624022245d));
        assertThat(obs.getAssetLocation().getLatitude().getValue(), is(28.111270808d));
        assertThat(obs.getAssetOrientation().getElevation().getValue(), is(0.238876476d));
        assertThat(obs.getAssetOrientation().getHeading().getValue(), is(148.083596481d));
        assertThat(obs.getObservedTimestamp(), is(1L));
    }
/**
     * Verify that the asset can handle an INSPVA message from the message reader. 
     */
Verify that the asset can handle an INSPVA message from the message reader.
Verify that the asset can handle an INSPVA message from the message reader .
@Test
    public void testHandleInsPvaMessage() throws AssetException, IOException, 
        NovatelMessageException, IllegalArgumentException, IllegalStateException, FactoryException, 
        ValidationFailedException
    {
        final Map<String, Object> configProps = createConfigProps();
        configProps.put(NovatelAssetAttributes.CONFIG_PROP_HANDLE_MESSAGE_FREQUENCY, 1);
        m_SUT.updated(configProps);
        m_SUT.onActivate();
        when(m_Parser.parseInsMessage(m_InsData)).thenReturn(m_Message);
        m_SUT.handleDataString(m_InsData);
        ArgumentCaptor<Long> captor = ArgumentCaptor.forClass(Long.class);
        verify(m_TimeChangeService).changeTime(captor.capture());
        assertThat(captor.getValue(), is(1L));
        ArgumentCaptor<Observation> obsCap = ArgumentCaptor.forClass(Observation.class);
        verify(m_AssetContext).persistObservation(obsCap.capture());
        Observation obs = obsCap.getValue();
        assertThat(obs.getAssetLocation().getLongitude().getValue(), is(-80.624022245d));
        assertThat(obs.getAssetLocation().getLatitude().getValue(), is(28.111270808d));
        assertThat(obs.getAssetOrientation().getElevation().getValue(), is(0.238876476d));
        assertThat(obs.getAssetOrientation().getHeading().getValue(), is(148.083596481d));
        assertThat(obs.getObservedTimestamp(), is(1L));
    }
@ Test public void testHandleInsPvaMessage ( ) throws AssetException , IOException , NovatelMessageException , IllegalArgumentException , IllegalStateException , FactoryException , ValidationFailedException { final Map < String , Object > configProps = createConfigProps ( ) ; configProps . put ( NovatelAssetAttributes . CONFIG_PROP_HANDLE_MESSAGE_FREQUENCY , 1 ) ; m_SUT . updated ( configProps ) ; m_SUT . onActivate ( ) ; when ( m_Parser . parseInsMessage ( m_InsData ) ) . thenReturn ( m_Message ) ; m_SUT . handleDataString ( m_InsData ) ; ArgumentCaptor < Long > captor = ArgumentCaptor . forClass ( Long . class ) ; verify ( m_TimeChangeService ) . changeTime ( captor . capture ( ) ) ; assertThat ( captor . getValue ( ) , is ( 1L ) ) ; ArgumentCaptor < Observation > obsCap = ArgumentCaptor . forClass ( Observation . class ) ; verify ( m_AssetContext ) . persistObservation ( obsCap . capture ( ) ) ; Observation obs = obsCap . getValue ( ) ; assertThat ( obs . getAssetLocation ( ) . getLongitude ( ) . getValue ( ) , is ( - 80.624022245d ) ) ; assertThat ( obs . getAssetLocation ( ) . getLatitude ( ) . getValue ( ) , is ( 28.111270808d ) ) ; assertThat ( obs . getAssetOrientation ( ) . getElevation ( ) . getValue ( ) , is ( 0.238876476d ) ) ; assertThat ( obs . getAssetOrientation ( ) . getHeading ( ) . getValue ( ) , is ( 148.083596481d ) ) ; assertThat ( obs . getObservedTimestamp ( ) , is ( 1L ) ) ; }
Verify that the asset can handle an INSPVA message from the message reader.
Verify that the asset can handle an INSPVA message from the message reader .
//mock message //now handle the ins message