vinitpatni commented on code in PR #9364: URL: https://github.com/apache/iceberg/pull/9364#discussion_r1435274208
########## flink/v1.18/flink/src/test/java/org/apache/iceberg/flink/TestFlinkCatalogDatabase.java: ########## @@ -29,88 +29,93 @@ import org.apache.iceberg.catalog.TableIdentifier; import org.apache.iceberg.types.Types; import org.assertj.core.api.Assertions; -import org.junit.After; -import org.junit.Assert; -import org.junit.Assume; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Assumptions; +import org.junit.jupiter.api.TestTemplate; -public class TestFlinkCatalogDatabase extends FlinkCatalogTestBase { +public class TestFlinkCatalogDatabase extends CatalogTestBase { - public TestFlinkCatalogDatabase(String catalogName, Namespace baseNamespace) { - super(catalogName, baseNamespace); - } - - @After + @AfterEach @Override public void clean() { sql("DROP TABLE IF EXISTS %s.tl", flinkDatabase); sql("DROP DATABASE IF EXISTS %s", flinkDatabase); super.clean(); } - @Test + @TestTemplate public void testCreateNamespace() { - Assert.assertFalse( - "Database should not already exist", - validationNamespaceCatalog.namespaceExists(icebergNamespace)); - + Assertions.assertThat(validationNamespaceCatalog.namespaceExists(icebergNamespace)) + .as("Database should not already exist") + .isFalse(); sql("CREATE DATABASE %s", flinkDatabase); - Assert.assertTrue( - "Database should exist", validationNamespaceCatalog.namespaceExists(icebergNamespace)); + Assertions.assertThat(validationNamespaceCatalog.namespaceExists(icebergNamespace)) + .as("Database should exist") + .isTrue(); sql("CREATE DATABASE IF NOT EXISTS %s", flinkDatabase); - Assert.assertTrue( - "Database should still exist", - validationNamespaceCatalog.namespaceExists(icebergNamespace)); + + Assertions.assertThat(validationNamespaceCatalog.namespaceExists(icebergNamespace)) + .as("Database should still exist") + .isTrue(); sql("DROP DATABASE IF EXISTS %s", flinkDatabase); - Assert.assertFalse( - "Database should be dropped", validationNamespaceCatalog.namespaceExists(icebergNamespace)); + + Assertions.assertThat(validationNamespaceCatalog.namespaceExists(icebergNamespace)) + .as("Database should be dropped") + .isFalse(); sql("CREATE DATABASE IF NOT EXISTS %s", flinkDatabase); - Assert.assertTrue( - "Database should be created", validationNamespaceCatalog.namespaceExists(icebergNamespace)); + + Assertions.assertThat(validationNamespaceCatalog.namespaceExists(icebergNamespace)) + .as("Database should be created") + .isTrue(); } - @Test + @TestTemplate public void testDropEmptyDatabase() { - Assert.assertFalse( - "Namespace should not already exist", - validationNamespaceCatalog.namespaceExists(icebergNamespace)); + + Assertions.assertThat(validationNamespaceCatalog.namespaceExists(icebergNamespace)) + .as("Namespace should not already exist") + .isFalse(); sql("CREATE DATABASE %s", flinkDatabase); - Assert.assertTrue( - "Namespace should exist", validationNamespaceCatalog.namespaceExists(icebergNamespace)); + Assertions.assertThat(validationNamespaceCatalog.namespaceExists(icebergNamespace)) + .as("Namespace should exist") + .isTrue(); sql("DROP DATABASE %s", flinkDatabase); - Assert.assertFalse( - "Namespace should have been dropped", - validationNamespaceCatalog.namespaceExists(icebergNamespace)); + Assertions.assertThat(validationNamespaceCatalog.namespaceExists(icebergNamespace)) + .as("Namespace should have been dropped") + .isFalse(); } - @Test + @TestTemplate public void testDropNonEmptyNamespace() { - Assume.assumeFalse( - "Hadoop catalog throws IOException: Directory is not empty.", isHadoopCatalog); - Assert.assertFalse( - "Namespace should not already exist", - validationNamespaceCatalog.namespaceExists(icebergNamespace)); + Assumptions.assumeFalse( Review Comment: ack ########## flink/v1.18/flink/src/test/java/org/apache/iceberg/flink/TestFlinkCatalogDatabase.java: ########## @@ -121,166 +126,194 @@ public void testDropNonEmptyNamespace() { sql("DROP TABLE %s.tl", flinkDatabase); } - @Test + @TestTemplate public void testListTables() { - Assert.assertFalse( - "Namespace should not already exist", - validationNamespaceCatalog.namespaceExists(icebergNamespace)); + + Assertions.assertThat(validationNamespaceCatalog.namespaceExists(icebergNamespace)) + .as("Namespace should not already exist") + .isFalse(); sql("CREATE DATABASE %s", flinkDatabase); sql("USE CATALOG %s", catalogName); sql("USE %s", DATABASE); - Assert.assertTrue( - "Namespace should exist", validationNamespaceCatalog.namespaceExists(icebergNamespace)); + Assertions.assertThat(validationNamespaceCatalog.namespaceExists(icebergNamespace)) + .as("Namespace should exist") + .isTrue(); - Assert.assertEquals("Should not list any tables", 0, sql("SHOW TABLES").size()); + Assertions.assertThat(sql("SHOW TABLES").size()).as("Should not list any tables").isEqualTo(0); validationCatalog.createTable( TableIdentifier.of(icebergNamespace, "tl"), new Schema(Types.NestedField.optional(0, "id", Types.LongType.get()))); List<Row> tables = sql("SHOW TABLES"); - Assert.assertEquals("Only 1 table", 1, tables.size()); - Assert.assertEquals("Table name should match", "tl", tables.get(0).getField(0)); + Assertions.assertThat(tables.size()).as("Only 1 table").isEqualTo(1); + Assertions.assertThat("tl").as("Table name should match").isEqualTo(tables.get(0).getField(0)); } - @Test + @TestTemplate public void testListNamespace() { - Assert.assertFalse( - "Namespace should not already exist", - validationNamespaceCatalog.namespaceExists(icebergNamespace)); + Assertions.assertThat(validationNamespaceCatalog.namespaceExists(icebergNamespace)) + .as("Namespace should not already exist") + .isFalse(); sql("CREATE DATABASE %s", flinkDatabase); sql("USE CATALOG %s", catalogName); - Assert.assertTrue( - "Namespace should exist", validationNamespaceCatalog.namespaceExists(icebergNamespace)); + Assertions.assertThat(validationNamespaceCatalog.namespaceExists(icebergNamespace)) + .as("Namespace should exist") + .isTrue(); List<Row> databases = sql("SHOW DATABASES"); if (isHadoopCatalog) { - Assert.assertEquals("Should have 1 database", 1, databases.size()); - Assert.assertEquals("Should have db database", "db", databases.get(0).getField(0)); - + Assertions.assertThat(databases.size()).as("Should have 1 database").isEqualTo(1); + Assertions.assertThat(databases.get(0).getField(0)) + .as("Should have db database") + .isEqualTo("db"); if (!baseNamespace.isEmpty()) { // test namespace not belongs to this catalog validationNamespaceCatalog.createNamespace( Namespace.of(baseNamespace.level(0), "UNKNOWN_NAMESPACE")); databases = sql("SHOW DATABASES"); - Assert.assertEquals("Should have 1 database", 1, databases.size()); - Assert.assertEquals( - "Should have db and default database", "db", databases.get(0).getField(0)); + Assertions.assertThat(databases.size()).as("Should have 1 database").isEqualTo(1); Review Comment: ack -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org