To test Spring Kafka component, you can use spring-kafka-test library that has EmbeddedKafka with collections of consumer and producer utils.