### Question:
UnsafeByteArrayInputStream extends InputStream { @Override public int read() { return (mPosition < mLimit) ? (mData[mPosition++] & 0xff) : -1; } UnsafeByteArrayInputStream(byte buf[]);  UnsafeByteArrayInputStream(byte buf[], int offset);  UnsafeByteArrayInputStream(byte buf[], int offset, int length); @Override int read(); @Override int read(byte b[], int off, int len); @Override long skip(long len); @Override int available(); @Override boolean markSupported(); @Override void mark(int readAheadLimit); @Override void reset(); @Override void close(); int position(); void position(int newPosition); int size();  }### Answer:
@Test public void testWrongLength() { Assertions.assertThrows(IndexOutOfBoundsException.class, () -> { UnsafeByteArrayInputStream stream = new UnsafeByteArrayInputStream("abc".getBytes()); stream.read(new byte[1], 0, 100); }); }
@Test public void testWrongOffset() { Assertions.assertThrows(IndexOutOfBoundsException.class, () -> { UnsafeByteArrayInputStream stream = new UnsafeByteArrayInputStream("abc".getBytes()); stream.read(new byte[1], -1, 1); }); }
@Test public void testReadEmptyByteArray() { Assertions.assertThrows(NullPointerException.class, () -> { UnsafeByteArrayInputStream stream = new UnsafeByteArrayInputStream("abc".getBytes()); stream.read(null, 0, 1); }); }