Kafka manufacturer unit test (java)

Performing my first steps with kafka (Java code), I would like to create a simple test for the kafka manufacturer, something like this , where I can mock zoo keeper (this implementation looks good, but I can not find some of the classes there , in particular EmbeddedZookeeper and TestUtils).

Any ideas?

+6
source share
2 answers

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 layout for zookeeper, the Apache curatorial test can do:

 <dependency> <groupId>org.apache.curator</groupId> <version>2.3.2-SNAPSHOT</version> <artifactId>curator-test</artifactId> <scope>test</scope> </dependency> 
+7
source

Probably taken from the source of Kafka .. here for EmbeddedZk and here for Utils ..

Full package available here.

see if it helps

+1
source

Source: https://habr.com/ru/post/955477/


All Articles