@Test public void shouldNeedLengthLessThanOrEqualToAvailableBuffer() throws Exception { thrown.expect(IndexOutOfBoundsException.class); inputStream.read(new byte[] {0x00}, 0, 2); }
@Override public void close() throws IOException { super.close(); zipStream.close(); }
@Test public void shouldNeedLengthMoreThanZero() throws Exception { thrown.expect(IndexOutOfBoundsException.class); inputStream.read(new byte[] {0x00}, 0, -1); }
@Test public void shouldNeedByteArray() throws Exception { thrown.expect(NullPointerException.class); inputStream.read(null, 0, 0); }
@Test public void shouldNotReadSingleByteWhenNotAvailable() throws Exception { assertThat(inputStream.read(), is(-1)); }
@Test public void shouldReadSingleByteWhenAvailable() throws Exception { mockWrite(new byte[] {-1}); assertThat(inputStream.read(), is(0x00FF)); assertThat(inputStream.read(), is(-1)); }
@Test public void shouldSupportZeroByteRead() throws Exception { byte[] b = new byte[1]; int l = inputStream.read(b, 0, 0); assertThat(l, is(0)); }