From eefef22a5aeb047afe9ba067f9b5328d5e843883 Mon Sep 17 00:00:00 2001 From: aokolnychyi <aokolnychyi@apple.com> Date: Wed, 6 Dec 2023 12:15:08 -0800 Subject: [PATCH] Review --- .../org/apache/iceberg/util/TestStructLikeMap.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/core/src/test/java/org/apache/iceberg/util/TestStructLikeMap.java b/core/src/test/java/org/apache/iceberg/util/TestStructLikeMap.java index bd67d3cf0a95..f18c48eaa344 100644 --- a/core/src/test/java/org/apache/iceberg/util/TestStructLikeMap.java +++ b/core/src/test/java/org/apache/iceberg/util/TestStructLikeMap.java @@ -153,10 +153,14 @@ public void testKeysWithNulls() { @Test public void testEqualsAndHashCode() { Map<StructLike, String> map1 = StructLikeMap.create(STRUCT_TYPE); + Map<StructLike, String> map2 = StructLikeMap.create(STRUCT_TYPE); + + assertThat(map1).isEqualTo(map2); + assertThat(map1.hashCode()).isEqualTo(map2.hashCode()); + map1.put(CustomRow.of(1, null), "aaa"); map1.put(CustomRow.of(2, null), "bbb"); - Map<StructLike, String> map2 = StructLikeMap.create(STRUCT_TYPE); map2.put(Row.of(1, null), "aaa"); map2.put(Row.of(2, null), "bbb"); @@ -167,10 +171,14 @@ public void testEqualsAndHashCode() { @Test public void testKeyAndEntrySetEquality() { Map<StructLike, String> map1 = StructLikeMap.create(STRUCT_TYPE); + Map<StructLike, String> map2 = StructLikeMap.create(STRUCT_TYPE); + + assertThat(map1.keySet()).isEqualTo(map2.keySet()); + assertThat(map1.entrySet()).isEqualTo(map2.entrySet()); + map1.put(CustomRow.of(1, null), "aaa"); map1.put(CustomRow.of(2, null), "bbb"); - Map<StructLike, String> map2 = StructLikeMap.create(STRUCT_TYPE); map2.put(Row.of(1, null), "aaa"); map2.put(Row.of(2, null), "bbb");