### Question:
SplitInputStream { private int read(int index) throws IOException { long position; int offset, result; m_dataLock.lock(); try { position = m_stream[index].getPosition(); if (position == m_write) { if (!fill(index)) return(-1); position = m_stream[index].getPosition(); } offset = getBufferOffset(position); result = m_buffer[offset] & 0x0FF; m_stream[index].setPosition(position + 1); } finally { m_dataLock.unlock(); } return(result); } SplitInputStream(InputStream source, int streamCount);  SplitInputStream(InputStream source, int streamCount, int initialSize); int getStreamCount(); InputStream getStream(int index);  }### Answer:
@Test public void readByte() throws IOException { assertEquals(m_expect[0] & 0x0FF, m_input.read()); }
@Test(expected = NullPointerException.class) public void readNullBuffer() throws IOException { m_input.read(null, 0, 1); }
@Test(expected = IndexOutOfBoundsException.class) public void readIndexNegOne() throws IOException { m_input.read(new byte[0], -1, 0); }
@Test(expected = IndexOutOfBoundsException.class) public void readLengthNegOne() throws IOException { m_input.read(new byte[0], 0, -1); }
@Test(expected = IndexOutOfBoundsException.class) public void readBeyondEnd() throws IOException { m_input.read(new byte[16], 8, 9); }
@Test public void readLengthZero() throws IOException { m_input.read(new byte[1], 0, 0); assertEquals(m_expect[0] & 0x0FF, m_input.read()); }
@Test public void readArray() throws IOException { int offset, length, delta; byte buffer[]; length = m_expect.length; buffer = new byte[length]; for (offset = 0; offset < length; offset += delta) { delta = m_input.read(buffer); assertTrue(delta >= 0); } assertArrayEquals(m_expect, buffer); }
@Test public void bufferSize1() throws IOException { int i; initialize(10, 1); for (i = 0; i < m_expect.length; i++) { assertEquals(m_expect[i] & 0x0FF, m_input.read()); } }