edu.udayton.udri.asset.novatel/test/edu/udayton/udri/asset/novatel/impl/message/TestMessageReaderImpl.java
@Test
    public void testStopReadIllegalState() throws InterruptedException, AssetException, IOException
    {
        when(m_ConnectionManager.readMessage()).thenReturn(m_InsData);
        
        m_SUT.startRetreiving(m_Receiver);
        //allow the thread to start
        Thread.sleep(10);
        //stop reading
        m_SUT.stopRetrieving();
        
        //try stopping again
        try
        {
            m_SUT.stopRetrieving();
            fail("Can't call stop if thread is already stopped.");
        }
        catch (IllegalStateException e)
        {
            //expected exception
        }
    }
/**
     * Test stop read with illegal state because the thread was never started.
     */
Test stop read with illegal state because the thread was never started.
Test stop read with illegal state because the thread was never started .
@Test
    public void testStopReadIllegalState() throws InterruptedException, AssetException, IOException
    {
        when(m_ConnectionManager.readMessage()).thenReturn(m_InsData);
        m_SUT.startRetreiving(m_Receiver);
        Thread.sleep(10);
        m_SUT.stopRetrieving();
        try
        {
            m_SUT.stopRetrieving();
            fail("Can't call stop if thread is already stopped.");
        }
        catch (IllegalStateException e)
        {
        }
    }
@ Test public void testStopReadIllegalState ( ) throws InterruptedException , AssetException , IOException { when ( m_ConnectionManager . readMessage ( ) ) . thenReturn ( m_InsData ) ; m_SUT . startRetreiving ( m_Receiver ) ; Thread . sleep ( 10 ) ; m_SUT . stopRetrieving ( ) ; try { m_SUT . stopRetrieving ( ) ; fail ( "Can't call stop if thread is already stopped." ) ; } catch ( IllegalStateException e ) { } }
Test stop read with illegal state because the thread was never started.
Test stop read with illegal state because the thread was never started .
//allow the thread to start //stop reading //try stopping again //expected exception