title: How to Create a Kafka Consumer Record from a String to build Junit test case
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><code>public void processConsumerRecord(ConsumerRecords&lt;String, GenericRecord&gt; records, boolean isEventProcessed, boolean isOffsetCommitted,
                                    int totalErrorCountFromSinkService, int totalErrorCount, Consumer&lt;String, GenericRecord&gt; consumer) {
  </code></pre>
  
  <p>......
  }</p>
  
  <p>My Kafka consumer is pulling messages from kafka topic and i need to be able to provide an input message in a ConsumerRecords format, But as part of Unit test I am not polling the message from kafka, instead mocking the message from original kafka topic and providing the static input message to Unit test case which tests the above method as shown. How to create a mocked input message in the form of 
  ConsumerRecords &lt; String, GenericRecord >  ?</p>