Conversation
Contributor
📋 Unreleased Changelog Preview
ChangelogAll notable changes to this project will be documented in this file. [Unreleased]✨ Features
Generated by git-cliff 🔄 Run #149 · Thu, 01 Oct 2026 17:22:35 GMT |
Contributor
✅ Test Results
✅ Coverage
🔄 CI run #168 · Thu, 01 Oct 2026 17:26:43 GMT |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📝 Description
This PR introduces a configurable
KeyMatchStrategyenum inktestify-corethat allowsexpectedRecordKeyto be matched using strategies other than exact equality:CONTAINS,STARTS_WITH,ENDS_WITH, andREGEX.Previously,
expectedRecordKeywas hardcoded toString.equals()in five locations: the fetch-time pre-filter (KafkaRecordFetcher.passesKeyFilter()) and four assertion-time matchers (KeyRecordMatcher,FileKeyRecordMatcher,AvroKeyRecordMatcher,AvroFileKeyRecordMatcher). This made it impossible to validate dynamically generated keys (UUIDs, prefixed keys, etc.) without knowing the exact value upfront.The new
KeyMatchStrategyenum encapsulates the comparison logic in a singlematches(expected, actual)method. It flows through both layers identically to howexpectedRecordKeyalready flows:ConsumerContext(fetch-time filter) andMatchContext(assertion). The default isEXACT, preserving full backward compatibility.Resolves #46
🔄 Type of Change
✅ Pre-Merge Checklist
Code Quality
mvn spotless:check)Tests
mvn verify)Licensing
🧪 How to Test Locally
📸 Screenshots / Logs
All tests pass:
📚 Additional Context
Files Changed
New file:
match/KeyMatchStrategy.java: Enum withEXACT,CONTAINS,STARTS_WITH,ENDS_WITH,REGEX. IncludesfromString()for parsing DataTable values (case-insensitive, tolerant of hyphens/underscores/spaces, defaults toEXACT).Modified (main):
io/kafka/ConsumerContext.javakeyMatchStrategyfield + builder method (defaults toEXACT)io/kafka/KafkaRecordFetcher.javapassesKeyFilter()usesstrategy.matches()instead ofequals()io/kafka/AbstractKafkaConsumer.javabuildMatchContext()propagateskeyMatchStrategytoMatchContextmatch/MatchContext.javakeyMatchStrategyfield with@Builder.Default=EXACTmatch/impl/KeyRecordMatcher.javastrategy.matches()match/impl/FileKeyRecordMatcher.javastrategy.matches()match/impl/AvroKeyRecordMatcher.javastrategy.matches()match/impl/AvroFileKeyRecordMatcher.javastrategy.matches()Modified (test):
match/KeyMatchStrategyTest.javafromString()parsingmatch/impl/KeyRecordMatcherTest.javaKeyStrategiesnested class with 10 strategy testsmatch/impl/MatcherTestSupport.javactxWithKeyAndStrategy()helperBackward Compatibility
The default strategy is
EXACTeverywhere. Existing feature files and code paths that do not setkeyMatchStrategybehave exactly as before. No breaking changes.