@Test
public void beginsWith() {

    fdb.run(context -> {
        KeyValueCursor cursor = KeyValueCursor.Builder.withSubspace(subspace)
                .setContext(context)
                .setRange(TupleRange.allOf(Tuple.from(3)))
                .setContinuation(null)
                .setScanProperties(ScanProperties.FORWARD_SCAN)
                .build();
        for (int j = 0; j < 5; j++) {
            KeyValue kv = cursor.getNext().get();
            assertArrayEquals(subspace.pack(Tuple.from(3, j)), kv.getKey());
            assertArrayEquals(Tuple.from(3, j).pack(), kv.getValue());
        }
        assertThat(cursor.getNext().hasNext(), is(false));
        cursor = KeyValueCursor.Builder.withSubspace(subspace)
                .setContext(context)
                .setRange(TupleRange.allOf(Tuple.from(3)))
                .setContinuation(null)
                .setScanProperties(new ScanProperties(ExecuteProperties.newBuilder().setReturnedRowLimit(2).build()))
                .build();
        assertEquals(2, (int)cursor.getCount().join());
        cursor = KeyValueCursor.Builder.withSubspace(subspace)
                .setContext(context)
                .setRange(TupleRange.allOf(Tuple.from(3)))
                .setContinuation(cursor.getNext().getContinuation().toBytes())
                .setScanProperties(new ScanProperties(ExecuteProperties.newBuilder().setReturnedRowLimit(3).build()))
                .build();
        assertEquals(3, (int)cursor.getCount().join());
        return null;
    });
}