From 28222e0a80daeccfc9d37485f0a4c11b8c4297fe Mon Sep 17 00:00:00 2001 From: Jeromy Cannon Date: Fri, 15 Sep 2023 11:25:13 -0500 Subject: [PATCH] fix: update KeyValuePair.equals to only compare key (not value) (#347) Signed-off-by: Jeromy Cannon --- .../com/hedera/fullstack/base/api/collections/KeyValuePair.java | 2 +- .../fullstack/base/api/test/collections/KeyValuePairTest.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fullstack-base-api/src/main/java/com/hedera/fullstack/base/api/collections/KeyValuePair.java b/fullstack-base-api/src/main/java/com/hedera/fullstack/base/api/collections/KeyValuePair.java index e49f7d010..53f49f261 100644 --- a/fullstack-base-api/src/main/java/com/hedera/fullstack/base/api/collections/KeyValuePair.java +++ b/fullstack-base-api/src/main/java/com/hedera/fullstack/base/api/collections/KeyValuePair.java @@ -47,7 +47,7 @@ public static KeyValuePair of(final K key, final V value) { public boolean equals(final Object o) { if (this == o) return true; if (!(o instanceof KeyValuePair that)) return false; - return Objects.equals(key, that.key) && Objects.equals(value, that.value); + return Objects.equals(key, that.key); } @Override diff --git a/fullstack-base-api/src/test/java/com/hedera/fullstack/base/api/test/collections/KeyValuePairTest.java b/fullstack-base-api/src/test/java/com/hedera/fullstack/base/api/test/collections/KeyValuePairTest.java index 73dc610d3..c7a83ecf3 100644 --- a/fullstack-base-api/src/test/java/com/hedera/fullstack/base/api/test/collections/KeyValuePairTest.java +++ b/fullstack-base-api/src/test/java/com/hedera/fullstack/base/api/test/collections/KeyValuePairTest.java @@ -28,7 +28,7 @@ public class KeyValuePairTest { void testKeyValuePair() { KeyValuePair kvp1 = new KeyValuePair<>("key", "value"); KeyValuePair kvp1v2 = new KeyValuePair<>("key", "value2"); - assertThat(kvp1).isNotEqualTo(kvp1v2); + assertThat(kvp1).isEqualTo(kvp1v2); assertThat(kvp1.hashCode()).isEqualTo(kvp1v2.hashCode()); } }