mil.dod.th.ose.linux.serial/test/mil/dod/th/ose/linux/physical/TestSerialPortOutputStream.java
@Test
    public void testWriteBufferFailure() throws IOException, FactoryException
    {
        when(FileOperations.writeBuffer(anyInt(), Mockito.any(byte[].class), anyInt(), anyInt())).thenReturn(-1);

        byte[] buffer = new byte[10];
        try
        {
            m_SUT.write(buffer, 0, 10);
            fail("Expecting exception");
        }
        catch (IOException e)
        {
            
        }
    }
/**
     * Verify write throws exception if failure.
     */
Verify write throws exception if failure.
Verify write throws exception if failure .
@Test
    public void testWriteBufferFailure() throws IOException, FactoryException
    {
        when(FileOperations.writeBuffer(anyInt(), Mockito.any(byte[].class), anyInt(), anyInt())).thenReturn(-1);
        byte[] buffer = new byte[10];
        try
        {
            m_SUT.write(buffer, 0, 10);
            fail("Expecting exception");
        }
        catch (IOException e)
        {
        }
    }
@ Test public void testWriteBufferFailure ( ) throws IOException , FactoryException { when ( FileOperations . writeBuffer ( anyInt ( ) , Mockito . any ( byte [ ] . class ) , anyInt ( ) , anyInt ( ) ) ) . thenReturn ( - 1 ) ; byte [ ] buffer = new byte [ 10 ] ; try { m_SUT . write ( buffer , 0 , 10 ) ; fail ( "Expecting exception" ) ; } catch ( IOException e ) { } }
Verify write throws exception if failure.
Verify write throws exception if failure .