edu.udayton.udri.asset.novatel/test/edu/udayton/udri/asset/novatel/impl/message/TestMessageReaderImpl.java
@Test
    public void testExceptionWithReconnect() throws InterruptedException, AssetException, IOException
    {
        when(m_ConnectionManager.readMessage()).thenThrow(new AssetException("blarg"));
        
        m_SUT.startRetreiving(m_Receiver);
        
        ArgumentCaptor<SummaryStatusEnum> statusCaptor = ArgumentCaptor.forClass(SummaryStatusEnum.class);
        ArgumentCaptor<String> desc = ArgumentCaptor.forClass(String.class);
        verify(m_Receiver, timeout(1300).atLeast(2)).handleReadError(statusCaptor.capture(), desc.capture());
        List<SummaryStatusEnum> list = statusCaptor.getAllValues();
        List<String> listDesc = desc.getAllValues();
        
        //verify status changes
        assertThat(list.size(), greaterThan(1));
        
        //verify reconnect attempt
        verify(m_ConnectionManager, atLeastOnce()).reconnect();
        
        //verify receiver error string
        assertThat(list, hasItem(SummaryStatusEnum.BAD));
        assertThat(listDesc, hasItem("blarg"));
    }
/**
     * Test reconnect call. Verify error status. Reconnect call. Reinstatement status.
     */
Test reconnect call. Verify error status. Reconnect call. Reinstatement status.
Test reconnect call . Verify error status . Reconnect call . Reinstatement status .
@Test
    public void testExceptionWithReconnect() throws InterruptedException, AssetException, IOException
    {
        when(m_ConnectionManager.readMessage()).thenThrow(new AssetException("blarg"));
        m_SUT.startRetreiving(m_Receiver);
        ArgumentCaptor<SummaryStatusEnum> statusCaptor = ArgumentCaptor.forClass(SummaryStatusEnum.class);
        ArgumentCaptor<String> desc = ArgumentCaptor.forClass(String.class);
        verify(m_Receiver, timeout(1300).atLeast(2)).handleReadError(statusCaptor.capture(), desc.capture());
        List<SummaryStatusEnum> list = statusCaptor.getAllValues();
        List<String> listDesc = desc.getAllValues();
        assertThat(list.size(), greaterThan(1));
        verify(m_ConnectionManager, atLeastOnce()).reconnect();
        assertThat(list, hasItem(SummaryStatusEnum.BAD));
        assertThat(listDesc, hasItem("blarg"));
    }
@ Test public void testExceptionWithReconnect ( ) throws InterruptedException , AssetException , IOException { when ( m_ConnectionManager . readMessage ( ) ) . thenThrow ( new AssetException ( "blarg" ) ) ; m_SUT . startRetreiving ( m_Receiver ) ; ArgumentCaptor < SummaryStatusEnum > statusCaptor = ArgumentCaptor . forClass ( SummaryStatusEnum . class ) ; ArgumentCaptor < String > desc = ArgumentCaptor . forClass ( String . class ) ; verify ( m_Receiver , timeout ( 1300 ) . atLeast ( 2 ) ) . handleReadError ( statusCaptor . capture ( ) , desc . capture ( ) ) ; List < SummaryStatusEnum > list = statusCaptor . getAllValues ( ) ; List < String > listDesc = desc . getAllValues ( ) ; assertThat ( list . size ( ) , greaterThan ( 1 ) ) ; verify ( m_ConnectionManager , atLeastOnce ( ) ) . reconnect ( ) ; assertThat ( list , hasItem ( SummaryStatusEnum . BAD ) ) ; assertThat ( listDesc , hasItem ( "blarg" ) ) ; }
Test reconnect call.
Test reconnect call .
//verify status changes //verify reconnect attempt //verify receiver error string