private void iteratorTest(RheaKVStore store) {
        // regions: 1 -> [null, g), 2 -> [g, null)
        List<byte[]> keyList = Lists.newArrayList();
        List<byte[]> valueList = Lists.newArrayList();
        for (int i = 0; i < 10; i++) {
            byte[] key = makeKey("a_iterator_test_key_" + i);
            checkRegion(store, key, 1);
            byte[] value = makeValue("iterator_test_value_" + i);
            keyList.add(key);
            valueList.add(value);
            store.bPut(key, value);
        }
        for (int i = 0; i < 10; i++) {
            byte[] key = makeKey("h_iterator_test_key_" + i);
            checkRegion(store, key, 2);
            byte[] value = makeValue("iterator_scan_test_value_" + i);
            keyList.add(key);
            valueList.add(value);
            store.bPut(key, value);
        }

        // iterator(byte[], byte[], int)
        {
            RheaIterator<KVEntry> iterator = store.iterator(makeKey("a_iterator_test_key_"), makeKey("z"), 2);
            int i = 0;
            while (iterator.hasNext()) {
                final int index = i++;
                final KVEntry kvEntry = iterator.next();
                System.err.println("index " + index);
                System.err.println(BytesUtil.readUtf8(kvEntry.getKey()));
                assertArrayEquals(keyList.get(index), kvEntry.getKey());
                assertArrayEquals(valueList.get(index), kvEntry.getValue());
            }
        }

        // iterator(String, String, int)
        {
            RheaIterator<KVEntry> iterator = store.iterator("a_iterator_test_key_", "z", 2);
            int i = 0;
            while (iterator.hasNext()) {
                final int index = i++;
                final KVEntry kvEntry = iterator.next();
                System.err.println("index " + index);
                System.err.println(BytesUtil.readUtf8(kvEntry.getKey()));
                assertArrayEquals(keyList.get(index), kvEntry.getKey());
                assertArrayEquals(valueList.get(index), kvEntry.getValue());
            }
        }

        // iterator(byte[], byte[], int, boolean, boolean)
        {
            RheaIterator<KVEntry> iterator = store.iterator(makeKey("a_iterator_test_key_"), makeKey("z"), 2, true,
                false);
            int i = 0;
            while (iterator.hasNext()) {
                final int index = i++;
                final KVEntry kvEntry = iterator.next();
                System.err.println("index " + index);
                System.err.println(BytesUtil.readUtf8(kvEntry.getKey()));
                assertArrayEquals(keyList.get(index), kvEntry.getKey());
                assertNull(kvEntry.getValue());
            }
        }

        // iterator(String, String, int, boolean, boolean)
        {
            RheaIterator<KVEntry> iterator = store.iterator("a_iterator_test_key_", "z", 2, true, false);
            int i = 0;
            while (iterator.hasNext()) {
                final int index = i++;
                final KVEntry kvEntry = iterator.next();
                System.err.println("index " + index);
                System.err.println(BytesUtil.readUtf8(kvEntry.getKey()));
                assertArrayEquals(keyList.get(index), kvEntry.getKey());
                assertNull(kvEntry.getValue());
            }
        }

        {
            RheaIterator<KVEntry> iterator = store.iterator("a_iterator_test_key_", "z", 2);
            int i = 0;
            while (iterator.hasNext()) {
                final int index = i++;
                final KVEntry kvEntry = iterator.next();
                System.err.println("index " + index);
                System.err.println(BytesUtil.readUtf8(kvEntry.getKey()));
                assertArrayEquals(keyList.get(index), kvEntry.getKey());
                assertArrayEquals(valueList.get(index), kvEntry.getValue());
            }
        }

        {
            RheaIterator<KVEntry> iterator = store.iterator("a", null, 5);
            int i = 0;
            while (iterator.hasNext()) {
                final int index = i++;
                final KVEntry kvEntry = iterator.next();
                System.err.println("index " + index);
                System.err.println(BytesUtil.readUtf8(kvEntry.getKey()));
                assertArrayEquals(keyList.get(index), kvEntry.getKey());
                assertArrayEquals(valueList.get(index), kvEntry.getValue());
            }
        }
    }
Test method: {@link RheaKVStore#scan(byte[], byte[])}
jraft-rheakv/rheakv-core/src/test/java/com/alipay/sofa/jraft/rhea/storage/rhea/AbstractRheaKVStoreTest.java