You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "nastra (via GitHub)" <gi...@apache.org> on 2023/06/22 06:03:30 UTC

[GitHub] [iceberg] nastra commented on a diff in pull request #7874: core: migrate jdbc module to junit5 and assertj

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


##########
core/src/test/java/org/apache/iceberg/jdbc/TestJdbcCatalog.java:
##########
@@ -516,30 +515,21 @@ public void testListNamespace() {
         .forEach(t -> catalog.createTable(t, SCHEMA, PartitionSpec.unpartitioned()));
 
     List<Namespace> nsp1 = catalog.listNamespaces(Namespace.of("db"));
-    Assert.assertEquals(nsp1.size(), 3);
+    assertThat(nsp1).hasSize(3);
     Set<String> tblSet = Sets.newHashSet(nsp1.stream().map(Namespace::toString).iterator());
-    Assert.assertEquals(tblSet.size(), 3);
-    Assert.assertTrue(tblSet.contains("db.ns1"));
-    Assert.assertTrue(tblSet.contains("db.ns2"));
-    Assert.assertTrue(tblSet.contains("db.ns3"));
+    assertThat(tblSet).hasSize(3).contains("db.ns1", "db.ns2", "db.ns3");
 
     List<Namespace> nsp2 = catalog.listNamespaces(Namespace.of("db", "ns1"));
-    Assert.assertEquals(nsp2.size(), 1);
-    Assert.assertEquals("db.ns1.ns2", nsp2.get(0).toString());
+    assertThat(nsp2.size()).isEqualTo(1);

Review Comment:
   ```suggestion
       assertThat(nsp2).hasSize(1);
   ```



##########
core/src/test/java/org/apache/iceberg/jdbc/TestJdbcTableConcurrency.java:
##########
@@ -108,13 +109,13 @@ public synchronized void testConcurrentFastAppends() throws IOException {
             });
 
     icebergTable.refresh();
-    Assert.assertEquals(20, icebergTable.currentSnapshot().allManifests(icebergTable.io()).size());
+    assertThat(icebergTable.currentSnapshot().allManifests(icebergTable.io())).hasSize(20);
   }
 
   @Test
   public synchronized void testConcurrentConnections() throws InterruptedException, IOException {
     Map<String, String> properties = Maps.newHashMap();
-    this.tableDir = temp.newFolder();
+    this.tableDir = temp.toFile();

Review Comment:
   this can be removed



##########
core/src/test/java/org/apache/iceberg/jdbc/TestJdbcTableConcurrency.java:
##########
@@ -57,13 +57,14 @@ public class TestJdbcTableConcurrency {
       new Schema(
           required(1, "id", Types.IntegerType.get(), "unique ID"),
           required(2, "data", Types.StringType.get()));
-  @Rule public TemporaryFolder temp = new TemporaryFolder();
+
+  @TempDir public Path temp;
   File tableDir;
 
   @Test
   public synchronized void testConcurrentFastAppends() throws IOException {
     Map<String, String> properties = Maps.newHashMap();
-    this.tableDir = temp.newFolder();
+    this.tableDir = temp.toFile();

Review Comment:
   this can be removed



##########
core/src/test/java/org/apache/iceberg/jdbc/TestJdbcTableConcurrency.java:
##########
@@ -57,13 +57,14 @@ public class TestJdbcTableConcurrency {
       new Schema(
           required(1, "id", Types.IntegerType.get(), "unique ID"),
           required(2, "data", Types.StringType.get()));
-  @Rule public TemporaryFolder temp = new TemporaryFolder();
+
+  @TempDir public Path temp;

Review Comment:
   ```suggestion
     @TempDir private File tableDir;
   ```



-- 
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-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org