public Map<K, V> readKeyValuesToMap() {
        final Map<K, V> output = new HashMap<>();
        TestRecord<K, V> outputRow;
        while (!isEmpty()) {
            outputRow = readRecord();
            if (outputRow.key() == null) {
                throw new IllegalStateException("Null keys not allowed with readKeyValuesToMap method");
            }
            output.put(outputRow.key(), outputRow.value());
        }
        return output;
    }
Read output to map.
This method can be used if the result is considered a table,
when you are only interested in the last table update (ie, the final table state).
If the result is considered a stream, you can use {@link #readRecordsToList()} instead.
The list will contain all updated, ie, a key might be contained multiple times.
If the last update to a key is a delete/tombstone, the key will still be in the map (with null-value).

@return Map of output by key.
streams/test-utils/src/main/java/org/apache/kafka/streams/TestOutputTopic.java