nastra commented on code in PR #9401: URL: https://github.com/apache/iceberg/pull/9401#discussion_r1445274223
########## spark/v3.5/spark/src/test/java/org/apache/iceberg/spark/sql/TestNamespaceSQL.java: ########## @@ -110,134 +151,156 @@ public void testDropNonEmptyNamespace() { sql("DROP TABLE %s.table", fullNamespace); } - @Test + @TestTemplate public void testListTables() { - Assert.assertFalse( - "Namespace should not already exist", validationNamespaceCatalog.namespaceExists(NS)); + assertThat(validationNamespaceCatalog.namespaceExists(NS)) + .as("Namespace should not already exist") + .isFalse(); sql("CREATE NAMESPACE %s", fullNamespace); - Assert.assertTrue("Namespace should exist", validationNamespaceCatalog.namespaceExists(NS)); + assertThat(validationNamespaceCatalog.namespaceExists(NS)) + .as("Namespace should exist") + .isTrue(); List<Object[]> rows = sql("SHOW TABLES IN %s", fullNamespace); - Assert.assertEquals("Should not list any tables", 0, rows.size()); + assertThat(rows).as("Should not list any tables").hasSize(0); sql("CREATE TABLE %s.table (id bigint) USING iceberg", fullNamespace); Object[] row = Iterables.getOnlyElement(sql("SHOW TABLES IN %s", fullNamespace)); - Assert.assertEquals("Namespace should match", "db", row[0]); - Assert.assertEquals("Table name should match", "table", row[1]); + assertThat(row[0]).as("Namespace should match").isEqualTo("db"); + assertThat(row[1]).as("Table name should match").isEqualTo("table"); } - @Test + @TestTemplate public void testListNamespace() { - Assert.assertFalse( - "Namespace should not already exist", validationNamespaceCatalog.namespaceExists(NS)); + assertThat(validationNamespaceCatalog.namespaceExists(NS)) + .as("Namespace should not already exist") + .isFalse(); sql("CREATE NAMESPACE %s", fullNamespace); - Assert.assertTrue("Namespace should exist", validationNamespaceCatalog.namespaceExists(NS)); + assertThat(validationNamespaceCatalog.namespaceExists(NS)) + .as("Namespace should exist") + .isTrue(); List<Object[]> namespaces = sql("SHOW NAMESPACES IN %s", catalogName); if (isHadoopCatalog) { - Assert.assertEquals("Should have 1 namespace", 1, namespaces.size()); + assertThat(namespaces).as("Should have 1 namespace").hasSize(1); Set<String> namespaceNames = namespaces.stream().map(arr -> arr[0].toString()).collect(Collectors.toSet()); - Assert.assertEquals("Should have only db namespace", ImmutableSet.of("db"), namespaceNames); + assertThat(namespaceNames) + .as("Should have only db namespace") + .isEqualTo(ImmutableSet.of("db")); } else { - Assert.assertEquals("Should have 2 namespaces", 2, namespaces.size()); + assertThat(namespaces).as("Should have 2 namespaces").hasSize(2); Set<String> namespaceNames = namespaces.stream().map(arr -> arr[0].toString()).collect(Collectors.toSet()); - Assert.assertEquals( - "Should have default and db namespaces", - ImmutableSet.of("default", "db"), - namespaceNames); + assertThat(namespaceNames) + .as("Should have default and db namespaces") + .isEqualTo(ImmutableSet.of("default", "db")); } List<Object[]> nestedNamespaces = sql("SHOW NAMESPACES IN %s", fullNamespace); Set<String> nestedNames = nestedNamespaces.stream().map(arr -> arr[0].toString()).collect(Collectors.toSet()); - Assert.assertEquals("Should not have nested namespaces", ImmutableSet.of(), nestedNames); + assertThat(nestedNames).as("Should not have nested namespaces").isEmpty(); } - @Test + @TestTemplate public void testCreateNamespaceWithMetadata() { - Assume.assumeFalse("HadoopCatalog does not support namespace metadata", isHadoopCatalog); + assumeThat(isHadoopCatalog).as("HadoopCatalog does not support namespace metadata").isFalse(); - Assert.assertFalse( - "Namespace should not already exist", validationNamespaceCatalog.namespaceExists(NS)); + assertThat(validationNamespaceCatalog.namespaceExists(NS)) + .as("Namespace should not already exist") + .isFalse(); sql("CREATE NAMESPACE %s WITH PROPERTIES ('prop'='value')", fullNamespace); - Assert.assertTrue("Namespace should exist", validationNamespaceCatalog.namespaceExists(NS)); + assertThat(validationNamespaceCatalog.namespaceExists(NS)) + .as("Namespace should exist") + .isTrue(); Map<String, String> nsMetadata = validationNamespaceCatalog.loadNamespaceMetadata(NS); - Assert.assertEquals( - "Namespace should have expected prop value", "value", nsMetadata.get("prop")); + assertThat(nsMetadata.get("prop")) + .as("Namespace should have expected prop value") + .isEqualTo("value"); } - @Test + @TestTemplate public void testCreateNamespaceWithComment() { - Assume.assumeFalse("HadoopCatalog does not support namespace metadata", isHadoopCatalog); + assumeThat(isHadoopCatalog).as("HadoopCatalog does not support namespace metadata").isFalse(); - Assert.assertFalse( - "Namespace should not already exist", validationNamespaceCatalog.namespaceExists(NS)); + assertThat(validationNamespaceCatalog.namespaceExists(NS)) + .as("Namespace should not already exist") + .isFalse(); sql("CREATE NAMESPACE %s COMMENT 'namespace doc'", fullNamespace); - Assert.assertTrue("Namespace should exist", validationNamespaceCatalog.namespaceExists(NS)); + assertThat(validationNamespaceCatalog.namespaceExists(NS)) + .as("Namespace should exist") + .isTrue(); Map<String, String> nsMetadata = validationNamespaceCatalog.loadNamespaceMetadata(NS); - Assert.assertEquals( - "Namespace should have expected comment", "namespace doc", nsMetadata.get("comment")); + assertThat(nsMetadata.get("comment")) Review Comment: same as above -- 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