Skip to content

Commit 197f846

Browse files
bibonixclaude
andauthored
fix: #128 swap ours and theirs in Wallet.File.merge error (#132)
The IOException thrown by Wallet.File.merge on an id mismatch labelled the other wallet's id as ours and this wallet's id as theirs, sending a reader to the wrong side of the comparison. Swap the FormattedText arguments so the label matches the value, and update the pinned assertion in WalletTest.doesNotMergeWalletsWithDifferentId. Closes #128 Co-authored-by: Claude <noreply@anthropic.com>
1 parent 7db2e9d commit 197f846

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

‎src/main/java/io/zold/api/Wallet.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,8 @@ public Wallet merge(final Wallet other) throws IOException {
227227
new UncheckedText(
228228
new FormattedText(
229229
"Wallet ID mismatch, ours is %d, theirs is %d",
230-
other.id(),
231-
this.id()
230+
this.id(),
231+
other.id()
232232
)
233233
).asString()
234234
);

‎src/test/java/io/zold/api/WalletTest.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public void doesNotMergeWalletsWithDifferentId() throws IOException {
112112
() -> wallet.merge(new Wallet.Fake(123L))
113113
).getMessage(),
114114
Matchers.startsWith(
115-
"Wallet ID mismatch, ours is 123, theirs is 5124095577148911"
115+
"Wallet ID mismatch, ours is 5124095577148911, theirs is 123"
116116
)
117117
);
118118
}

0 commit comments

Comments
 (0)