Feat/multiple match fields - #59
Merged
Merged
Conversation
Contributor
📋 Unreleased Changelog Preview
ChangelogAll notable changes to this project will be documented in this file. [Unreleased]✨ Features
Generated by git-cliff 🔄 Run #146 · Sun, 20 Sep 2026 21:09:53 GMT |
Contributor
✅ Test Results
✅ Coverage
🔄 CI run #165 · Sun, 20 Sep 2026 21:13:11 GMT |
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 adds support for specifying multiple key/value pairs in the
Then expected record based on schema should have fields matching from given valuestep, allowing users to validate multiple Avro fields in a single assertion instead of just one.What changed:
MatchContext(ktestify-core): Added a newmatchKeyValuesfield (Map<String, String>) to carry multiple key/value pairs for multi-field inline matching.AvroFieldsRecordMatcher(ktestify-core): WhenmatchKeyValuesis non-empty, the matcher iterates over all key/value pairs and validates each against the actual Avro record. All pairs must match for the assertion to pass. The first mismatch (or all mismatches) are reported in the diff.MultiFieldValuenested test class toAvroFieldsRecordMatcherTestcovering all-fields-match, one-field-mismatch, all-fields-mismatch, and single-entry cases. AddedctxWithKeyValueshelper toMatcherTestSupport.Usage example:
This validates that batchId == 0 and taskId == 99.
The existing single-field syntax (key/value columns) remains fully supported and unchanged.