### Question:
CommitOutputStream extends OutputStream { public void write(int data) { if (m_size >= m_buffer.length) m_buffer = Arrays.copyOf(m_buffer, 2 * m_buffer.length); m_buffer[m_size++] = (byte) data; } CommitOutputStream(OutputStream sink); void write(int data); void write(byte buffer[], int offset, int length); int getSize(); void commit(); void rollback(); void flush(); void close();  }### Answer:
@Test(expected = NullPointerException.class) public void writeNullBuffer() throws IOException { m_fixture.write(null, 0, 1); }
@Test(expected = IndexOutOfBoundsException.class) public void writeIndexNegOne() throws IOException { m_fixture.write(new byte[0], -1, 0); }
@Test(expected = IndexOutOfBoundsException.class) public void writeLengthNegOne() throws IOException { m_fixture.write(new byte[0], 0, -1); }
@Test(expected = IndexOutOfBoundsException.class) public void writeBeyondEnd() throws IOException { m_fixture.write(new byte[16], 8, 9); }