@Test
  public void testPutAllUpdate() {
    // check that an existing value is overridden
    this.inMemoryKeyValueStore.put(key(0), value(OTHER_VALUE_PREFIX, 0));
    List<Entry<byte[], byte[]>> entries = new ArrayList<>();
    for (int i = 0; i < 10; i++) {
      entries.add(new Entry<>(key(i), value(i)));
    }
    this.inMemoryKeyValueStore.putAll(entries);

    for (int i = 0; i < 10; i++) {
      assertArrayEquals(value(i), this.inMemoryKeyValueStore.get(key(i)));
    }
    // 1 time for initial value to be overridden, 10 times for "regular" puts
    verify(this.putsCounter, times(11)).inc();
    // for initial value which is overridden
    verify(this.bytesWrittenCounter).inc(DEFAULT_KEY_LENGTH + value(OTHER_VALUE_PREFIX, 0).length);
    // when using key(i) and value(i), the byte[] lengths will be the same
    verify(this.bytesWrittenCounter, times(10)).inc(DEFAULT_KEY_LENGTH + 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