title: Kafka - How to Mock Consumer Record?
body: <p>I need some help with building a Junit test case for my Java kafka consumer.</p>
  
  <p>My Original source code has the method as below, and need to create a Unit test case for the same.</p>
  
  <pre class="lang-java prettyprint-override"><code>@KafkaListener(topics = "${kafka-receiver-topic}")
  public void receiveTopic(ConsumerRecord&lt;?, ?&gt; consumerRecord) throws Exception {
      JSONObject kafkaObject = new JSONObject(consumerRecord.value().toString());
  }
  </code></pre>