private void flushStore(final long timestamp) {
            try (final KeyValueIterator<String, Long> it = store.all()) {
                while (it.hasNext()) {
                    final KeyValue<String, Long> next = it.next();
                    context.forward(new Record<>(next.key, next.value, timestamp));
                }
            }
        }
This is code sample in docs/streams/developer-guide/testing.html
streams/examples/src/test/java/org/apache/kafka/streams/examples/docs/DeveloperGuideTesting.java