All releases

v3.6.0

log-on-failure

Failing topic assertions now ship with the topic's records, pretty-printed.

Highlights

  • 01

    Default-on log-on-failure

    Every failing KafkaTopicAssert assertion is now augmented with a snapshot of the topic's current records (key, value, offset, partition). No opt-in needed. Inspired by RestAssured's .log().ifValidationFails().

    Read the guide →
  • 02

    Pretty-printed JSON values

    JSON record values in the failure dump are pretty-printed via Jackson. Plain strings render as-is; binary or unparseable payloads fall through to plain output. Indentation is preserved under each record block.

    Read the guide →
  • 03

    No more NPEs on null Matcher arguments

    Every public assertion method that accepts a Hamcrest Matcher now fails with a clear AssertionError naming the offending parameter when null is passed.

    Read the guide →

Full notes

Added

  • RestAssured-style log-on-failure for KafkaTopicAssert: every failing assertion in a topic-assertion chain is augmented with a snapshot of the topic's current records (key, value, offset, partition). Default-on — no opt-in needed; failure messages just include the context. JSON values are pretty-printed via Jackson; plain strings render as-is; binary or unparseable values fall through to plain output. Inspired by RestAssured's .log().ifValidationFails().
  • KafkaTopicAssert.silentOnFailure() to opt out of the dump on a per-chain basis (negative-path tests, noisy topics).
  • KafkaTopicAssert.logOnFailure(int maxRecords) to cap the dump size for noisy topics. Default cap is 50.

Changed

  • Bumped version to 3.6.0-SNAPSHOT.

Fixed

  • Fixed NullPointerException on every public assertion method that accepts a Hamcrest Matcher<?> parameter (KafkaRecordAssert.hasKeyMatching, hasValueMatching, hasHeaderWithValue(key, Matcher), hasJsonPath(path, Matcher); KafkaTopicAssert.containsRecordWithKeyMatching, containsRecordWithValueMatching, containsRecordWithValueMatching(Class, Matcher)). A null matcher now produces an AssertionError naming the offending parameter rather than NPEing from inside the matcher API.