### Question:
ByteArrayProvider implements ByteProvider { @Override public byte[] readBytes(long index, long length) throws IOException { assertValidIndex(index, true); if (index + length > srcBytes.length) { throw new IOException("Attempt to read beyond end of byte data"); } byte[] destBytes = new byte[(int) length]; System.arraycopy(srcBytes, (int) index, destBytes, 0, (int) length); return destBytes; } ByteArrayProvider(byte[] bytes);  ByteArrayProvider(String name, byte[] bytes); @Override void close(); @Override File getFile(); @Override String getName(); @Override String getAbsolutePath(); @Override InputStream getInputStream(long index); @Override long length(); @Override boolean isValidIndex(long index); @Override byte readByte(long index); @Override byte[] readBytes(long index, long length);  }### Answer:
@Test public void testReadBytes_EOFBoundary() throws IOException { ByteArrayProvider bap = bap(1, 2, 3, 4, 5, 6); bap.readBytes(0, 6); bap.readBytes(5, 1); bap.readBytes(6, 0); try { bap.readBytes(6, 1); fail("Should have triggered IOException"); } catch (IOException ioe) { } }