writer.write(i);
}
writer.close();
CharBuffer firstBuffer = writer.getFirstBuffer();
assertNotNull(firstBuffer);
CharBuffer nextBuffer = firstBuffer.getNext();
assertNotNull(nextBuffer);
assertNull(nextBuffer.getNext());
assertTrue(firstBuffer.getUsedSize() == firstBuffer.getCacheSize());
assertTrue(nextBuffer.getUsedSize() < nextBuffer.getCacheSize());
firstBuffer.compact();
assertTrue(firstBuffer.getUsedSize() == firstBuffer.getCacheSize());
assertTrue(nextBuffer.getUsedSize() == nextBuffer.getCacheSize());
FastBufferReader reader = new FastBufferReader(firstBuffer);
for (int i = 0; i < itemsTowWrite; i++) {
assertEquals(i, reader.read());