@Test
  public void testSnapshotMultipleIterators() {
    for (int i = 0; i < 10; i++) {
      this.inMemoryKeyValueStore.put(key(OTHER_KEY_PREFIX, i), value(OTHER_VALUE_PREFIX, i));
      this.inMemoryKeyValueStore.put(key(i), value(i));
    }
    KeyValueSnapshot<byte[], byte[]> snapshot = this.inMemoryKeyValueStore.snapshot(key(0), key(5));
    assertEquals(5, Iterators.size(snapshot.iterator())); // Iterators.size exhausts the iterator
    assertEquals(5, Iterators.size(snapshot.iterator()));
    // key size increments: calling two separate iterators; key(i) produces byte[] of same length
    verify(this.bytesReadCounter, times(5 * 2)).inc(DEFAULT_KEY_LENGTH);
    // value size increments: calling two separate iterators; value(i) produces byte[] of same length
    verify(this.bytesReadCounter, times(5 * 2)).inc(DEFAULT_VALUE_LENGTH);
  }
The length of the result of {@link #value(int)} will always be the same, so this can be used as the length for any
key produced by {@link #value(int)}.
samza-kv-inmemory/src/test/java/org/apache/samza/storage/kv/inmemory/TestInMemoryKeyValueStore.java