public class FastBufferOutputStreamTest extends TestCase {
/**
* Test method for {@link org.ajax4jsf.io.FastBufferOutputStream#reset()}.
*/
public void testResetOneBuffer() throws Exception {
FastBufferOutputStream stream = new FastBufferOutputStream(256);
for (int i = 0; i < 255; i++) {
stream.write(i);
}
assertEquals(255, stream.getLength());
ByteBuffer 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());
}