private ConsumerRecords<byte[], byte[]> createTestRecordsWithHeaders() { RecordHeader header = new RecordHeader("testHeader", new byte[0]); RecordHeaders headers = new RecordHeaders(); headers.add(header); TimestampType timestampType = TimestampType.NO_TIMESTAMP_TYPE; byte testByte = 0; byte[] testKey = { testByte }; byte[] testValue = { testByte }; ConnectHeaders destinationHeaders = new ConnectHeaders(); destinationHeaders.add(header.key(), header.value(), Schema.OPTIONAL_BYTES_SCHEMA); ConsumerRecord<byte[], byte[]> testConsumerRecord = new ConsumerRecord<byte[], byte[]>(FIRST_TOPIC, FIRST_PARTITION, FIRST_OFFSET, System.currentTimeMillis(), timestampType, 0L, 0, 0, testKey, testValue, headers); TopicPartition topicPartition = new TopicPartition(FIRST_TOPIC, FIRST_PARTITION); List<ConsumerRecord<byte[], byte[]>> consumerRecords = new ArrayList<>(); consumerRecords.add(testConsumerRecord); Map<TopicPartition, List<ConsumerRecord<byte[], byte[]>>> consumerRecordMap = new HashMap<>(1); consumerRecordMap.put(topicPartition, consumerRecords); ConsumerRecords<byte[], byte[]> testRecords = new ConsumerRecords<>(consumerRecordMap); return testRecords; }