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


##########
core/src/test/java/org/apache/iceberg/hadoop/TestHadoopCatalog.java:
##########
@@ -105,23 +104,25 @@ public void testReplaceTxnBuilder() throws Exception {
     createTxn.commitTransaction();
 
     Table table = catalog.loadTable(tableIdent);
-    Assert.assertNotNull(table.currentSnapshot());
+    Assertions.assertThat(table.currentSnapshot()).isNotNull();
 
     Transaction replaceTxn =
         catalog.buildTable(tableIdent, SCHEMA).withProperty("key2", 
"value2").replaceTransaction();
     replaceTxn.commitTransaction();
 
     table = catalog.loadTable(tableIdent);
-    Assert.assertNull(table.currentSnapshot());
+    Assertions.assertThat(table.currentSnapshot()).isNull();
     PartitionSpec v1Expected =
         PartitionSpec.builderFor(table.schema())
             .alwaysNull("data", "data_bucket")
             .withSpecId(1)
             .build();
-    Assert.assertEquals("Table should have a spec with one void field", 
v1Expected, table.spec());
+    Assertions.assertThat(table.spec())
+        .as("Table should have a spec with one void field")
+        .isEqualTo(v1Expected);
 
-    Assert.assertEquals("value1", table.properties().get("key1"));
-    Assert.assertEquals("value2", table.properties().get("key2"));
+    Assertions.assertThat(table.properties().get("key1")).isEqualTo("value1");

Review Comment:
   nit: better to use `.containsEntry(...).containsEntry(..)`



##########
core/src/test/java/org/apache/iceberg/hadoop/TestHadoopTables.java:
##########
@@ -55,104 +53,103 @@ public class TestHadoopTables {
           required(1, "id", Types.IntegerType.get(), "unique ID"),
           required(2, "data", Types.StringType.get()));
 
-  @Rule public TemporaryFolder temp = new TemporaryFolder();
-  private File tableDir = null;
-
-  @Before
-  public void setupTableLocation() throws Exception {
-    tableDir = temp.newFolder();
-  }
+  @TempDir private Path tableDir;

Review Comment:
   please change this to 
   ```
   @TempDir private File tableDir;
   @TempDir private Path dataDir;
   ```
   Then the `toUri()` changes aren't required



##########
core/src/test/java/org/apache/iceberg/hadoop/TestHadoopTables.java:
##########
@@ -55,104 +53,103 @@ public class TestHadoopTables {
           required(1, "id", Types.IntegerType.get(), "unique ID"),
           required(2, "data", Types.StringType.get()));
 
-  @Rule public TemporaryFolder temp = new TemporaryFolder();
-  private File tableDir = null;
-
-  @Before
-  public void setupTableLocation() throws Exception {
-    tableDir = temp.newFolder();
-  }
+  @TempDir private Path tableDir;
 
   @Test
   public void testTableExists() {
-    Assert.assertFalse(TABLES.exists(tableDir.toURI().toString()));
+    
Assertions.assertThat(TABLES.exists(tableDir.toUri().toString())).isFalse();
     PartitionSpec spec = PartitionSpec.builderFor(SCHEMA).bucket("data", 
16).build();
-    TABLES.create(SCHEMA, spec, tableDir.toURI().toString());
-    Assert.assertTrue(TABLES.exists(tableDir.toURI().toString()));
+    TABLES.create(SCHEMA, spec, tableDir.toUri().toString());
+    Assertions.assertThat(TABLES.exists(tableDir.toUri().toString())).isTrue();
   }
 
   @Test
   public void testDropTable() {
-    TABLES.create(SCHEMA, tableDir.toURI().toString());
-    TABLES.dropTable(tableDir.toURI().toString());
+    TABLES.create(SCHEMA, tableDir.toUri().toString());
+    TABLES.dropTable(tableDir.toUri().toString());
 
-    Assertions.assertThatThrownBy(() -> 
TABLES.load(tableDir.toURI().toString()))
+    Assertions.assertThatThrownBy(() -> 
TABLES.load(tableDir.toUri().toString()))
         .isInstanceOf(NoSuchTableException.class)
         .hasMessageStartingWith("Table does not exist");
   }
 
   @Test
   public void testDropTableWithPurge() throws IOException {
-    File dataDir = temp.newFolder();
 
-    createDummyTable(tableDir, dataDir);
+    createDummyTable(tableDir.toFile(), dataDir.toFile());
 
-    TABLES.dropTable(tableDir.toURI().toString(), true);
-    Assertions.assertThatThrownBy(() -> 
TABLES.load(tableDir.toURI().toString()))
+    TABLES.dropTable(tableDir.toUri().toString(), true);
+    Assertions.assertThatThrownBy(() -> 
TABLES.load(tableDir.toUri().toString()))
         .isInstanceOf(NoSuchTableException.class)
         .hasMessageStartingWith("Table does not exist");
 
-    Assert.assertEquals(0, dataDir.listFiles().length);
-    Assert.assertFalse(tableDir.exists());
+    Assertions.assertThat(Files.list(dataDir)).hasSize(0);
+    Assertions.assertThat(tableDir).doesNotExist();
 
-    Assert.assertFalse(TABLES.dropTable(tableDir.toURI().toString()));
+    
Assertions.assertThat(TABLES.dropTable(tableDir.toUri().toString())).isFalse();
   }
 
+  @TempDir private Path dataDir;

Review Comment:
   this should be moved 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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to