@Test public void testWrite() { try { stream.write(1); fail("Expected exception not thrown."); } catch (final IOException e) { assertEquals(exception, e); } try { stream.write(new byte[1]); fail("Expected exception not thrown."); } catch (final IOException e) { assertEquals(exception, e); } try { stream.write(new byte[1], 0, 1); fail("Expected exception not thrown."); } catch (final IOException e) { assertEquals(exception, e); } }
@Override public void write(final int b) throws IOException { throw exception; }
BrokenOutputStream extends OutputStream { @Override public void write(final int b) throws IOException { throw exception; } }
BrokenOutputStream extends OutputStream { @Override public void write(final int b) throws IOException { throw exception; } BrokenOutputStream(final IOException exception);  BrokenOutputStream(); }
BrokenOutputStream extends OutputStream { @Override public void write(final int b) throws IOException { throw exception; } BrokenOutputStream(final IOException exception);  BrokenOutputStream(); @Override void write(final int b); @Override void flush(); @Override void close(); }
BrokenOutputStream extends OutputStream { @Override public void write(final int b) throws IOException { throw exception; } BrokenOutputStream(final IOException exception);  BrokenOutputStream(); @Override void write(final int b); @Override void flush(); @Override void close();  }