Commit 8d787ebe authored by Jonas Waeber's avatar Jonas Waeber

Add basic test for header.

parent ebd4cfb7
Pipeline #14194 passed with stages
in 9 minutes and 36 seconds
...@@ -26,6 +26,7 @@ import java.util.stream.Stream ...@@ -26,6 +26,7 @@ import java.util.stream.Stream
import org.apache.kafka.clients.consumer.ConsumerConfig import org.apache.kafka.clients.consumer.ConsumerConfig
import org.apache.kafka.clients.consumer.ConsumerRecord import org.apache.kafka.clients.consumer.ConsumerRecord
import org.apache.kafka.clients.consumer.KafkaConsumer import org.apache.kafka.clients.consumer.KafkaConsumer
import org.apache.kafka.common.header.internals.RecordHeader
import org.apache.kafka.common.serialization.StringDeserializer import org.apache.kafka.common.serialization.StringDeserializer
import org.apache.logging.log4j.LogManager import org.apache.logging.log4j.LogManager
import org.assertj.core.api.Assertions.assertThat import org.assertj.core.api.Assertions.assertThat
...@@ -100,6 +101,7 @@ class Tests { ...@@ -100,6 +101,7 @@ class Tests {
val record = totalConsumerRecords.find { value -> value.topic() == topic }!! val record = totalConsumerRecords.find { value -> value.topic() == topic }!!
val recordKey = record.key() val recordKey = record.key()
val recordMessage = record.value() val recordMessage = record.value()
val headers = record.headers()
val report = totalConsumerRecords.find { value -> value.topic() == reportingTopic }!! val report = totalConsumerRecords.find { value -> value.topic() == reportingTopic }!!
val reportKey = report.key() val reportKey = report.key()
...@@ -121,6 +123,10 @@ class Tests { ...@@ -121,6 +123,10 @@ class Tests {
{ {
assertThat(reportMessage) assertThat(reportMessage)
.isEqualTo(params.expectedReportValue) .isEqualTo(params.expectedReportValue)
},
{
assertThat(headers)
.contains(RecordHeader("sessionId", "session1".toByteArray()))
} }
) )
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment