InMemoryKeyValueStore implements KeyValueStore<byte[], byte[]> { @Override public void flush() { metrics.flushes().inc(); } InMemoryKeyValueStore(KeyValueStoreMetrics metrics); @Override byte[] get(byte[] key); @Override void put(byte[] key, byte[] value); @Override void putAll(List<Entry<byte[], byte[]>> entries); @Override void delete(byte[] key); @Override KeyValueIterator<byte[], byte[]> range(byte[] from, byte[] to); @Override KeyValueSnapshot<byte[], byte[]> snapshot(byte[] from, byte[] to); @Override KeyValueIterator<byte[], byte[]> all(); @Override Optional<Path> checkpoint(CheckpointId id); @Override void flush(); @Override void close();  }
@Test public void testFlush() { Counter flushesCounter = mock(Counter.class); when(this.keyValueStoreMetrics.flushes()).thenReturn(flushesCounter); this.inMemoryKeyValueStore.flush(); verify(flushesCounter).inc(); }