From 13c38d5794891636d1b00e11e77665fa2357ffd7 Mon Sep 17 00:00:00 2001 From: MitchellGale-BitQuill <104795536+MitchellGale-BitQuill@users.noreply.github.com> Date: Thu, 19 May 2022 10:41:27 -0700 Subject: [PATCH] Integ replace junit assertthat with hamcrest import (#616) Many instances of org.junit.Assert.assertThat throughout OpenSearch-project-sql. That method is deprecated. Updated the tests to use org.hamcrest.MatcherAssert.assertThat Signed-off-by: Mitchell Gale --- .../org/opensearch/sql/correctness/tests/TestConfigTest.java | 2 +- .../org/opensearch/sql/correctness/tests/TestDataSetTest.java | 2 +- .../org/opensearch/sql/correctness/tests/TestQuerySetTest.java | 2 +- .../src/test/java/org/opensearch/sql/util/MatcherUtils.java | 2 +- .../sql/legacy/antlr/semantic/SemanticAnalyzerBasicTest.java | 2 +- .../sql/legacy/antlr/semantic/scope/EnvironmentTest.java | 2 +- .../sql/legacy/antlr/semantic/scope/SymbolTableTest.java | 2 +- .../sql/legacy/esdomain/mapping/FieldMappingTest.java | 2 +- .../sql/legacy/unittest/cursor/DefaultCursorTest.java | 2 +- .../legacy/unittest/expression/model/ExprValueUtilsTest.java | 2 +- .../test/java/org/opensearch/sql/legacy/util/MatcherUtils.java | 2 +- .../org/opensearch/sql/ppl/utils/UnresolvedPlanHelperTest.java | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) diff --git a/integ-test/src/test/java/org/opensearch/sql/correctness/tests/TestConfigTest.java b/integ-test/src/test/java/org/opensearch/sql/correctness/tests/TestConfigTest.java index 86edd0d201..c75bca15b1 100644 --- a/integ-test/src/test/java/org/opensearch/sql/correctness/tests/TestConfigTest.java +++ b/integ-test/src/test/java/org/opensearch/sql/correctness/tests/TestConfigTest.java @@ -11,7 +11,7 @@ import static org.hamcrest.Matchers.emptyString; import static org.hamcrest.Matchers.hasEntry; import static org.hamcrest.Matchers.is; -import static org.junit.Assert.assertThat; +import static org.hamcrest.MatcherAssert.assertThat; import com.google.common.collect.ImmutableMap; import java.util.Map; diff --git a/integ-test/src/test/java/org/opensearch/sql/correctness/tests/TestDataSetTest.java b/integ-test/src/test/java/org/opensearch/sql/correctness/tests/TestDataSetTest.java index 71b9d4de0a..284e167d6b 100644 --- a/integ-test/src/test/java/org/opensearch/sql/correctness/tests/TestDataSetTest.java +++ b/integ-test/src/test/java/org/opensearch/sql/correctness/tests/TestDataSetTest.java @@ -8,7 +8,7 @@ import static org.hamcrest.Matchers.contains; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertThat; +import static org.hamcrest.MatcherAssert.assertThat; import org.junit.Test; import org.opensearch.sql.correctness.testset.TestDataSet; diff --git a/integ-test/src/test/java/org/opensearch/sql/correctness/tests/TestQuerySetTest.java b/integ-test/src/test/java/org/opensearch/sql/correctness/tests/TestQuerySetTest.java index 452c82e5a0..8ad9e6b921 100644 --- a/integ-test/src/test/java/org/opensearch/sql/correctness/tests/TestQuerySetTest.java +++ b/integ-test/src/test/java/org/opensearch/sql/correctness/tests/TestQuerySetTest.java @@ -7,7 +7,7 @@ package org.opensearch.sql.correctness.tests; import static org.hamcrest.Matchers.contains; -import static org.junit.Assert.assertThat; +import static org.hamcrest.MatcherAssert.assertThat; import org.junit.Test; import org.opensearch.sql.correctness.testset.TestQuerySet; diff --git a/integ-test/src/test/java/org/opensearch/sql/util/MatcherUtils.java b/integ-test/src/test/java/org/opensearch/sql/util/MatcherUtils.java index 8c5be3d761..cfacefc2c6 100644 --- a/integ-test/src/test/java/org/opensearch/sql/util/MatcherUtils.java +++ b/integ-test/src/test/java/org/opensearch/sql/util/MatcherUtils.java @@ -17,7 +17,7 @@ import static org.hamcrest.Matchers.hasEntry; import static org.hamcrest.Matchers.hasItems; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertThat; +import static org.hamcrest.MatcherAssert.assertThat; import com.google.common.base.Strings; import com.google.gson.JsonParser; diff --git a/legacy/src/test/java/org/opensearch/sql/legacy/antlr/semantic/SemanticAnalyzerBasicTest.java b/legacy/src/test/java/org/opensearch/sql/legacy/antlr/semantic/SemanticAnalyzerBasicTest.java index d7d5eefb86..1d594db2bc 100644 --- a/legacy/src/test/java/org/opensearch/sql/legacy/antlr/semantic/SemanticAnalyzerBasicTest.java +++ b/legacy/src/test/java/org/opensearch/sql/legacy/antlr/semantic/SemanticAnalyzerBasicTest.java @@ -9,7 +9,7 @@ import static org.hamcrest.Matchers.aMapWithSize; import static org.hamcrest.Matchers.allOf; import static org.hamcrest.Matchers.hasEntry; -import static org.junit.Assert.assertThat; +import static org.hamcrest.MatcherAssert.assertThat; import static org.opensearch.sql.legacy.antlr.semantic.types.base.OpenSearchDataType.BOOLEAN; import static org.opensearch.sql.legacy.antlr.semantic.types.base.OpenSearchDataType.DATE; import static org.opensearch.sql.legacy.antlr.semantic.types.base.OpenSearchDataType.DOUBLE; diff --git a/legacy/src/test/java/org/opensearch/sql/legacy/antlr/semantic/scope/EnvironmentTest.java b/legacy/src/test/java/org/opensearch/sql/legacy/antlr/semantic/scope/EnvironmentTest.java index cf3b813afb..dfc49ad2fb 100644 --- a/legacy/src/test/java/org/opensearch/sql/legacy/antlr/semantic/scope/EnvironmentTest.java +++ b/legacy/src/test/java/org/opensearch/sql/legacy/antlr/semantic/scope/EnvironmentTest.java @@ -9,7 +9,7 @@ import static org.hamcrest.Matchers.aMapWithSize; import static org.hamcrest.Matchers.allOf; import static org.hamcrest.Matchers.hasEntry; -import static org.junit.Assert.assertThat; +import static org.hamcrest.MatcherAssert.assertThat; import static org.opensearch.sql.legacy.antlr.semantic.types.base.OpenSearchDataType.BOOLEAN; import static org.opensearch.sql.legacy.antlr.semantic.types.base.OpenSearchDataType.DATE; import static org.opensearch.sql.legacy.antlr.semantic.types.base.OpenSearchDataType.KEYWORD; diff --git a/legacy/src/test/java/org/opensearch/sql/legacy/antlr/semantic/scope/SymbolTableTest.java b/legacy/src/test/java/org/opensearch/sql/legacy/antlr/semantic/scope/SymbolTableTest.java index 0d41aecd40..3ccc75da62 100644 --- a/legacy/src/test/java/org/opensearch/sql/legacy/antlr/semantic/scope/SymbolTableTest.java +++ b/legacy/src/test/java/org/opensearch/sql/legacy/antlr/semantic/scope/SymbolTableTest.java @@ -9,7 +9,7 @@ import static org.hamcrest.Matchers.aMapWithSize; import static org.hamcrest.Matchers.allOf; import static org.hamcrest.Matchers.hasEntry; -import static org.junit.Assert.assertThat; +import static org.hamcrest.MatcherAssert.assertThat; import static org.opensearch.sql.legacy.antlr.semantic.types.base.OpenSearchDataType.BOOLEAN; import static org.opensearch.sql.legacy.antlr.semantic.types.base.OpenSearchDataType.DATE; import static org.opensearch.sql.legacy.antlr.semantic.types.base.OpenSearchDataType.KEYWORD; diff --git a/legacy/src/test/java/org/opensearch/sql/legacy/esdomain/mapping/FieldMappingTest.java b/legacy/src/test/java/org/opensearch/sql/legacy/esdomain/mapping/FieldMappingTest.java index 4d2fa13e30..6821261420 100644 --- a/legacy/src/test/java/org/opensearch/sql/legacy/esdomain/mapping/FieldMappingTest.java +++ b/legacy/src/test/java/org/opensearch/sql/legacy/esdomain/mapping/FieldMappingTest.java @@ -8,7 +8,7 @@ import static java.util.Collections.emptyMap; import static org.hamcrest.Matchers.is; -import static org.junit.Assert.assertThat; +import static org.hamcrest.MatcherAssert.assertThat; import static org.opensearch.action.admin.indices.mapping.get.GetFieldMappingsResponse.FieldMappingMetadata; import com.google.common.collect.ImmutableMap; diff --git a/legacy/src/test/java/org/opensearch/sql/legacy/unittest/cursor/DefaultCursorTest.java b/legacy/src/test/java/org/opensearch/sql/legacy/unittest/cursor/DefaultCursorTest.java index 3fb5876470..cfb70dc83c 100644 --- a/legacy/src/test/java/org/opensearch/sql/legacy/unittest/cursor/DefaultCursorTest.java +++ b/legacy/src/test/java/org/opensearch/sql/legacy/unittest/cursor/DefaultCursorTest.java @@ -9,7 +9,7 @@ import static org.hamcrest.Matchers.emptyOrNullString; import static org.hamcrest.Matchers.startsWith; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertThat; +import static org.hamcrest.MatcherAssert.assertThat; import java.util.ArrayList; import java.util.Collections; diff --git a/legacy/src/test/java/org/opensearch/sql/legacy/unittest/expression/model/ExprValueUtilsTest.java b/legacy/src/test/java/org/opensearch/sql/legacy/unittest/expression/model/ExprValueUtilsTest.java index 599eb21755..150afcacd3 100644 --- a/legacy/src/test/java/org/opensearch/sql/legacy/unittest/expression/model/ExprValueUtilsTest.java +++ b/legacy/src/test/java/org/opensearch/sql/legacy/unittest/expression/model/ExprValueUtilsTest.java @@ -7,7 +7,7 @@ package org.opensearch.sql.legacy.unittest.expression.model; import static org.hamcrest.Matchers.equalTo; -import static org.junit.Assert.assertThat; +import static org.hamcrest.MatcherAssert.assertThat; import org.junit.Rule; import org.junit.Test; diff --git a/legacy/src/test/java/org/opensearch/sql/legacy/util/MatcherUtils.java b/legacy/src/test/java/org/opensearch/sql/legacy/util/MatcherUtils.java index 05f25a4f97..84f19de58b 100644 --- a/legacy/src/test/java/org/opensearch/sql/legacy/util/MatcherUtils.java +++ b/legacy/src/test/java/org/opensearch/sql/legacy/util/MatcherUtils.java @@ -17,7 +17,7 @@ import static org.hamcrest.Matchers.hasEntry; import static org.hamcrest.Matchers.hasItems; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertThat; +import static org.hamcrest.MatcherAssert.assertThat; import com.google.common.base.Strings; import java.util.ArrayList; diff --git a/ppl/src/test/java/org/opensearch/sql/ppl/utils/UnresolvedPlanHelperTest.java b/ppl/src/test/java/org/opensearch/sql/ppl/utils/UnresolvedPlanHelperTest.java index 04e3b17d0a..d64c8d5db4 100644 --- a/ppl/src/test/java/org/opensearch/sql/ppl/utils/UnresolvedPlanHelperTest.java +++ b/ppl/src/test/java/org/opensearch/sql/ppl/utils/UnresolvedPlanHelperTest.java @@ -6,7 +6,7 @@ package org.opensearch.sql.ppl.utils; -import static org.junit.Assert.assertThat; +import static org.hamcrest.MatcherAssert.assertThat; import static org.mockito.Mockito.when; import java.util.Arrays;