Repository navigation
test(java): add unit tests for TargetKey - #5044
viniciusscience wants to merge 1 commit into
Conversation
|
Thanks for the PR. It is labeled If AI assistance was used to create this PR, you are required to run the Slash commands (own line, regular comment) move it around the queue:
See CONTRIBUTING.md for details. |
|
Thanks @viniciusscience, and welcome. Please run prek as CONTRIBUTING.md asks, and as you used Antigravity, please run the team-review skill and post the result here. |
|
Thanks for the welcome, @justinmclean! I have installed and run Iggy Team Review - Add unit tests for TargetKey (#5044) (ce79e1a)
Review: Add unit tests for TargetKey (#5044)FindingsNone. Unconfirmed (conf:L, check these first)None. Pre-existing (origin pre-*, does not block the merge)None. Simplification opportunities (does not block the merge)None. Verdict: APPROVEReason: All four reviewers verified Counts: critical 0, warning 0, nit 0, simplify 0 Raw findings per expertstorage (
|
Which issue does this PR address?
Closes #5034
Rationale
TargetKeyin the async TCP client had no dedicated unit tests verifying content-based equality, hashing, prefix matching, ortopic()slicing.What changed?
Added
TargetKeyTestinorg.apache.iggy.client.async.tcpcovering:hashCode(), while differing content or lengths are not equal;topic()strips the 4 trailing partition ID bytes to equalTargetKey.of(...)on the stream+topic prefix (with matchinghashCode());startsWith()returnstruefor a prefix and for an identical key, andfalsefor a longer key or mismatched prefix;equals()returnsfalsefornulland non-TargetKeyobjects.Local Execution
./gradlew :iggy:test --tests '*TargetKeyTest' --rerun :iggy:checkstyleTest spotlessCheck— 5/5 tests passed, Checkstyle and Spotless green)prek run --files foreign/java/java-sdk/src/test/java/org/apache/iggy/client/async/tcp/TargetKeyTest.java—mixed-line-ending,license-headers,trailing-whitespace,trailing-newline,binary-artifacts, andtyposall passed)Docs
AI Usage
BigIntegerMessageIdTestconventions../gradlew :iggy:test --tests '*TargetKeyTest' --rerun :iggy:checkstyleTest spotlessCheckandprek runlocally (5/5 tests passed, Checkstyle, Spotless, andprekhooks green), ran the 4-expertteam-reviewskill (Verdict: APPROVE), and verified every case againstTargetKey.java.TargetKey'sof,topic,startsWith,equals, andhashCodeimplementation.