Doing my first steps with kafka (java code) I would like to create a simple test for kafka producer, something like this where I can mock zoo keeper (this implementation looks nice but I can't reach some of the classes there, specifically EmbeddedZookeeper and TestUtils).
Any ideas?
You can use the Kafka-test artifact:
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka_2.9.2</artifactId>
<version>0.8.0</version>
<classifier>test</classifier>
<scope>test</scope>
</dependency>
If you need a separate mock for zookeeper, Apache curator-test might do:
<dependency>
<groupId>org.apache.curator</groupId>
<version>2.3.2-SNAPSHOT</version>
<artifactId>curator-test</artifactId>
<scope>test</scope>
</dependency>
Probably taken from the Kafka source .. Check here for EmbeddedZk and here for the Utils ..
The full package is available here
see if it helps
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With