@Test
public void loopIterationWithLimit() throws ExecutionException, InterruptedException {

    FDBStoreTimer timer = new FDBStoreTimer();
    FirableCursor<Integer> secondCursor = new FirableCursor<>(RecordCursor.fromList(Arrays.asList(2, 1)));
    RecordCursor<Integer> cursor = ProbableIntersectionCursor.create(Collections::singletonList, Arrays.asList(
            continuation -> RecordCursor.fromList(Arrays.asList(1, 2), continuation).limitRowsTo(1),
            continuation -> secondCursor
    ), null, timer);
    CompletableFuture<RecordCursorResult<Integer>> cursorResultFuture = cursor.onNext();
    secondCursor.fire();
    assertFalse(cursorResultFuture.isDone());
    secondCursor.fire();
    RecordCursorResult<Integer> cursorResult = cursorResultFuture.get();
    assertEquals(1, (int)cursorResult.get());
    secondCursor.fire();
    cursorResult = cursor.getNext();
    assertEquals(RecordCursor.NoNextReason.RETURN_LIMIT_REACHED, cursorResult.getNoNextReason());
    assertThat(timer.getCount(FDBStoreTimer.Events.QUERY_INTERSECTION), lessThanOrEqualTo(5));
}