@Test
public void testSkipOverFreeSpace()
{

  ByteBuffer[] buffers = allocateByteBuffers(128, 128, 50);
  BufferPositionParser parser = createParser(128, 128, 50);
  BufferPosition pos = new BufferPosition(parser, buffers);
  adjustLimits(buffers, 50, 100, 0);
  pos.setPosition(parser.encode(0, 0, 0));
  pos.skipOverFreeSpace();
  //should not change
  assertPosition(pos, 0, 0, 0);
  adjustLimits(buffers, 0, 0, 0);
  pos.setPosition(parser.encode(0, 0, 0));
  pos.skipOverFreeSpace();
  //should wrap around
  assertPosition(pos, 1, 0, 0);
  adjustLimits(buffers, 10, 0, 0);
  pos.setPosition(parser.encode(0, 0, 50));
  pos.skipOverFreeSpace();
  //should wrap around
  assertPosition(pos, 1, 0, 0);
  adjustLimits(buffers, 50, 100, 0);
  pos.setPosition(parser.encode(10, 0, 10));
  //should not change
  pos.skipOverFreeSpace();
  assertPosition(pos, 10, 0, 10);
  pos.setPosition(parser.encode(12, 0, 50));
  //should go to index 1
  pos.skipOverFreeSpace();
  assertPosition(pos, 12, 1, 0);
  pos.setPosition(parser.encode(255, 1, 100));
  //should go to index 0
  pos.skipOverFreeSpace();
  assertPosition(pos, 256, 0, 0);
}