CircularBuffer { public void reset(){ startValidDataIndex = 0; nextAvailablePosition = 0; availableReadLength = 0; } CircularBuffer(final int size); void write(final byte data); void readAll(final OutputStream outputStream); void readChunk(final OutputStream outputStream, final int chunkSize); boolean isFull(); boolean isEmpty(); int getAvailableDataLength(); int getBufferSize(); void reset();  }
@Test public void testReset() throws Exception { final CircularBuffer buffer = new CircularBuffer(10); assertTrue(buffer.isEmpty()); writeDataToCircularBuffer(buffer, new byte[]{0x01, 0x02, 0x03}); Assert.assertFalse(buffer.isEmpty()); buffer.reset(); assertTrue(buffer.isEmpty()); }