From 6174c7991a846fc54dbc1820af1cb78e9fe84055 Mon Sep 17 00:00:00 2001 From: Piotr Findeisen Date: Wed, 10 Jan 2024 21:16:34 +0100 Subject: [PATCH] Fix map assertion in TestLazyMap `org.testng.Assert.assertEquals(Map, Map)` does not really check map equality when the actual map contains null values. Migrate to AssertJ and fix the test. --- .../test/java/io/trino/plugin/hive/util/TestLazyMap.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugin/trino-hive/src/test/java/io/trino/plugin/hive/util/TestLazyMap.java b/plugin/trino-hive/src/test/java/io/trino/plugin/hive/util/TestLazyMap.java index 6fbe9fffc81e..34bf2bd0bf20 100644 --- a/plugin/trino-hive/src/test/java/io/trino/plugin/hive/util/TestLazyMap.java +++ b/plugin/trino-hive/src/test/java/io/trino/plugin/hive/util/TestLazyMap.java @@ -28,7 +28,7 @@ import static org.apache.hadoop.hive.serde2.lazy.LazyFactory.createLazyObject; import static org.apache.hadoop.hive.serde2.lazy.objectinspector.LazyObjectInspectorFactory.getLazySimpleMapObjectInspector; import static org.apache.hadoop.hive.serde2.lazy.objectinspector.primitive.LazyPrimitiveObjectInspectorFactory.getLazyStringObjectInspector; -import static org.testng.Assert.assertEquals; +import static org.assertj.core.api.Assertions.assertThat; public class TestLazyMap { @@ -45,7 +45,7 @@ public void test() assertMapDecode("\\N\u0003ignored\u0002\u0003", ImmutableMap.of(lazyString(""), lazyString(""))); HashMap expectedMap = new HashMap<>(); - expectedMap.put("null", null); + expectedMap.put(lazyString("null"), null); assertMapDecode("\\N\u0003ignored\u0002null\u0003\\N", expectedMap); } @@ -63,7 +63,7 @@ public static void assertMapDecode(String encodedMap, Map map = lazyMap.getMap(); - assertEquals(map, expectedMap); + assertThat(map).isEqualTo(expectedMap); } private static LazyString lazyString(String string)