mil.dod.th.ose.linux.serial/test/mil/dod/th/ose/linux/physical/TestSerialPortInputStream.java
@Test
    public void testReadTimeoutValue() throws IOException, FactoryException
    {
        // mock to return value other than 1
        when(FileOperations.readBuffer(anyInt(), Mockito.any(byte[].class), anyInt(), anyLong(), anyInt()))
            .thenReturn(1);
        
        m_SUT.setReadTimeout(123);
        
        m_SUT.read();
        
        PowerMockito.verifyStatic();
        FileOperations.readBuffer(eq(5), Mockito.any(byte[].class), eq(0), eq(1L), eq(123));
        
        // check other read method that accepts a buffer
        byte[] buf = new byte[10];
        m_SUT.read(buf, 0, 10);
        
        PowerMockito.verifyStatic();
        FileOperations.readBuffer(eq(5), Mockito.any(byte[].class), eq(0), eq(10L), eq(123));
    }
/**
     * Verify read timeout is passed on to {@link FileOperations}.
     */
Verify read timeout is passed on to  FileOperations.
Verify read timeout is passed on to FileOperations .
@Test
    public void testReadTimeoutValue() throws IOException, FactoryException
    {
        when(FileOperations.readBuffer(anyInt(), Mockito.any(byte[].class), anyInt(), anyLong(), anyInt()))
            .thenReturn(1);
        m_SUT.setReadTimeout(123);
        m_SUT.read();
        PowerMockito.verifyStatic();
        FileOperations.readBuffer(eq(5), Mockito.any(byte[].class), eq(0), eq(1L), eq(123));
        byte[] buf = new byte[10];
        m_SUT.read(buf, 0, 10);
        PowerMockito.verifyStatic();
        FileOperations.readBuffer(eq(5), Mockito.any(byte[].class), eq(0), eq(10L), eq(123));
    }
@ Test public void testReadTimeoutValue ( ) throws IOException , FactoryException { when ( FileOperations . readBuffer ( anyInt ( ) , Mockito . any ( byte [ ] . class ) , anyInt ( ) , anyLong ( ) , anyInt ( ) ) ) . thenReturn ( 1 ) ; m_SUT . setReadTimeout ( 123 ) ; m_SUT . read ( ) ; PowerMockito . verifyStatic ( ) ; FileOperations . readBuffer ( eq ( 5 ) , Mockito . any ( byte [ ] . class ) , eq ( 0 ) , eq ( 1L ) , eq ( 123 ) ) ; byte [ ] buf = new byte [ 10 ] ; m_SUT . read ( buf , 0 , 10 ) ; PowerMockito . verifyStatic ( ) ; FileOperations . readBuffer ( eq ( 5 ) , Mockito . any ( byte [ ] . class ) , eq ( 0 ) , eq ( 10L ) , eq ( 123 ) ) ; }
Verify read timeout is passed on to {@link FileOperations}.
Verify read timeout is passed on to { @link FileOperations } .
// mock to return value other than 1 // check other read method that accepts a buffer