public class FastBufferWriterTest extends TestCase {
/**
* Test method for {@link org.ajax4jsf.io.FastBufferWriter#reset()}.
*/
public void testResetOneBuffer() throws Exception {
FastBufferWriter stream = new FastBufferWriter(256);
for (int i = 0; i < 255; i++) {
stream.write(i);
}
assertEquals(255, stream.getLength());
CharBuffer firstBuffer = stream.getFirstBuffer();
assertNull(firstBuffer.getNext());
assertNull(firstBuffer.getPrevious());
stream.reset();
assertEquals(0, stream.getLength());
firstBuffer = stream.getFirstBuffer();
assertEquals(0, firstBuffer.getUsedSize());
assertNull(firstBuffer.getNext());
assertNull(firstBuffer.getPrevious());
}