The easiest way to do unit testing for Scala with Kafka
class FooSpec extends FlatSpec with TestKit {
import TestKit._
it should "produce a message to topic FOO" in {
subscribe("FOO") {
Foo.produceKafkaMessage("hello world")
poll("FOO") should be ("hello world")
}
}
it should "receive a message from topic BAR" in {
send("BAR", "hello world")
...
}
}
- Publish its jar to a central repository.
- Your opinion..