edu.udayton.udri.asset.novatel/test/edu/udayton/udri/asset/novatel/TestNovatelAsset.java
@Test
    public void testHandleTimeMessageBad() throws AssetException, IOException, NovatelMessageException, 
        ValidationFailedException
    {
        //mock message
        doThrow(new NovatelMessageException("blarg", FormatProblem.TIME_RELIABILITY)).
            when(m_Parser).evaluateTimeMessage(anyString());
        
        m_SUT.handleDataString(NovatelConstants.NOVATEL_TIME_MESSAGE + "alsdkjfksljdf");
        
        //verify bad status
        ArgumentCaptor<ComponentStatus> statusCap = ArgumentCaptor.forClass(ComponentStatus.class);
        
        //verify one event for bad status
        verify(m_NovatelStatusService, times(3)).getStatus(Mockito.any(Observation.class), statusCap.capture());
        
        //get the message readers component status
        ComponentStatus capStatus = statusCap.getValue();
        assertThat(capStatus.getStatus().getSummary(), is(SummaryStatusEnum.DEGRADED));
        verify(m_TimeChangeService, never()).changeTime(Mockito.anyLong());
    }
/**
     * Verify that the asset can handle a Time that contains bad data.
     * Verify bad status update. 
     */
Verify that the asset can handle a Time that contains bad data.
Verify bad status update.
Verify that the asset can handle a Time that contains bad data . Verify bad status update .
@Test
    public void testHandleTimeMessageBad() throws AssetException, IOException, NovatelMessageException, 
        ValidationFailedException
    {
        doThrow(new NovatelMessageException("blarg", FormatProblem.TIME_RELIABILITY)).
            when(m_Parser).evaluateTimeMessage(anyString());
        m_SUT.handleDataString(NovatelConstants.NOVATEL_TIME_MESSAGE + "alsdkjfksljdf");
        ArgumentCaptor<ComponentStatus> statusCap = ArgumentCaptor.forClass(ComponentStatus.class);
        verify(m_NovatelStatusService, times(3)).getStatus(Mockito.any(Observation.class), statusCap.capture());
        ComponentStatus capStatus = statusCap.getValue();
        assertThat(capStatus.getStatus().getSummary(), is(SummaryStatusEnum.DEGRADED));
        verify(m_TimeChangeService, never()).changeTime(Mockito.anyLong());
    }
@ Test public void testHandleTimeMessageBad ( ) throws AssetException , IOException , NovatelMessageException , ValidationFailedException { doThrow ( new NovatelMessageException ( "blarg" , FormatProblem . TIME_RELIABILITY ) ) . when ( m_Parser ) . evaluateTimeMessage ( anyString ( ) ) ; m_SUT . handleDataString ( NovatelConstants . NOVATEL_TIME_MESSAGE + "alsdkjfksljdf" ) ; ArgumentCaptor < ComponentStatus > statusCap = ArgumentCaptor . forClass ( ComponentStatus . class ) ; verify ( m_NovatelStatusService , times ( 3 ) ) . getStatus ( Mockito . any ( Observation . class ) , statusCap . capture ( ) ) ; ComponentStatus capStatus = statusCap . getValue ( ) ; assertThat ( capStatus . getStatus ( ) . getSummary ( ) , is ( SummaryStatusEnum . DEGRADED ) ) ; verify ( m_TimeChangeService , never ( ) ) . changeTime ( Mockito . anyLong ( ) ) ; }
Verify that the asset can handle a Time that contains bad data.
Verify that the asset can handle a Time that contains bad data .
//mock message //verify bad status //verify one event for bad status //get the message readers component status