Setting up Kafka Brokers for Testing with Kafka-Unit

When writing test for applications that interact with Kafka brokers we often need to setup a decent environment including an instance of Kafka and ZooKeeper. Though Kafka ships with some classes for testing, setting up a simple testing environment is quite easier with the kafka-unit library that offers JUnit test rule support or a fast programmatic setup within no time. In the following short example, I’d like to show how create a simple setup using Maven, Surefire and kafka-unit. ...

March 28, 2018 · 4 min · 825 words · Micha Kops