nastra commented on code in PR #9364:
URL: https://github.com/apache/iceberg/pull/9364#discussion_r1435193321


##########
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);
+        Assertions.assertThat(databases.get(0).getField(0))
+            .as("Should have db database")
+            .isEqualTo("db");
       }
     } else {
       // If there are multiple classes extends FlinkTestBase, 
TestHiveMetastore may loose the
       // creation for default
       // database. See HiveMetaStore.HMSHandler.init.
-      Assert.assertTrue(
-          "Should have db database",
-          databases.stream().anyMatch(d -> Objects.equals(d.getField(0), 
"db")));
+      Assertions.assertThat(databases.stream().anyMatch(d -> 
Objects.equals(d.getField(0), "db")))
+          .as("Should have db database")
+          .isTrue();

Review Comment:
   rather than using isTrue() / isFalse, we typically want to use a more fluent 
way of asserting this: `assertThat(databases).anyMatch(d -> 
Objects.equals(d.getField(0), "db"))`



-- 
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

Reply via email to