Skip to content

Feat/multiple match fields - #59

Merged
nil-malh merged 2 commits into
mainfrom
feat/multiple-match-fields
Sep 20, 2026
Merged

nil-malh merged 2 commits into
mainfrom
feat/multiple-match-fields

Conversation

@nil-malh

Copy link
Copy Markdown
Contributor

📝 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 value step, allowing users to validate multiple Avro fields in a single assertion instead of just one.

What changed:

  • MatchContext (ktestify-core): Added a new matchKeyValues field (Map<String, String>) to carry multiple key/value pairs for multi-field inline matching.
  • AvroFieldsRecordMatcher (ktestify-core): When matchKeyValues is 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.
  • Unit tests: Added a MultiFieldValue nested test class to AvroFieldsRecordMatcherTest covering all-fields-match, one-field-mismatch, all-fields-mismatch, and single-entry cases. Added ctxWithKeyValues helper to MatcherTestSupport.

Usage example:

Then expected record based on schema should have fields matching from given value
  | topicAlias | keys                    | values         |
  | solver-out | batchId;taskId | 0;99             |

This validates that batchId == 0 and taskId == 99.
The existing single-field syntax (key/value columns) remains fully supported and unchanged.

@github-actions

Copy link
Copy Markdown
Contributor

📋 Unreleased Changelog Preview

This is what the next release notes will look like based on commits in this PR.

Changelog

All notable changes to this project will be documented in this file.

[Unreleased]

✨ Features

  • Add multi-field inline matching support in AvroFieldsRecordMatcher

  • Add multi-field inline matching support in AvroFieldsRecordMatcher


Generated by git-cliff


🔄 Run #146 · Sun, 20 Sep 2026 21:09:53 GMT

@github-actions

Copy link
Copy Markdown
Contributor

✅ Test Results

Metric Count
✅ Passed 724
❌ Failed 0
⏭️ Skipped 0
📊 Total 724

✅ Coverage

Type Coverage Covered / Total
📏 Lines 83.9% 1893 / 2256
🌿 Branches 73.1% 592 / 810
🔧 Methods 84.7% 388 / 458

🔄 CI run #165 · Sun, 20 Sep 2026 21:13:11 GMT

@nil-malh
nil-malh merged commit 6a3a096 into main Sep 20, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant