### Question:
KeyValueCountQuery implements LocalStoreQuery<String, Long> { @Override public Try<List<KV<String, Long>>> execute(final KafkaStreamsContainer container, final long limit) { final LocalStoreAccessor<ReadOnlyKeyValueStore<Object, Object>> accessor = container.localKeyValueStore(storeName); Reader<ReadOnlyKeyValueStore<Object, Object>, List<KV<String, Long>>> reader = reader() .map(value -> Optional.ofNullable(value) .map(v -> Collections.singletonList(new KV<>(STATIC_KEY, v))) .orElse(Collections.emptyList())); return new LocalStoreQueryExecutor<>(accessor).execute(reader); } KeyValueCountQuery(final String storeName); @Override StoreType storeType(); @Override StoreOperation operationType(); @Override Try<List<KV<String, Long>>> execute(final KafkaStreamsContainer container,
                                               final long limit);  }### Answer:
@Test public void shouldReturnApproximateNumEntries() { KeyValueCountQuery query = new KeyValueCountQuery(STORE_NAME); final var mkContainer = Mockito.mock(KafkaStreamsContainer.class); ReadOnlyKeyValueStore store = mock(ReadOnlyKeyValueStore.class); when(store.approximateNumEntries()).thenReturn(42L); when(mkContainer.localKeyValueStore(matches(STORE_NAME))).thenReturn(new LocalStoreAccessor<>(() -> store)); Try<List<KV<String, Long>>> result = query.execute(mkContainer); Assertions.assertEquals(1, result.get().size()); Assertions.assertEquals(KV.of("count", 42L), result.get().get(0)); }