Class KafkaMatchers
- java.lang.Object
-
- org.springframework.kafka.test.hamcrest.KafkaMatchers
-
public final class KafkaMatchers extends java.lang.Object
HamcrestMatcher
s utilities.- Author:
- Gary Russell, Biju Kunjummen
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
KafkaMatchers.ConsumerRecordKeyMatcher<K>
static class
KafkaMatchers.ConsumerRecordPartitionMatcher
static class
KafkaMatchers.ConsumerRecordTimestampMatcher
static class
KafkaMatchers.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 aConsumerRecord
assuming 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 aConsumerRecord
static <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 aConsumerRecord
assuming 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
-
-