diff --git a/pom.xml b/pom.xml index 448c411..ba523d2 100644 --- a/pom.xml +++ b/pom.xml @@ -36,8 +36,8 @@ - 17 - 17.0.6 + 21 + 21.0.1 ${project.basedir} @@ -47,23 +47,22 @@ true false - 435 + 436 239 2.2 - 1.33.0 + 1.34.1 1.32.0 ${dep.airlift.version} - 32.1.3-jre + 33.0.0-jre 7.0.0 - 2.23.0 - 2.16.0 - 7.8.0 - 2.12.5 + 2.24.1 + 2.16.1 + 2.12.6 5.10.1 - 2.0.9 - 3.24.2 + 2.0.11 + 3.25.1 1.4.14 - 3.1.2 + 3.2.5 -missing github @@ -81,7 +80,7 @@ org.jetbrains.kotlin kotlin-bom - 1.9.21 + 1.9.22 pom import @@ -248,9 +247,14 @@ - org.testng - testng - ${dep.testng.version} + org.junit.jupiter + junit-jupiter + test + + + + org.junit.jupiter + junit-jupiter-api test @@ -339,29 +343,6 @@ - - - org.apache.maven.plugins - maven-surefire-plugin - - - - org.apache.maven.surefire - surefire-junit-platform - ${dep.plugin.surefire.version} - - - org.apache.maven.surefire - surefire-testng - ${dep.plugin.surefire.version} - - - org.junit.jupiter - junit-jupiter-engine - ${dep.junit.version} - - - diff --git a/src/test/java/pl/net/was/trino/git/TestGitClient.java b/src/test/java/pl/net/was/trino/git/TestGitClient.java index 5009274..994ae45 100644 --- a/src/test/java/pl/net/was/trino/git/TestGitClient.java +++ b/src/test/java/pl/net/was/trino/git/TestGitClient.java @@ -18,7 +18,7 @@ import org.eclipse.jgit.lib.PersonIdent; import org.eclipse.jgit.lib.Repository; import org.eclipse.jgit.storage.file.FileRepositoryBuilder; -import org.testng.annotations.Test; +import org.junit.jupiter.api.Test; import java.io.File; import java.io.IOException; @@ -28,10 +28,10 @@ import java.nio.file.Path; import java.util.Comparator; import java.util.Date; -import java.util.List; +import java.util.Set; import java.util.TimeZone; -import static org.testng.Assert.assertEquals; +import static org.assertj.core.api.Assertions.assertThat; public class TestGitClient { @@ -39,7 +39,7 @@ public class TestGitClient public void testMetadata() { GitClient client = new GitClient(new GitConfig()); - assertEquals(client.getSchemaNames(), List.of("default")); + assertThat(client.getSchemaNames()).isEqualTo(Set.of("default")); } public static void setupRepo(URI uri) @@ -63,7 +63,7 @@ public static void setupRepo(URI uri) Repository repository = FileRepositoryBuilder.create(new File(localPath, ".git")); repository.create(); - // create a new file file + // create a new file File myFile = new File(repository.getDirectory().getParent(), "testfile"); if (!myFile.createNewFile()) { throw new IOException("Could not create file " + myFile); diff --git a/src/test/java/pl/net/was/trino/git/TestGitMetadata.java b/src/test/java/pl/net/was/trino/git/TestGitMetadata.java index 47f6f1f..4fde6bd 100644 --- a/src/test/java/pl/net/was/trino/git/TestGitMetadata.java +++ b/src/test/java/pl/net/was/trino/git/TestGitMetadata.java @@ -21,8 +21,10 @@ import io.trino.spi.connector.TableNotFoundException; import io.trino.spi.type.ArrayType; import org.eclipse.jgit.api.errors.GitAPIException; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.parallel.Execution; +import org.junit.jupiter.api.parallel.ExecutionMode; import java.io.IOException; import java.net.URI; @@ -37,17 +39,16 @@ import static io.trino.spi.type.VarcharType.createUnboundedVarcharType; import static io.trino.testing.TestingConnectorSession.SESSION; import static org.assertj.core.api.Assertions.assertThat; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertNull; -import static org.testng.Assert.fail; +import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.assertj.core.api.Assertions.fail; -@Test(singleThreaded = true) +@Execution(ExecutionMode.SAME_THREAD) public class TestGitMetadata { private GitTableHandle commitsTableHandle; private GitMetadata metadata; - @BeforeMethod + @BeforeEach public void setUp() throws IOException, GitAPIException, URISyntaxException { @@ -71,27 +72,25 @@ public void testListSchemaNames() @Test public void testGetTableHandle() { - assertNull(metadata.getTableHandle(SESSION, new SchemaTableName("example", "unknown"))); - assertNull(metadata.getTableHandle(SESSION, new SchemaTableName("unknown", "numbers"))); - assertNull(metadata.getTableHandle(SESSION, new SchemaTableName("unknown", "unknown"))); + assertThat(metadata.getTableHandle(SESSION, new SchemaTableName("example", "unknown"))).isNull(); + assertThat(metadata.getTableHandle(SESSION, new SchemaTableName("unknown", "numbers"))).isNull(); + assertThat(metadata.getTableHandle(SESSION, new SchemaTableName("unknown", "unknown"))).isNull(); } @Test public void testGetColumnHandles() { // known table - assertEquals( - metadata.getColumnHandles(SESSION, commitsTableHandle), - Map.of( - "object_id", new GitColumnHandle("object_id", createUnboundedVarcharType(), 0), - "author_name", new GitColumnHandle("author_name", createUnboundedVarcharType(), 1), - "author_email", new GitColumnHandle("author_email", createUnboundedVarcharType(), 2), - "committer_name", new GitColumnHandle("committer_name", createUnboundedVarcharType(), 3), - "committer_email", new GitColumnHandle("committer_email", createUnboundedVarcharType(), 4), - "message", new GitColumnHandle("message", createUnboundedVarcharType(), 5), - "parents", new GitColumnHandle("parents", new ArrayType(createUnboundedVarcharType()), 6), - "tree_id", new GitColumnHandle("tree_id", createUnboundedVarcharType(), 7), - "commit_time", new GitColumnHandle("commit_time", createTimestampWithTimeZoneType(0), 8))); + assertThat(metadata.getColumnHandles(SESSION, commitsTableHandle)).isEqualTo(Map.of( + "object_id", new GitColumnHandle("object_id", createUnboundedVarcharType(), 0), + "author_name", new GitColumnHandle("author_name", createUnboundedVarcharType(), 1), + "author_email", new GitColumnHandle("author_email", createUnboundedVarcharType(), 2), + "committer_name", new GitColumnHandle("committer_name", createUnboundedVarcharType(), 3), + "committer_email", new GitColumnHandle("committer_email", createUnboundedVarcharType(), 4), + "message", new GitColumnHandle("message", createUnboundedVarcharType(), 5), + "parents", new GitColumnHandle("parents", new ArrayType(createUnboundedVarcharType()), 6), + "tree_id", new GitColumnHandle("tree_id", createUnboundedVarcharType(), 7), + "commit_time", new GitColumnHandle("commit_time", createTimestampWithTimeZoneType(0), 8))); // unknown table try { @@ -107,39 +106,35 @@ public void getTableMetadata() { // known table ConnectorTableMetadata tableMetadata = metadata.getTableMetadata(SESSION, commitsTableHandle); - assertEquals(tableMetadata.getTable().getSchemaName(), "default"); - assertEquals( - tableMetadata.getColumns(), - List.of( - new ColumnMetadata("object_id", createUnboundedVarcharType()), - new ColumnMetadata("author_name", createUnboundedVarcharType()), - new ColumnMetadata("author_email", createUnboundedVarcharType()), - new ColumnMetadata("committer_name", createUnboundedVarcharType()), - new ColumnMetadata("committer_email", createUnboundedVarcharType()), - new ColumnMetadata("message", createUnboundedVarcharType()), - new ColumnMetadata("parents", new ArrayType(createUnboundedVarcharType())), - new ColumnMetadata("tree_id", createUnboundedVarcharType()), - new ColumnMetadata("commit_time", createTimestampWithTimeZoneType(0)))); + assertThat(tableMetadata.getTable().getSchemaName()).isEqualTo("default"); + assertThat(tableMetadata.getColumns()).isEqualTo(List.of( + new ColumnMetadata("object_id", createUnboundedVarcharType()), + new ColumnMetadata("author_name", createUnboundedVarcharType()), + new ColumnMetadata("author_email", createUnboundedVarcharType()), + new ColumnMetadata("committer_name", createUnboundedVarcharType()), + new ColumnMetadata("committer_email", createUnboundedVarcharType()), + new ColumnMetadata("message", createUnboundedVarcharType()), + new ColumnMetadata("parents", new ArrayType(createUnboundedVarcharType())), + new ColumnMetadata("tree_id", createUnboundedVarcharType()), + new ColumnMetadata("commit_time", createTimestampWithTimeZoneType(0)))); // unknown tables should produce null - assertNull(metadata.getTableMetadata(SESSION, new GitTableHandle("unknown", "unknown", Optional.empty(), OptionalLong.empty()))); - assertNull(metadata.getTableMetadata(SESSION, new GitTableHandle("example", "unknown", Optional.empty(), OptionalLong.empty()))); - assertNull(metadata.getTableMetadata(SESSION, new GitTableHandle("unknown", "numbers", Optional.empty(), OptionalLong.empty()))); + assertThat(metadata.getTableMetadata(SESSION, new GitTableHandle("unknown", "unknown", Optional.empty(), OptionalLong.empty()))).isNull(); + assertThat(metadata.getTableMetadata(SESSION, new GitTableHandle("example", "unknown", Optional.empty(), OptionalLong.empty()))).isNull(); + assertThat(metadata.getTableMetadata(SESSION, new GitTableHandle("unknown", "numbers", Optional.empty(), OptionalLong.empty()))).isNull(); } @Test public void testListTables() { // all schemas - assertEquals( - Set.copyOf(metadata.listTables(SESSION, Optional.empty())), - Set.of( - new SchemaTableName("default", "commits"), - new SchemaTableName("default", "branches"), - new SchemaTableName("default", "diff_stats"), - new SchemaTableName("default", "objects"), - new SchemaTableName("default", "tags"), - new SchemaTableName("default", "trees"))); + assertThat(Set.copyOf(metadata.listTables(SESSION, Optional.empty()))).isEqualTo(Set.of( + new SchemaTableName("default", "commits"), + new SchemaTableName("default", "branches"), + new SchemaTableName("default", "diff_stats"), + new SchemaTableName("default", "objects"), + new SchemaTableName("default", "tags"), + new SchemaTableName("default", "trees"))); // unknown schema try { @@ -153,10 +148,9 @@ public void testListTables() @Test public void getColumnMetadata() { - assertEquals( - metadata.getColumnMetadata(SESSION, commitsTableHandle, - new GitColumnHandle("text", createUnboundedVarcharType(), 0)), - new ColumnMetadata("text", createUnboundedVarcharType())); + ColumnMetadata actualColumn = metadata.getColumnMetadata(SESSION, commitsTableHandle, + new GitColumnHandle("text", createUnboundedVarcharType(), 0)); + assertThat(actualColumn).isEqualTo(new ColumnMetadata("text", createUnboundedVarcharType())); // example connector assumes that the table handle and column handle are // properly formed, so it will return a metadata object for any @@ -165,20 +159,20 @@ public void getColumnMetadata() // directly. } - @Test(expectedExceptions = TrinoException.class) + @Test public void testCreateTable() { - metadata.createTable( + assertThatThrownBy(() -> metadata.createTable( SESSION, new ConnectorTableMetadata( new SchemaTableName("example", "foo"), List.of(new ColumnMetadata("text", createUnboundedVarcharType()))), - false); + false)).isInstanceOf(TrinoException.class); } - @Test(expectedExceptions = TrinoException.class) + @Test public void testDropTableTable() { - metadata.dropTable(SESSION, commitsTableHandle); + assertThatThrownBy(() -> metadata.dropTable(SESSION, commitsTableHandle)).isInstanceOf(TrinoException.class); } } diff --git a/src/test/java/pl/net/was/trino/git/TestGitRecordSet.java b/src/test/java/pl/net/was/trino/git/TestGitRecordSet.java index 7fbeea1..1fd0577 100644 --- a/src/test/java/pl/net/was/trino/git/TestGitRecordSet.java +++ b/src/test/java/pl/net/was/trino/git/TestGitRecordSet.java @@ -19,8 +19,8 @@ import io.trino.spi.type.TimestampWithTimeZoneType; import io.trino.spi.type.VarbinaryType; import org.eclipse.jgit.api.errors.GitAPIException; -import org.testng.annotations.BeforeSuite; -import org.testng.annotations.Test; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; import java.io.IOException; import java.net.URI; @@ -31,15 +31,14 @@ import java.util.OptionalLong; import static io.trino.spi.type.VarcharType.createUnboundedVarcharType; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertFalse; +import static org.assertj.core.api.Assertions.assertThat; public class TestGitRecordSet { private static final URI uri = URI.create("fake.invalid"); - @BeforeSuite - public void setUp() + @BeforeAll + public static void setUp() throws IOException, GitAPIException { TestGitClient.setupRepo(uri); @@ -53,21 +52,21 @@ public void testGetColumnTypes() RecordSet recordSet = new GitRecordSet(split, table, List.of( new GitColumnHandle("object_id", createUnboundedVarcharType(), 0), new GitColumnHandle("author_name", createUnboundedVarcharType(), 1))); - assertEquals(recordSet.getColumnTypes(), List.of(createUnboundedVarcharType(), createUnboundedVarcharType())); + assertThat(recordSet.getColumnTypes()).isEqualTo(List.of(createUnboundedVarcharType(), createUnboundedVarcharType())); recordSet = new GitRecordSet(split, table, List.of( new GitColumnHandle("object_id", createUnboundedVarcharType(), 1), new GitColumnHandle("author_name", createUnboundedVarcharType(), 0))); - assertEquals(recordSet.getColumnTypes(), List.of(createUnboundedVarcharType(), createUnboundedVarcharType())); + assertThat(recordSet.getColumnTypes()).isEqualTo(List.of(createUnboundedVarcharType(), createUnboundedVarcharType())); recordSet = new GitRecordSet(split, table, List.of( new GitColumnHandle("object_id", createUnboundedVarcharType(), 1), new GitColumnHandle("author_name", createUnboundedVarcharType(), 1), new GitColumnHandle("author_email", createUnboundedVarcharType(), 0))); - assertEquals(recordSet.getColumnTypes(), List.of(createUnboundedVarcharType(), createUnboundedVarcharType(), createUnboundedVarcharType())); + assertThat(recordSet.getColumnTypes()).isEqualTo(List.of(createUnboundedVarcharType(), createUnboundedVarcharType(), createUnboundedVarcharType())); recordSet = new GitRecordSet(split, table, List.of()); - assertEquals(recordSet.getColumnTypes(), List.of()); + assertThat(recordSet.getColumnTypes()).isEmpty(); } @Test @@ -81,8 +80,8 @@ public void testCommitsCursorSimple() new GitColumnHandle("commit_time", TimestampWithTimeZoneType.TIMESTAMP_TZ_SECONDS, 2))); RecordCursor cursor = recordSet.cursor(); - assertEquals(cursor.getType(0), createUnboundedVarcharType()); - assertEquals(cursor.getType(1), createUnboundedVarcharType()); + assertThat(cursor.getType(0)).isEqualTo(createUnboundedVarcharType()); + assertThat(cursor.getType(1)).isEqualTo(createUnboundedVarcharType()); Map> data = new LinkedHashMap<>(); while (cursor.advanceNextPosition()) { @@ -90,7 +89,7 @@ public void testCommitsCursorSimple() cursor.getSlice(1).toStringUtf8(), cursor.getLong(2))); } - assertEquals(data, Map.of( + assertThat(data).isEqualTo(Map.of( "080dfdf0aac7d302dc31d57f62942bb6533944f7", List.of("test", 6475355394048000L), "c3b14e59f88d0d6597b98ee93cf61e7556d540a4", List.of("test", 6475355394048000L))); } @@ -105,16 +104,16 @@ public void testBranchesCursorSimple() new GitColumnHandle("name", createUnboundedVarcharType(), 1))); RecordCursor cursor = recordSet.cursor(); - assertEquals(cursor.getType(0), createUnboundedVarcharType()); - assertEquals(cursor.getType(1), createUnboundedVarcharType()); + assertThat(cursor.getType(0)).isEqualTo(createUnboundedVarcharType()); + assertThat(cursor.getType(1)).isEqualTo(createUnboundedVarcharType()); Map data = new LinkedHashMap<>(); while (cursor.advanceNextPosition()) { - assertFalse(cursor.isNull(0)); - assertFalse(cursor.isNull(1)); + assertThat(cursor.isNull(0)).isFalse(); + assertThat(cursor.isNull(1)).isFalse(); data.put(cursor.getSlice(0).toStringUtf8(), cursor.getSlice(1).toStringUtf8()); } - assertEquals(data, Map.of("c3b14e59f88d0d6597b98ee93cf61e7556d540a4", "refs/heads/master")); + assertThat(data).isEqualTo(Map.of("c3b14e59f88d0d6597b98ee93cf61e7556d540a4", "refs/heads/master")); } @Test @@ -127,16 +126,16 @@ public void testTagsCursorSimple() new GitColumnHandle("name", createUnboundedVarcharType(), 1))); RecordCursor cursor = recordSet.cursor(); - assertEquals(cursor.getType(0), createUnboundedVarcharType()); - assertEquals(cursor.getType(1), createUnboundedVarcharType()); + assertThat(cursor.getType(0)).isEqualTo(createUnboundedVarcharType()); + assertThat(cursor.getType(1)).isEqualTo(createUnboundedVarcharType()); Map data = new LinkedHashMap<>(); while (cursor.advanceNextPosition()) { - assertFalse(cursor.isNull(0)); - assertFalse(cursor.isNull(1)); + assertThat(cursor.isNull(0)).isFalse(); + assertThat(cursor.isNull(1)).isFalse(); data.put(cursor.getSlice(0).toStringUtf8(), cursor.getSlice(1).toStringUtf8()); } - assertEquals(data, Map.of("7afcc1aaeab61c3fd7f2b1b5df5178a823cbf77e", "refs/tags/tag_for_testing")); + assertThat(data).isEqualTo(Map.of("7afcc1aaeab61c3fd7f2b1b5df5178a823cbf77e", "refs/tags/tag_for_testing")); } @Test @@ -149,16 +148,16 @@ public void testTreesCursorSimple() new GitColumnHandle("object_id", createUnboundedVarcharType(), 1))); RecordCursor cursor = recordSet.cursor(); - assertEquals(cursor.getType(0), createUnboundedVarcharType()); - assertEquals(cursor.getType(1), createUnboundedVarcharType()); + assertThat(cursor.getType(0)).isEqualTo(createUnboundedVarcharType()); + assertThat(cursor.getType(1)).isEqualTo(createUnboundedVarcharType()); Map data = new LinkedHashMap<>(); while (cursor.advanceNextPosition()) { - assertFalse(cursor.isNull(0)); - assertFalse(cursor.isNull(1)); + assertThat(cursor.isNull(0)).isFalse(); + assertThat(cursor.isNull(1)).isFalse(); data.put(cursor.getSlice(0).toStringUtf8(), cursor.getSlice(1).toStringUtf8()); } - assertEquals(data, Map.of( + assertThat(data).isEqualTo(Map.of( "080dfdf0aac7d302dc31d57f62942bb6533944f7", "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", "c3b14e59f88d0d6597b98ee93cf61e7556d540a4", "5dd01c177f5d7d1be5346a5bc18a569a7410c2ef")); } @@ -173,18 +172,18 @@ public void testObjectsCursorSimple() new GitColumnHandle("contents", VarbinaryType.VARBINARY, 1))); RecordCursor cursor = recordSet.cursor(); - assertEquals(cursor.getType(0), createUnboundedVarcharType()); - assertEquals(cursor.getType(1), VarbinaryType.VARBINARY); + assertThat(cursor.getType(0)).isEqualTo(createUnboundedVarcharType()); + assertThat(cursor.getType(1)).isEqualTo(VarbinaryType.VARBINARY); Map data = new LinkedHashMap<>(); while (cursor.advanceNextPosition()) { - assertFalse(cursor.isNull(0)); - assertFalse(cursor.isNull(1)); + assertThat(cursor.isNull(0)).isFalse(); + assertThat(cursor.isNull(1)).isFalse(); String objectId = cursor.getSlice(0).toStringUtf8(); String contents = cursor.getSlice(1).toStringUtf8(); data.put(objectId, contents); } - assertEquals(data, Map.of( + assertThat(data).isEqualTo(Map.of( "5dd01c177f5d7d1be5346a5bc18a569a7410c2ef", "Hello, world!", "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", "")); } @@ -201,17 +200,17 @@ public void testDiffStatsCursorSimple() new GitColumnHandle("deleted_lines", IntegerType.INTEGER, 3))); RecordCursor cursor = recordSet.cursor(); - assertEquals(cursor.getType(0), createUnboundedVarcharType()); - assertEquals(cursor.getType(1), createUnboundedVarcharType()); - assertEquals(cursor.getType(2), IntegerType.INTEGER); - assertEquals(cursor.getType(3), IntegerType.INTEGER); + assertThat(cursor.getType(0)).isEqualTo(createUnboundedVarcharType()); + assertThat(cursor.getType(1)).isEqualTo(createUnboundedVarcharType()); + assertThat(cursor.getType(2)).isEqualTo(IntegerType.INTEGER); + assertThat(cursor.getType(3)).isEqualTo(IntegerType.INTEGER); Map> data = new LinkedHashMap<>(); while (cursor.advanceNextPosition()) { - assertFalse(cursor.isNull(0)); - assertFalse(cursor.isNull(1)); - assertFalse(cursor.isNull(2)); - assertFalse(cursor.isNull(3)); + assertThat(cursor.isNull(0)).isFalse(); + assertThat(cursor.isNull(1)).isFalse(); + assertThat(cursor.isNull(2)).isFalse(); + assertThat(cursor.isNull(3)).isFalse(); data.put( cursor.getSlice(0).toStringUtf8(), List.of( @@ -219,7 +218,7 @@ public void testDiffStatsCursorSimple() cursor.getLong(2), cursor.getLong(3))); } - assertEquals(data, Map.of( + assertThat(data).isEqualTo(Map.of( "c3b14e59f88d0d6597b98ee93cf61e7556d540a4", List.of( "080dfdf0aac7d302dc31d57f62942bb6533944f7", diff --git a/src/test/java/pl/net/was/trino/git/TestGitRecordSetProvider.java b/src/test/java/pl/net/was/trino/git/TestGitRecordSetProvider.java index 1ef0830..28e7833 100644 --- a/src/test/java/pl/net/was/trino/git/TestGitRecordSetProvider.java +++ b/src/test/java/pl/net/was/trino/git/TestGitRecordSetProvider.java @@ -17,8 +17,8 @@ import io.trino.spi.connector.RecordCursor; import io.trino.spi.connector.RecordSet; import org.eclipse.jgit.api.errors.GitAPIException; -import org.testng.annotations.BeforeSuite; -import org.testng.annotations.Test; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; import java.io.IOException; import java.net.URI; @@ -30,15 +30,14 @@ import static io.trino.spi.type.VarcharType.createUnboundedVarcharType; import static io.trino.testing.TestingConnectorSession.SESSION; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertNotNull; +import static org.assertj.core.api.Assertions.assertThat; public class TestGitRecordSetProvider { private static final URI uri = URI.create("fake.invalid"); - @BeforeSuite - public void setUp() + @BeforeAll + public static void setUp() throws IOException, GitAPIException { TestGitClient.setupRepo(uri); @@ -56,16 +55,16 @@ public void testGetRecordSet() List.of( new GitColumnHandle("object_id", createUnboundedVarcharType(), 0), new GitColumnHandle("author_name", createUnboundedVarcharType(), 1))); - assertNotNull(recordSet, "recordSet is null"); + assertThat(recordSet).isNotNull(); RecordCursor cursor = recordSet.cursor(); - assertNotNull(cursor, "cursor is null"); + assertThat(cursor).isNotNull(); Map data = new LinkedHashMap<>(); while (cursor.advanceNextPosition()) { data.put(cursor.getSlice(0).toStringUtf8(), cursor.getSlice(1).toStringUtf8()); } - assertEquals(data, ImmutableMap.builder() + assertThat(data).isEqualTo(ImmutableMap.builder() .put("080dfdf0aac7d302dc31d57f62942bb6533944f7", "test") .put("c3b14e59f88d0d6597b98ee93cf61e7556d540a4", "test") .build()); diff --git a/src/test/java/pl/net/was/trino/git/TestGitSplit.java b/src/test/java/pl/net/was/trino/git/TestGitSplit.java index c4dcb2c..ad8b2a4 100644 --- a/src/test/java/pl/net/was/trino/git/TestGitSplit.java +++ b/src/test/java/pl/net/was/trino/git/TestGitSplit.java @@ -14,15 +14,14 @@ package pl.net.was.trino.git; import io.airlift.json.JsonCodec; -import org.testng.annotations.Test; +import org.junit.jupiter.api.Test; import java.net.URI; import java.net.URISyntaxException; import java.util.Optional; import static io.airlift.json.JsonCodec.jsonCodec; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertTrue; +import static org.assertj.core.api.Assertions.assertThat; public class TestGitSplit { @@ -38,7 +37,7 @@ public void testAddresses() { URI testURI = new URI("url.invalid"); GitSplit httpSplit = new GitSplit("tableName", testURI, Optional.empty()); - assertTrue(httpSplit.isRemotelyAccessible()); + assertThat(httpSplit.isRemotelyAccessible()).isTrue(); } @Test @@ -47,8 +46,8 @@ public void testJsonRoundTrip() JsonCodec codec = jsonCodec(GitSplit.class); String json = codec.toJson(split); GitSplit copy = codec.fromJson(json); - assertEquals(copy.getTableName(), split.getTableName()); + assertThat(copy.getTableName()).isEqualTo(split.getTableName()); - assertTrue(copy.isRemotelyAccessible()); + assertThat(copy.isRemotelyAccessible()).isTrue(); } } diff --git a/src/test/java/pl/net/was/trino/git/TestGitTableHandle.java b/src/test/java/pl/net/was/trino/git/TestGitTableHandle.java index 60b4a32..e4edae4 100644 --- a/src/test/java/pl/net/was/trino/git/TestGitTableHandle.java +++ b/src/test/java/pl/net/was/trino/git/TestGitTableHandle.java @@ -15,13 +15,13 @@ import io.airlift.json.JsonCodec; import io.airlift.testing.EquivalenceTester; -import org.testng.annotations.Test; +import org.junit.jupiter.api.Test; import java.util.Optional; import java.util.OptionalLong; import static io.airlift.json.JsonCodec.jsonCodec; -import static org.testng.Assert.assertEquals; +import static org.assertj.core.api.Assertions.assertThat; public class TestGitTableHandle { @@ -33,7 +33,7 @@ public void testJsonRoundTrip() JsonCodec codec = jsonCodec(GitTableHandle.class); String json = codec.toJson(tableHandle); GitTableHandle copy = codec.fromJson(json); - assertEquals(copy, tableHandle); + assertThat(copy).isEqualTo(tableHandle); } @Test