// Note this code will more effective if the values are laid out as follows:
//
// A, A, A, B, B, B, B, B, C, C, D
//
BlockCursor cursor = createTestCursor();
// advance to first position
assertAdvanceToPosition(cursor, 0);
assertCurrentValue(cursor, 0, getExpectedValue(0));
// skip to position in first value
assertAdvanceToPosition(cursor, 2);
assertCurrentValue(cursor, 2, getExpectedValue(2));
// advance to same position
assertAdvanceToPosition(cursor, 2);
assertCurrentValue(cursor, 2, getExpectedValue(2));
// skip to position in next value
assertAdvanceToPosition(cursor, 4);
assertCurrentValue(cursor, 4, getExpectedValue(4));
// skip to position in third value
assertAdvanceToPosition(cursor, 8);
assertCurrentValue(cursor, 8, getExpectedValue(8));
// skip to last position
assertAdvanceToPosition(cursor, 10);
assertCurrentValue(cursor, 10, getExpectedValue(10));
// skip backwards
try {
cursor.advanceToPosition(2);
fail("Expected IllegalArgumentException");
}
catch (IllegalArgumentException e) {
assertCurrentValue(cursor, 10, getExpectedValue(10));
}
// skip past end
assertFalse(cursor.advanceToPosition(100));
assertTrue(cursor.isFinished());
assertFalse(cursor.isValid());
}