Class KafkaMatchers
- java.lang.Object
-
- org.springframework.kafka.test.hamcrest.KafkaMatchers
-
public final class KafkaMatchers extends java.lang.ObjectHamcrestMatchers utilities.- Author:
- Gary Russell, Biju Kunjummen
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classKafkaMatchers.ConsumerRecordKeyMatcher<K>static classKafkaMatchers.ConsumerRecordPartitionMatcherstatic classKafkaMatchers.ConsumerRecordTimestampMatcherstatic classKafkaMatchers.ConsumerRecordValueMatcher<V>
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <K> org.hamcrest.Matcher<org.apache.kafka.clients.consumer.ConsumerRecord<K,?>>hasKey(K key)static org.hamcrest.Matcher<org.apache.kafka.clients.consumer.ConsumerRecord<?,?>>hasPartition(int partition)static org.hamcrest.Matcher<org.apache.kafka.clients.consumer.ConsumerRecord<?,?>>hasTimestamp(long ts)Matcher testing the timestamp of aConsumerRecordassuming the topic has been set withCreateTime.static org.hamcrest.Matcher<org.apache.kafka.clients.consumer.ConsumerRecord<?,?>>hasTimestamp(org.apache.kafka.common.record.TimestampType type, long ts)Matcher testing the timestamp of aConsumerRecordstatic <V> org.hamcrest.Matcher<org.apache.kafka.clients.consumer.ConsumerRecord<?,V>>hasValue(V value)
-
-
-
Method Detail
-
hasKey
public static <K> org.hamcrest.Matcher<org.apache.kafka.clients.consumer.ConsumerRecord<K,?>> hasKey(K key)
- Type Parameters:
K- the type.- Parameters:
key- the key- Returns:
- a Matcher that matches the key in a consumer record.
-
hasValue
public static <V> org.hamcrest.Matcher<org.apache.kafka.clients.consumer.ConsumerRecord<?,V>> hasValue(V value)
- Type Parameters:
V- the type.- Parameters:
value- the value.- Returns:
- a Matcher that matches the value in a consumer record.
-
hasPartition
public static org.hamcrest.Matcher<org.apache.kafka.clients.consumer.ConsumerRecord<?,?>> hasPartition(int partition)
- Parameters:
partition- the partition.- Returns:
- a Matcher that matches the partition in a consumer record.
-
hasTimestamp
public static org.hamcrest.Matcher<org.apache.kafka.clients.consumer.ConsumerRecord<?,?>> hasTimestamp(long ts)
Matcher testing the timestamp of aConsumerRecordassuming the topic has been set withCreateTime.- Parameters:
ts- timestamp of the consumer record.- Returns:
- a Matcher that matches the timestamp in a consumer record.
- Since:
- 1.3
-
hasTimestamp
public static org.hamcrest.Matcher<org.apache.kafka.clients.consumer.ConsumerRecord<?,?>> hasTimestamp(org.apache.kafka.common.record.TimestampType type, long ts)Matcher testing the timestamp of aConsumerRecord- Parameters:
type- timestamp type of the recordts- timestamp of the consumer record.- Returns:
- a Matcher that matches the timestamp in a consumer record.
- Since:
- 1.3
-
-