@Test
  public void testPut() throws Exception {
    File dir0 = Files.createTempDir();
    VersionedPartitionName partitionName =
        new VersionedPartitionName(
            new PartitionName(false, "r1".getBytes(), "t1".getBytes()),
            VersionedPartitionName.STATIC_VERSION);
    BerkeleyDBWALIndex index = getIndex(dir0, partitionName);
    index.merge(
        stream ->
            stream.stream(
                1L,
                UIO.longBytes(-1),
                UIO.longBytes(1),
                null,
                System.currentTimeMillis(),
                false,
                Long.MAX_VALUE,
                1L),
        null);

    index.getPointer(
        UIO.longBytes(-1),
        UIO.longBytes(1),
        (prefix, key, timestamp, tombstoned, version, fp, hasValue, value) -> {
          assertEquals(fp, 1);
          return true;
        });

    index.close();

    // reopen
    index = getIndex(dir0, partitionName);
    index.merge(
        stream ->
            stream.stream(
                2L,
                UIO.longBytes(-2),
                UIO.longBytes(2),
                null,
                System.currentTimeMillis(),
                false,
                Long.MAX_VALUE,
                2L),
        null);
    index.getPointer(
        UIO.longBytes(-2),
        UIO.longBytes(2),
        (prefix, key, timestamp, tombstoned, version, fp, hasValue, value) -> {
          assertEquals(fp, 2);
          return true;
        });

    index.merge(
        (TxKeyPointerStream stream) -> {
          for (long i = 0; i < 100; i++) {
            if (!stream.stream(
                i,
                UIO.longBytes(-i),
                UIO.longBytes(i),
                null,
                System.currentTimeMillis(),
                false,
                Long.MAX_VALUE,
                i)) {
              return false;
            }
          }
          return true;
        },
        null);

    for (long i = 0; i < 100; i++) {
      long expected = i;
      index.getPointer(
          UIO.longBytes(-i),
          UIO.longBytes(i),
          (prefix, key, timestamp, tombstoned, version, fp, hasValue, value) -> {
            assertEquals(fp, expected);
            return true;
          });
    }
  }