Interface KafkaAsserts
- All Known Implementing Classes:
Kafka
public interface KafkaAsserts
Interface describes methods responsible for helper assertions.
Validates that all required methods are implemented.
-
Method Summary
Modifier and TypeMethodDescriptionvoidseeMessagesContainJson(String topic, String expectedJsonPart) Asserts that at least one of messages in topic contains the specified JSON without strict array ordering.voidseeMessagesContainText(String topic, String expectedPart) Asserts that at least one of messages in topic contains the specified text.voidseeMessagesCountInTopicExactly(String topic, int expectedCount) Asserts that the number of messages in the topic is exactly the expected count.voidseeMessagesHaveEqualJson(String topic, String expectedJson) Asserts that at least one of messages in topic is equal to the specified JSON with strict array ordering.voidseeMessagesHaveEqualText(String topic, String expectedText) Asserts that at least one message in the topic is equal to the expected text.voidseeTopicExists(String topicName) Asserts that the topic exists.voidseeTopicIsEmpty(String topic) Asserts that the topic is empty.voidseeTopicIsNotEmpty(String topic) Asserts that the topic is not empty
-
Method Details
-
seeTopicIsEmpty
Asserts that the topic is empty.Uses await.
- Parameters:
topic- topic name- Throws:
AssertionError- if the assertion failsKafkaHelperException- if the topic does not exist
-
seeTopicIsNotEmpty
Asserts that the topic is not emptyUses await.
- Parameters:
topic- topic name- Throws:
AssertionError- if the assertion failsKafkaHelperException- if the topic does not exist
-
seeMessagesCountInTopicExactly
Asserts that the number of messages in the topic is exactly the expected count.Uses await.
- Parameters:
topic- topic nameexpectedCount- expected number of messages- Throws:
AssertionError- if the assertion failsKafkaHelperException- if the topic does not exist
-
seeMessagesHaveEqualText
Asserts that at least one message in the topic is equal to the expected text.Uses await until at least one message exists.
- Parameters:
topic- topic nameexpectedText- expected message text- Throws:
AssertionError- if the assertion failsorg.awaitility.core.ConditionTimeoutException- if the topic remains empty until the await timeout expiresKafkaHelperException- if the topic does not exist or consumer timeout is reached
-
seeMessagesContainText
Asserts that at least one of messages in topic contains the specified text.Uses await until at least one message exists.
- Parameters:
topic- topic nameexpectedPart- expected text part- Throws:
AssertionError- if the assertion failsorg.awaitility.core.ConditionTimeoutException- if the topic remains empty until the await timeout expiresKafkaHelperException- if the topic does not exist or consumer timeout is reached
-
seeMessagesHaveEqualJson
Asserts that at least one of messages in topic is equal to the specified JSON with strict array ordering.Uses await until at least one message exists.
- Parameters:
topic- topic nameexpectedJson- expected full JSON with strict array ordering- Throws:
AssertionError- if the assertion failsorg.awaitility.core.ConditionTimeoutException- if the topic remains empty until the await timeout expiresIllegalArgumentException- if the provided data is not valid JSONKafkaHelperException- if the topic does not exist or consumer timeout is reached
-
seeMessagesContainJson
Asserts that at least one of messages in topic contains the specified JSON without strict array ordering.Uses await until at least one message exists.
- Parameters:
topic- topic nameexpectedJsonPart- expected JSON subset (array order is ignored, but the number of elements must match if provided)- Throws:
AssertionError- if the assertion failsorg.awaitility.core.ConditionTimeoutException- if the topic remains empty until the await timeout expiresIllegalArgumentException- if the provided data is not valid JSONKafkaHelperException- if the topic does not exist or consumer timeout is reached
-
seeTopicExists
Asserts that the topic exists.Uses await.
- Parameters:
topicName- topic name- Throws:
AssertionError- if the assertion failsKafkaHelperException- if an Kafka error occurs
-