mil.dod.th.ose.linux.serial/test/mil/dod/th/ose/linux/physical/TestSerialPortInputStream.java
@Test
    public void testReadStateException() throws IOException
    {
        // mock to return 0 bytes read, should never happen
        when(FileOperations.readBuffer(anyInt(), Mockito.any(byte[].class), anyInt(), anyLong(), anyInt()))
            .thenReturn(0);
        
        try
        {
            m_SUT.read();
            fail("Expecting exception");
        }
        catch (IllegalStateException e)
        {
            
        }
    }
/**
     * Verify {@link IllegalStateException} is thrown if no data read (should either return error/negative or positive 
     * number).
     */
Verify  IllegalStateException is thrown if no data read (should either return error/negative or positive
number).
Verify IllegalStateException is thrown if no data read ( should either return error / negative or positive number ) .
@Test
    public void testReadStateException() throws IOException
    {
        when(FileOperations.readBuffer(anyInt(), Mockito.any(byte[].class), anyInt(), anyLong(), anyInt()))
            .thenReturn(0);
        try
        {
            m_SUT.read();
            fail("Expecting exception");
        }
        catch (IllegalStateException e)
        {
        }
    }
@ Test public void testReadStateException ( ) throws IOException { when ( FileOperations . readBuffer ( anyInt ( ) , Mockito . any ( byte [ ] . class ) , anyInt ( ) , anyLong ( ) , anyInt ( ) ) ) . thenReturn ( 0 ) ; try { m_SUT . read ( ) ; fail ( "Expecting exception" ) ; } catch ( IllegalStateException e ) { } }
Verify {@link IllegalStateException} is thrown if no data read (should either return error/negative or positive
 number).
Verify { @link IllegalStateException } is thrown if no data read ( should either return error / negative or positive number ) .
// mock to return 0 bytes read, should never happen