From 3809b78256560ef11e4da2171916f0c016e6237e Mon Sep 17 00:00:00 2001 From: Martin Traverso Date: Fri, 7 Jul 2023 08:23:04 -0700 Subject: [PATCH] Migrate tests to JUnit --- .../java/io/trino/util/TestDateTimeUtils.java | 2 +- core/trino-server-main/pom.xml | 10 ++++++++-- .../src/test/java/io/trino/server/TestDummy.java | 2 +- lib/trino-array/pom.xml | 16 +++++++++++----- .../java/io/trino/array/TestBlockBigArray.java | 2 +- .../java/io/trino/array/TestBooleanBigArray.java | 2 +- .../java/io/trino/array/TestByteBigArray.java | 2 +- .../java/io/trino/array/TestDoubleBigArray.java | 2 +- .../java/io/trino/array/TestIntBigArray.java | 2 +- .../java/io/trino/array/TestLongBigArray.java | 2 +- .../java/io/trino/array/TestObjectBigArray.java | 2 +- .../java/io/trino/array/TestShortBigArray.java | 2 +- .../java/io/trino/array/TestSliceBigArray.java | 3 +-- .../geospatial/TestExtractSpatialInnerJoin.java | 2 +- .../geospatial/TestExtractSpatialLeftJoin.java | 2 +- .../dateformat/TestDateFormatParser.java | 2 +- .../plugin/thrift/TestThriftConnectorConfig.java | 2 +- .../plugin/thrift/TestThriftIndexPageSource.java | 2 +- .../io/trino/plugin/thrift/TestThriftPlugin.java | 2 +- plugin/trino-tpcds/pom.xml | 12 ++++++++++++ .../io/trino/plugin/tpcds/TestTpcdsConfig.java | 2 +- .../io/trino/plugin/tpcds/TestTpcdsMetadata.java | 2 +- .../tpcds/TestTpcdsMetadataStatistics.java | 2 +- plugin/trino-tpch/pom.xml | 12 ++++++++++++ .../io/trino/plugin/tpch/TestTpchMetadata.java | 2 +- 25 files changed, 64 insertions(+), 29 deletions(-) diff --git a/core/trino-main/src/test/java/io/trino/util/TestDateTimeUtils.java b/core/trino-main/src/test/java/io/trino/util/TestDateTimeUtils.java index 90c8a57ec009..edfc909f4146 100644 --- a/core/trino-main/src/test/java/io/trino/util/TestDateTimeUtils.java +++ b/core/trino-main/src/test/java/io/trino/util/TestDateTimeUtils.java @@ -13,7 +13,7 @@ */ package io.trino.util; -import org.testng.annotations.Test; +import org.junit.jupiter.api.Test; import java.time.DateTimeException; diff --git a/core/trino-server-main/pom.xml b/core/trino-server-main/pom.xml index b0856502ff2c..6bbaaa275ff9 100644 --- a/core/trino-server-main/pom.xml +++ b/core/trino-server-main/pom.xml @@ -31,8 +31,14 @@ - org.testng - testng + org.junit.jupiter + junit-jupiter-api + test + + + + org.junit.jupiter + junit-jupiter-engine test diff --git a/core/trino-server-main/src/test/java/io/trino/server/TestDummy.java b/core/trino-server-main/src/test/java/io/trino/server/TestDummy.java index dea00f6fd596..b560df431cb6 100644 --- a/core/trino-server-main/src/test/java/io/trino/server/TestDummy.java +++ b/core/trino-server-main/src/test/java/io/trino/server/TestDummy.java @@ -13,7 +13,7 @@ */ package io.trino.server; -import org.testng.annotations.Test; +import org.junit.jupiter.api.Test; public class TestDummy { diff --git a/lib/trino-array/pom.xml b/lib/trino-array/pom.xml index a95f8628dad7..72810c2696b1 100644 --- a/lib/trino-array/pom.xml +++ b/lib/trino-array/pom.xml @@ -45,20 +45,26 @@ - org.openjdk.jmh - jmh-core + org.junit.jupiter + junit-jupiter-api + test + + + + org.junit.jupiter + junit-jupiter-engine test org.openjdk.jmh - jmh-generator-annprocess + jmh-core test - org.testng - testng + org.openjdk.jmh + jmh-generator-annprocess test diff --git a/lib/trino-array/src/test/java/io/trino/array/TestBlockBigArray.java b/lib/trino-array/src/test/java/io/trino/array/TestBlockBigArray.java index edb9ffaac6d1..c748cae9018c 100644 --- a/lib/trino-array/src/test/java/io/trino/array/TestBlockBigArray.java +++ b/lib/trino-array/src/test/java/io/trino/array/TestBlockBigArray.java @@ -15,7 +15,7 @@ import io.trino.spi.block.Block; import io.trino.spi.block.IntArrayBlockBuilder; -import org.testng.annotations.Test; +import org.junit.jupiter.api.Test; import static io.airlift.slice.SizeOf.instanceSize; import static org.assertj.core.api.Assertions.assertThat; diff --git a/lib/trino-array/src/test/java/io/trino/array/TestBooleanBigArray.java b/lib/trino-array/src/test/java/io/trino/array/TestBooleanBigArray.java index 6906ccfa8464..b2d1930fb1e8 100644 --- a/lib/trino-array/src/test/java/io/trino/array/TestBooleanBigArray.java +++ b/lib/trino-array/src/test/java/io/trino/array/TestBooleanBigArray.java @@ -13,7 +13,7 @@ */ package io.trino.array; -import org.testng.annotations.Test; +import org.junit.jupiter.api.Test; import java.util.Arrays; diff --git a/lib/trino-array/src/test/java/io/trino/array/TestByteBigArray.java b/lib/trino-array/src/test/java/io/trino/array/TestByteBigArray.java index adb2a9a2ca45..73a2354a2e96 100644 --- a/lib/trino-array/src/test/java/io/trino/array/TestByteBigArray.java +++ b/lib/trino-array/src/test/java/io/trino/array/TestByteBigArray.java @@ -13,7 +13,7 @@ */ package io.trino.array; -import org.testng.annotations.Test; +import org.junit.jupiter.api.Test; import java.util.Arrays; diff --git a/lib/trino-array/src/test/java/io/trino/array/TestDoubleBigArray.java b/lib/trino-array/src/test/java/io/trino/array/TestDoubleBigArray.java index 65b2aab95b2e..a003f1ea4a63 100644 --- a/lib/trino-array/src/test/java/io/trino/array/TestDoubleBigArray.java +++ b/lib/trino-array/src/test/java/io/trino/array/TestDoubleBigArray.java @@ -13,7 +13,7 @@ */ package io.trino.array; -import org.testng.annotations.Test; +import org.junit.jupiter.api.Test; import java.util.Arrays; diff --git a/lib/trino-array/src/test/java/io/trino/array/TestIntBigArray.java b/lib/trino-array/src/test/java/io/trino/array/TestIntBigArray.java index 1880733c4f28..099f359b5213 100644 --- a/lib/trino-array/src/test/java/io/trino/array/TestIntBigArray.java +++ b/lib/trino-array/src/test/java/io/trino/array/TestIntBigArray.java @@ -13,7 +13,7 @@ */ package io.trino.array; -import org.testng.annotations.Test; +import org.junit.jupiter.api.Test; import java.util.Arrays; diff --git a/lib/trino-array/src/test/java/io/trino/array/TestLongBigArray.java b/lib/trino-array/src/test/java/io/trino/array/TestLongBigArray.java index a76c2f4f9d4f..14c8547a688f 100644 --- a/lib/trino-array/src/test/java/io/trino/array/TestLongBigArray.java +++ b/lib/trino-array/src/test/java/io/trino/array/TestLongBigArray.java @@ -13,7 +13,7 @@ */ package io.trino.array; -import org.testng.annotations.Test; +import org.junit.jupiter.api.Test; import java.util.Arrays; diff --git a/lib/trino-array/src/test/java/io/trino/array/TestObjectBigArray.java b/lib/trino-array/src/test/java/io/trino/array/TestObjectBigArray.java index d659e368610a..0f0550056b5c 100644 --- a/lib/trino-array/src/test/java/io/trino/array/TestObjectBigArray.java +++ b/lib/trino-array/src/test/java/io/trino/array/TestObjectBigArray.java @@ -13,7 +13,7 @@ */ package io.trino.array; -import org.testng.annotations.Test; +import org.junit.jupiter.api.Test; import java.util.Arrays; diff --git a/lib/trino-array/src/test/java/io/trino/array/TestShortBigArray.java b/lib/trino-array/src/test/java/io/trino/array/TestShortBigArray.java index 056846d14ace..d1c378df023c 100644 --- a/lib/trino-array/src/test/java/io/trino/array/TestShortBigArray.java +++ b/lib/trino-array/src/test/java/io/trino/array/TestShortBigArray.java @@ -13,7 +13,7 @@ */ package io.trino.array; -import org.testng.annotations.Test; +import org.junit.jupiter.api.Test; import java.util.Arrays; diff --git a/lib/trino-array/src/test/java/io/trino/array/TestSliceBigArray.java b/lib/trino-array/src/test/java/io/trino/array/TestSliceBigArray.java index 250d33e89c8f..c310a902ed4f 100644 --- a/lib/trino-array/src/test/java/io/trino/array/TestSliceBigArray.java +++ b/lib/trino-array/src/test/java/io/trino/array/TestSliceBigArray.java @@ -14,14 +14,13 @@ package io.trino.array; import io.airlift.slice.Slice; -import org.testng.annotations.Test; +import org.junit.jupiter.api.Test; import static io.airlift.slice.SizeOf.instanceSize; import static io.airlift.slice.SizeOf.sizeOf; import static io.airlift.slice.Slices.wrappedBuffer; import static org.assertj.core.api.Assertions.assertThat; -@Test public class TestSliceBigArray { private static final long BIG_ARRAY_INSTANCE_SIZE = instanceSize(SliceBigArray.class) + new ReferenceCountMap().sizeOf() + new ObjectBigArray().sizeOf(); diff --git a/plugin/trino-geospatial/src/test/java/io/trino/plugin/geospatial/TestExtractSpatialInnerJoin.java b/plugin/trino-geospatial/src/test/java/io/trino/plugin/geospatial/TestExtractSpatialInnerJoin.java index 3e1515735a3e..3aaa34cac155 100644 --- a/plugin/trino-geospatial/src/test/java/io/trino/plugin/geospatial/TestExtractSpatialInnerJoin.java +++ b/plugin/trino-geospatial/src/test/java/io/trino/plugin/geospatial/TestExtractSpatialInnerJoin.java @@ -19,7 +19,7 @@ import io.trino.sql.planner.iterative.rule.test.PlanBuilder; import io.trino.sql.planner.iterative.rule.test.RuleAssert; import io.trino.sql.planner.iterative.rule.test.RuleTester; -import org.testng.annotations.Test; +import org.junit.jupiter.api.Test; import static io.trino.plugin.geospatial.GeometryType.GEOMETRY; import static io.trino.plugin.geospatial.SphericalGeographyType.SPHERICAL_GEOGRAPHY; diff --git a/plugin/trino-geospatial/src/test/java/io/trino/plugin/geospatial/TestExtractSpatialLeftJoin.java b/plugin/trino-geospatial/src/test/java/io/trino/plugin/geospatial/TestExtractSpatialLeftJoin.java index 30715497e21a..712f464426bd 100644 --- a/plugin/trino-geospatial/src/test/java/io/trino/plugin/geospatial/TestExtractSpatialLeftJoin.java +++ b/plugin/trino-geospatial/src/test/java/io/trino/plugin/geospatial/TestExtractSpatialLeftJoin.java @@ -19,7 +19,7 @@ import io.trino.sql.planner.iterative.rule.test.BaseRuleTest; import io.trino.sql.planner.iterative.rule.test.RuleAssert; import io.trino.sql.planner.iterative.rule.test.RuleTester; -import org.testng.annotations.Test; +import org.junit.jupiter.api.Test; import static io.trino.plugin.geospatial.GeometryType.GEOMETRY; import static io.trino.plugin.geospatial.SphericalGeographyType.SPHERICAL_GEOGRAPHY; diff --git a/plugin/trino-teradata-functions/src/test/java/io/trino/plugin/teradata/functions/dateformat/TestDateFormatParser.java b/plugin/trino-teradata-functions/src/test/java/io/trino/plugin/teradata/functions/dateformat/TestDateFormatParser.java index 576d58e8a792..b34a466e2fb8 100644 --- a/plugin/trino-teradata-functions/src/test/java/io/trino/plugin/teradata/functions/dateformat/TestDateFormatParser.java +++ b/plugin/trino-teradata-functions/src/test/java/io/trino/plugin/teradata/functions/dateformat/TestDateFormatParser.java @@ -17,7 +17,7 @@ import org.antlr.v4.runtime.Token; import org.joda.time.DateTime; import org.joda.time.format.DateTimeFormatter; -import org.testng.annotations.Test; +import org.junit.jupiter.api.Test; import java.util.stream.Collectors; diff --git a/plugin/trino-thrift/src/test/java/io/trino/plugin/thrift/TestThriftConnectorConfig.java b/plugin/trino-thrift/src/test/java/io/trino/plugin/thrift/TestThriftConnectorConfig.java index bb5ab374b39c..63603f5d3efb 100644 --- a/plugin/trino-thrift/src/test/java/io/trino/plugin/thrift/TestThriftConnectorConfig.java +++ b/plugin/trino-thrift/src/test/java/io/trino/plugin/thrift/TestThriftConnectorConfig.java @@ -15,7 +15,7 @@ import com.google.common.collect.ImmutableMap; import io.airlift.units.DataSize; -import org.testng.annotations.Test; +import org.junit.jupiter.api.Test; import java.util.Map; diff --git a/plugin/trino-thrift/src/test/java/io/trino/plugin/thrift/TestThriftIndexPageSource.java b/plugin/trino-thrift/src/test/java/io/trino/plugin/thrift/TestThriftIndexPageSource.java index c07de8ad467e..1176b83a65e8 100644 --- a/plugin/trino-thrift/src/test/java/io/trino/plugin/thrift/TestThriftIndexPageSource.java +++ b/plugin/trino-thrift/src/test/java/io/trino/plugin/thrift/TestThriftIndexPageSource.java @@ -36,7 +36,7 @@ import io.trino.spi.connector.SchemaTableName; import io.trino.spi.predicate.TupleDomain; import io.trino.spi.type.Type; -import org.testng.annotations.Test; +import org.junit.jupiter.api.Test; import java.util.ArrayList; import java.util.Collections; diff --git a/plugin/trino-thrift/src/test/java/io/trino/plugin/thrift/TestThriftPlugin.java b/plugin/trino-thrift/src/test/java/io/trino/plugin/thrift/TestThriftPlugin.java index 9f2e0460f266..234c1114cf6a 100644 --- a/plugin/trino-thrift/src/test/java/io/trino/plugin/thrift/TestThriftPlugin.java +++ b/plugin/trino-thrift/src/test/java/io/trino/plugin/thrift/TestThriftPlugin.java @@ -18,7 +18,7 @@ import io.trino.spi.connector.Connector; import io.trino.spi.connector.ConnectorFactory; import io.trino.testing.TestingConnectorContext; -import org.testng.annotations.Test; +import org.junit.jupiter.api.Test; import java.util.Map; diff --git a/plugin/trino-tpcds/pom.xml b/plugin/trino-tpcds/pom.xml index 2271d8a4f8b4..c9484c67d937 100644 --- a/plugin/trino-tpcds/pom.xml +++ b/plugin/trino-tpcds/pom.xml @@ -158,6 +158,18 @@ test + + org.junit.jupiter + junit-jupiter-api + test + + + + org.junit.jupiter + junit-jupiter-engine + test + + org.testng testng diff --git a/plugin/trino-tpcds/src/test/java/io/trino/plugin/tpcds/TestTpcdsConfig.java b/plugin/trino-tpcds/src/test/java/io/trino/plugin/tpcds/TestTpcdsConfig.java index 6a63f6161cae..269b4f5cde98 100644 --- a/plugin/trino-tpcds/src/test/java/io/trino/plugin/tpcds/TestTpcdsConfig.java +++ b/plugin/trino-tpcds/src/test/java/io/trino/plugin/tpcds/TestTpcdsConfig.java @@ -14,7 +14,7 @@ package io.trino.plugin.tpcds; import com.google.common.collect.ImmutableMap; -import org.testng.annotations.Test; +import org.junit.jupiter.api.Test; import java.util.Map; diff --git a/plugin/trino-tpcds/src/test/java/io/trino/plugin/tpcds/TestTpcdsMetadata.java b/plugin/trino-tpcds/src/test/java/io/trino/plugin/tpcds/TestTpcdsMetadata.java index 36daad9921b5..bc7db459b59e 100644 --- a/plugin/trino-tpcds/src/test/java/io/trino/plugin/tpcds/TestTpcdsMetadata.java +++ b/plugin/trino-tpcds/src/test/java/io/trino/plugin/tpcds/TestTpcdsMetadata.java @@ -14,7 +14,7 @@ package io.trino.plugin.tpcds; import io.trino.spi.connector.ConnectorSession; -import org.testng.annotations.Test; +import org.junit.jupiter.api.Test; import static org.testng.Assert.assertFalse; import static org.testng.Assert.assertTrue; diff --git a/plugin/trino-tpcds/src/test/java/io/trino/plugin/tpcds/TestTpcdsMetadataStatistics.java b/plugin/trino-tpcds/src/test/java/io/trino/plugin/tpcds/TestTpcdsMetadataStatistics.java index 2d58c529a389..6b30b7d40372 100644 --- a/plugin/trino-tpcds/src/test/java/io/trino/plugin/tpcds/TestTpcdsMetadataStatistics.java +++ b/plugin/trino-tpcds/src/test/java/io/trino/plugin/tpcds/TestTpcdsMetadataStatistics.java @@ -25,7 +25,7 @@ import io.trino.tpcds.Table; import io.trino.tpcds.column.CallCenterColumn; import io.trino.tpcds.column.WebSiteColumn; -import org.testng.annotations.Test; +import org.junit.jupiter.api.Test; import java.util.Map; import java.util.stream.Stream; diff --git a/plugin/trino-tpch/pom.xml b/plugin/trino-tpch/pom.xml index 15cb129b3a08..deda345ec66d 100644 --- a/plugin/trino-tpch/pom.xml +++ b/plugin/trino-tpch/pom.xml @@ -78,6 +78,18 @@ provided + + org.junit.jupiter + junit-jupiter-api + test + + + + org.junit.jupiter + junit-jupiter-engine + test + + org.testng testng diff --git a/plugin/trino-tpch/src/test/java/io/trino/plugin/tpch/TestTpchMetadata.java b/plugin/trino-tpch/src/test/java/io/trino/plugin/tpch/TestTpchMetadata.java index 98fb17c351a4..b637c8cc69e9 100644 --- a/plugin/trino-tpch/src/test/java/io/trino/plugin/tpch/TestTpchMetadata.java +++ b/plugin/trino-tpch/src/test/java/io/trino/plugin/tpch/TestTpchMetadata.java @@ -32,7 +32,7 @@ import io.trino.tpch.PartColumn; import io.trino.tpch.TpchColumn; import io.trino.tpch.TpchTable; -import org.testng.annotations.Test; +import org.junit.jupiter.api.Test; import java.util.List; import java.util.Map;