### Question:
ChunkInputStream extends InputStream implements Seekable { @Override public synchronized int read() throws IOException { checkOpen(); int available = prepareRead(1); int dataout = EOF; if (available == EOF) { Preconditions.checkState(buffers == null); } else { dataout = Byte.toUnsignedInt(buffers.get(bufferIndex).get()); } if (chunkStreamEOF()) { releaseBuffers(); } return dataout; } ChunkInputStream(ChunkInfo chunkInfo, BlockID blockId,
          XceiverClientSpi xceiverClient, boolean verifyChecksum); synchronized long getRemaining(); @Override synchronized int read(); @Override synchronized int read(byte[] b, int off, int len); @Override synchronized void seek(long pos); @Override synchronized long getPos(); @Override boolean seekToNewSource(long targetPos); @Override synchronized void close();  }### Answer:
@Test public void testFullChunkRead() throws Exception { byte[] b = new byte[CHUNK_SIZE]; chunkStream.read(b, 0, CHUNK_SIZE); matchWithInputData(b, 0, CHUNK_SIZE); }
@Test public void testPartialChunkRead() throws Exception { int len = CHUNK_SIZE / 2; byte[] b = new byte[len]; chunkStream.read(b, 0, len); matchWithInputData(b, 0, len); matchWithInputData(chunkStream.getReadByteBuffers().get(0).toByteArray(), 0, 60); }
@Test public void testSeekAndRead() throws Exception { seekAndVerify(50); byte[] b1 = new byte[20]; chunkStream.read(b1, 0, 20); matchWithInputData(b1, 50, 20); byte[] b2 = new byte[20]; chunkStream.read(b2, 0, 20); matchWithInputData(b2, 70, 20); }