Jukka Karvanen takes us through TopologyTestDriver
in Apache Kafka Streams:
Similarly to testing a single record, it is possible to pipe
Value
lists into aTestInputTopic
. Validating the output can be done record by record like before, or by using thereadValueToList()
method to see the big picture when validating the whole collection at the same time. For our example topology, when the test pipes in the values, it needs to validate the keys and use thereadKeyValueToList()
method.
Testing streams of data (regardless of the product) is enough of a mental shift that it’s not an easy problem. For that reason, I welcome any tool which simplifies the process.