This is an automated email from the ASF dual-hosted git repository.

etudenhoefner pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iceberg.git


The following commit(s) were added to refs/heads/master by this push:
     new 15a9af7228 Dell,Arrow : Migrate test cases in dell,arrow packages to 
JUnit5 (#7872)
15a9af7228 is described below

commit 15a9af72280c3657d6ff33fc00ebbd5fc1ac88b1
Author: Saheed Hussain <[email protected]>
AuthorDate: Tue Jun 27 07:19:37 2023 +0100

    Dell,Arrow : Migrate test cases in dell,arrow packages to JUnit5 (#7872)
---
 .../apache/iceberg/arrow/ArrowSchemaUtilTest.java  | 77 +++++++++++-----------
 .../iceberg/arrow/vectorized/ArrowReaderTest.java  | 46 ++++++-------
 .../vectorized/parquet/DecimalVectorUtilTest.java  | 20 +++---
 build.gradle                                       |  6 ++
 .../dell/ecs/TestEcsAppendOutputStream.java        | 17 +++--
 .../apache/iceberg/dell/ecs/TestEcsCatalog.java    | 32 +++++----
 .../apache/iceberg/dell/ecs/TestEcsInputFile.java  | 16 ++---
 .../apache/iceberg/dell/ecs/TestEcsOutputFile.java | 17 +++--
 .../dell/ecs/TestEcsSeekableInputStream.java       | 16 +++--
 .../org/apache/iceberg/dell/ecs/TestEcsURI.java    | 10 +--
 .../iceberg/dell/ecs/TestPropertiesSerDesUtil.java |  7 +-
 .../iceberg/dell/mock/ecs/EcsS3MockRule.java       |  5 +-
 .../apache/iceberg/dell/mock/ecs/MockS3Client.java |  7 +-
 13 files changed, 148 insertions(+), 128 deletions(-)

diff --git 
a/arrow/src/test/java/org/apache/iceberg/arrow/ArrowSchemaUtilTest.java 
b/arrow/src/test/java/org/apache/iceberg/arrow/ArrowSchemaUtilTest.java
index 7568abd460..8dc75c1a2d 100644
--- a/arrow/src/test/java/org/apache/iceberg/arrow/ArrowSchemaUtilTest.java
+++ b/arrow/src/test/java/org/apache/iceberg/arrow/ArrowSchemaUtilTest.java
@@ -18,6 +18,8 @@
  */
 package org.apache.iceberg.arrow;
 
+import static org.assertj.core.api.Assertions.assertThat;
+
 import org.apache.arrow.vector.types.pojo.ArrowType;
 import org.apache.arrow.vector.types.pojo.Field;
 import org.apache.iceberg.Schema;
@@ -34,8 +36,7 @@ import org.apache.iceberg.types.Types.MapType;
 import org.apache.iceberg.types.Types.StringType;
 import org.apache.iceberg.types.Types.TimeType;
 import org.apache.iceberg.types.Types.TimestampType;
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 public class ArrowSchemaUtilTest {
 
@@ -97,86 +98,86 @@ public class ArrowSchemaUtilTest {
                 MapType.ofOptional(
                     4, 5, StringType.get(), ListType.ofOptional(6, 
TimestampType.withoutZone()))));
     org.apache.arrow.vector.types.pojo.Schema arrow = 
ArrowSchemaUtil.convert(iceberg);
-    Assert.assertEquals(iceberg.columns().size(), arrow.getFields().size());
+    assertThat(arrow.getFields()).hasSameSizeAs(iceberg.columns());
   }
 
   private void validate(Schema iceberg, 
org.apache.arrow.vector.types.pojo.Schema arrow) {
-    Assert.assertEquals(iceberg.columns().size(), arrow.getFields().size());
+    assertThat(arrow.getFields()).hasSameSizeAs(iceberg.columns());
 
     for (Types.NestedField nf : iceberg.columns()) {
       Field field = arrow.findField(nf.name());
-      Assert.assertNotNull("Missing filed: " + nf, field);
+      assertThat(field).as("Missing field: " + nf).isNotNull();
       validate(nf.type(), field, nf.isOptional());
     }
   }
 
   private void validate(Type iceberg, Field field, boolean optional) {
     ArrowType arrowType = field.getType();
-    Assert.assertEquals(optional, field.isNullable());
+    assertThat(field.isNullable()).isEqualTo(optional);
     switch (iceberg.typeId()) {
       case BOOLEAN:
-        Assert.assertEquals(BOOLEAN_FIELD, field.getName());
-        Assert.assertEquals(ArrowType.ArrowTypeID.Bool, arrowType.getTypeID());
+        assertThat(field.getName()).isEqualTo(BOOLEAN_FIELD);
+        
assertThat(arrowType.getTypeID()).isEqualTo(ArrowType.ArrowTypeID.Bool);
         break;
       case INTEGER:
-        Assert.assertEquals(INTEGER_FIELD, field.getName());
-        Assert.assertEquals(ArrowType.ArrowTypeID.Int, arrowType.getTypeID());
+        assertThat(field.getName()).isEqualTo(INTEGER_FIELD);
+        assertThat(arrowType.getTypeID()).isEqualTo(ArrowType.ArrowTypeID.Int);
         break;
       case LONG:
-        Assert.assertEquals(LONG_FIELD, field.getName());
-        Assert.assertEquals(ArrowType.ArrowTypeID.Int, arrowType.getTypeID());
+        assertThat(field.getName()).isEqualTo(LONG_FIELD);
+        assertThat(arrowType.getTypeID()).isEqualTo(ArrowType.ArrowTypeID.Int);
         break;
       case FLOAT:
-        Assert.assertEquals(FLOAT_FIELD, field.getName());
-        Assert.assertEquals(ArrowType.ArrowTypeID.FloatingPoint, 
arrowType.getTypeID());
+        assertThat(field.getName()).isEqualTo(FLOAT_FIELD);
+        
assertThat(arrowType.getTypeID()).isEqualTo(ArrowType.ArrowTypeID.FloatingPoint);
         break;
       case DOUBLE:
-        Assert.assertEquals(DOUBLE_FIELD, field.getName());
-        Assert.assertEquals(ArrowType.ArrowTypeID.FloatingPoint, 
arrowType.getTypeID());
+        assertThat(field.getName()).isEqualTo(DOUBLE_FIELD);
+        
assertThat(arrowType.getTypeID()).isEqualTo(ArrowType.ArrowTypeID.FloatingPoint);
         break;
       case DATE:
-        Assert.assertEquals(DATE_FIELD, field.getName());
-        Assert.assertEquals(ArrowType.ArrowTypeID.Date, arrowType.getTypeID());
+        assertThat(field.getName()).isEqualTo(DATE_FIELD);
+        
assertThat(arrowType.getTypeID()).isEqualTo(ArrowType.ArrowTypeID.Date);
         break;
       case TIME:
-        Assert.assertEquals(TIME_FIELD, field.getName());
-        Assert.assertEquals(ArrowType.ArrowTypeID.Time, arrowType.getTypeID());
+        assertThat(field.getName()).isEqualTo(TIME_FIELD);
+        
assertThat(arrowType.getTypeID()).isEqualTo(ArrowType.ArrowTypeID.Time);
         break;
       case TIMESTAMP:
-        Assert.assertEquals(TIMESTAMP_FIELD, field.getName());
-        Assert.assertEquals(ArrowType.ArrowTypeID.Timestamp, 
arrowType.getTypeID());
+        assertThat(field.getName()).isEqualTo(TIMESTAMP_FIELD);
+        
assertThat(arrowType.getTypeID()).isEqualTo(ArrowType.ArrowTypeID.Timestamp);
         break;
       case STRING:
-        Assert.assertEquals(STRING_FIELD, field.getName());
-        Assert.assertEquals(ArrowType.ArrowTypeID.Utf8, arrowType.getTypeID());
+        assertThat(field.getName()).isEqualTo(STRING_FIELD);
+        
assertThat(arrowType.getTypeID()).isEqualTo(ArrowType.ArrowTypeID.Utf8);
         break;
       case FIXED:
-        Assert.assertEquals(FIXED_WIDTH_BINARY_FIELD, field.getName());
-        Assert.assertEquals(ArrowType.FixedSizeBinary.TYPE_TYPE, 
arrowType.getTypeID());
+        assertThat(field.getName()).isEqualTo(FIXED_WIDTH_BINARY_FIELD);
+        
assertThat(arrowType.getTypeID()).isEqualTo(ArrowType.FixedSizeBinary.TYPE_TYPE);
         break;
       case BINARY:
-        Assert.assertEquals(BINARY_FIELD, field.getName());
-        Assert.assertEquals(ArrowType.Binary.TYPE_TYPE, arrowType.getTypeID());
+        assertThat(field.getName()).isEqualTo(BINARY_FIELD);
+        
assertThat(arrowType.getTypeID()).isEqualTo(ArrowType.Binary.TYPE_TYPE);
         break;
       case DECIMAL:
-        Assert.assertEquals(DECIMAL_FIELD, field.getName());
-        Assert.assertEquals(ArrowType.Decimal.TYPE_TYPE, 
arrowType.getTypeID());
+        assertThat(field.getName()).isEqualTo(DECIMAL_FIELD);
+        
assertThat(arrowType.getTypeID()).isEqualTo(ArrowType.Decimal.TYPE_TYPE);
         break;
       case STRUCT:
-        Assert.assertEquals(STRUCT_FIELD, field.getName());
-        Assert.assertEquals(ArrowType.Struct.TYPE_TYPE, arrowType.getTypeID());
+        assertThat(field.getName()).isEqualTo(STRUCT_FIELD);
+        
assertThat(arrowType.getTypeID()).isEqualTo(ArrowType.Struct.TYPE_TYPE);
         break;
       case LIST:
-        Assert.assertEquals(LIST_FIELD, field.getName());
-        Assert.assertEquals(ArrowType.List.TYPE_TYPE, arrowType.getTypeID());
+        assertThat(field.getName()).isEqualTo(LIST_FIELD);
+        assertThat(arrowType.getTypeID()).isEqualTo(ArrowType.List.TYPE_TYPE);
         break;
       case MAP:
-        Assert.assertEquals(MAP_FIELD, field.getName());
-        Assert.assertEquals(ArrowType.ArrowTypeID.Map, arrowType.getTypeID());
+        assertThat(field.getName()).isEqualTo(MAP_FIELD);
+        assertThat(arrowType.getTypeID()).isEqualTo(ArrowType.ArrowTypeID.Map);
         break;
       case UUID:
-        Assert.assertEquals(UUID_FIELD, field.getName());
-        Assert.assertEquals(ArrowType.FixedSizeBinary.TYPE_TYPE, 
arrowType.getTypeID());
+        assertThat(field.getName()).isEqualTo(UUID_FIELD);
+        
assertThat(arrowType.getTypeID()).isEqualTo(ArrowType.FixedSizeBinary.TYPE_TYPE);
         break;
       default:
         throw new UnsupportedOperationException("Check not implemented for 
type: " + iceberg);
diff --git 
a/arrow/src/test/java/org/apache/iceberg/arrow/vectorized/ArrowReaderTest.java 
b/arrow/src/test/java/org/apache/iceberg/arrow/vectorized/ArrowReaderTest.java
index 983c5ba1b5..9cd9c8cc5a 100644
--- 
a/arrow/src/test/java/org/apache/iceberg/arrow/vectorized/ArrowReaderTest.java
+++ 
b/arrow/src/test/java/org/apache/iceberg/arrow/vectorized/ArrowReaderTest.java
@@ -19,8 +19,7 @@
 package org.apache.iceberg.arrow.vectorized;
 
 import static org.apache.iceberg.Files.localInput;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.assertj.core.api.Assertions.assertThat;
 
 import java.io.File;
 import java.io.IOException;
@@ -86,9 +85,9 @@ import 
org.apache.iceberg.relocated.com.google.common.collect.Maps;
 import org.apache.iceberg.types.Types;
 import org.apache.iceberg.util.UUIDUtil;
 import org.assertj.core.api.Assertions;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
 
 /**
  * Test cases for {@link ArrowReader}.
@@ -127,14 +126,17 @@ public class ArrowReaderTest {
           "uuid_nullable",
           "decimal",
           "decimal_nullable");
-
-  @Rule public final TemporaryFolder temp = new TemporaryFolder();
+  @TempDir private File tempDir;
 
   private HadoopTables tables;
-
   private String tableLocation;
   private List<GenericRecord> rowsWritten;
 
+  @BeforeEach
+  public void before() {
+    tableLocation = tempDir.toURI().toString();
+  }
+
   /**
    * Read all rows and columns from the table without any filter. The test 
asserts that the Arrow
    * {@link VectorSchemaRoot} contains the expected schema and expected vector 
types. Then the test
@@ -225,7 +227,7 @@ public class ArrowReaderTest {
         numRoots++;
       }
     }
-    assertEquals(0, numRoots);
+    assertThat(numRoots).isZero();
   }
 
   /**
@@ -322,14 +324,14 @@ public class ArrowReaderTest {
       for (ColumnarBatch batch : itr) {
         List<GenericRecord> expectedRows = rowsWritten.subList(rowIndex, 
rowIndex + numRowsPerRoot);
         VectorSchemaRoot root = batch.createVectorSchemaRootFromVectors();
-        assertEquals(createExpectedArrowSchema(columnSet), root.getSchema());
+        
assertThat(root.getSchema()).isEqualTo(createExpectedArrowSchema(columnSet));
         checkAllVectorTypes(root, columnSet);
         checkAllVectorValues(numRowsPerRoot, expectedRows, root, columnSet);
         rowIndex += numRowsPerRoot;
         totalRows += root.getRowCount();
       }
     }
-    assertEquals(expectedTotalRows, totalRows);
+    assertThat(totalRows).isEqualTo(expectedTotalRows);
   }
 
   private void readAndCheckHasNextIsIdempotent(
@@ -349,12 +351,12 @@ public class ArrowReaderTest {
         // Call hasNext() a few extra times.
         // This should not affect the total number of rows read.
         for (int i = 0; i < numExtraCallsToHasNext; i++) {
-          assertTrue(iterator.hasNext());
+          assertThat(iterator).hasNext();
         }
 
         ColumnarBatch batch = iterator.next();
         VectorSchemaRoot root = batch.createVectorSchemaRootFromVectors();
-        assertEquals(createExpectedArrowSchema(columnSet), root.getSchema());
+        
assertThat(root.getSchema()).isEqualTo(createExpectedArrowSchema(columnSet));
         checkAllVectorTypes(root, columnSet);
         List<GenericRecord> expectedRows = rowsWritten.subList(rowIndex, 
rowIndex + numRowsPerRoot);
         checkAllVectorValues(numRowsPerRoot, expectedRows, root, columnSet);
@@ -362,7 +364,7 @@ public class ArrowReaderTest {
         totalRows += root.getRowCount();
       }
     }
-    assertEquals(expectedTotalRows, totalRows);
+    assertThat(totalRows).isEqualTo(expectedTotalRows);
   }
 
   @SuppressWarnings("MethodLength")
@@ -378,8 +380,8 @@ public class ArrowReaderTest {
     }
     Set<String> columnSet = columnNameToIndex.keySet();
 
-    assertEquals(expectedNumRows, batch.numRows());
-    assertEquals(columns.size(), batch.numCols());
+    assertThat(batch.numRows()).isEqualTo(expectedNumRows);
+    assertThat(batch.numCols()).isEqualTo(columns.size());
 
     checkColumnarArrayValues(
         expectedNumRows,
@@ -667,7 +669,7 @@ public class ArrowReaderTest {
   private void writeTable(boolean constantRecords) throws Exception {
     rowsWritten = Lists.newArrayList();
     tables = new HadoopTables();
-    tableLocation = temp.newFolder("test").toString();
+    tableLocation = tempDir.toURI().toString();
 
     Schema schema =
         new Schema(
@@ -871,8 +873,8 @@ public class ArrowReaderTest {
 
   private DataFile writeParquetFile(Table table, List<GenericRecord> records) 
throws IOException {
     rowsWritten.addAll(records);
-    File parquetFile = temp.newFile();
-    assertTrue(parquetFile.delete());
+    File parquetFile = File.createTempFile("junit", null, tempDir);
+    assertThat(parquetFile.delete()).isTrue();
     FileAppender<GenericRecord> appender =
         Parquet.write(Files.localOutput(parquetFile))
             .schema(table.schema())
@@ -949,7 +951,7 @@ public class ArrowReaderTest {
   private void assertEqualsForField(
       VectorSchemaRoot root, Set<String> columnSet, String columnName, 
Class<?> expected) {
     if (columnSet.contains(columnName)) {
-      assertEquals(expected, root.getVector(columnName).getClass());
+      assertThat(root.getVector(columnName).getClass()).isEqualTo(expected);
     }
   }
 
@@ -959,7 +961,7 @@ public class ArrowReaderTest {
       List<GenericRecord> expectedRows,
       VectorSchemaRoot root,
       Set<String> columnSet) {
-    assertEquals(expectedNumRows, root.getRowCount());
+    assertThat(root.getRowCount()).isEqualTo(expectedNumRows);
 
     checkVectorValues(
         expectedNumRows,
@@ -1196,7 +1198,7 @@ public class ArrowReaderTest {
       BiFunction<FieldVector, Integer, Object> vectorValueExtractor) {
     if (columnSet.contains(columnName)) {
       FieldVector vector = root.getVector(columnName);
-      assertEquals(expectedNumRows, vector.getValueCount());
+      assertThat(vector.getValueCount()).isEqualTo(expectedNumRows);
       for (int i = 0; i < expectedNumRows; i++) {
         Object expectedValue = expectedValueExtractor.apply(expectedRows, i);
         Object actualValue = vectorValueExtractor.apply(vector, i);
diff --git 
a/arrow/src/test/java/org/apache/iceberg/arrow/vectorized/parquet/DecimalVectorUtilTest.java
 
b/arrow/src/test/java/org/apache/iceberg/arrow/vectorized/parquet/DecimalVectorUtilTest.java
index 4e78bafd0a..88e16c18cb 100644
--- 
a/arrow/src/test/java/org/apache/iceberg/arrow/vectorized/parquet/DecimalVectorUtilTest.java
+++ 
b/arrow/src/test/java/org/apache/iceberg/arrow/vectorized/parquet/DecimalVectorUtilTest.java
@@ -18,11 +18,11 @@
  */
 package org.apache.iceberg.arrow.vectorized.parquet;
 
-import static org.junit.Assert.assertEquals;
+import static org.assertj.core.api.Assertions.assertThat;
 
 import java.math.BigInteger;
 import org.assertj.core.api.Assertions;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 public class DecimalVectorUtilTest {
 
@@ -32,9 +32,9 @@ public class DecimalVectorUtilTest {
     byte[] bytes = bigInt.toByteArray();
     byte[] paddedBytes = DecimalVectorUtil.padBigEndianBytes(bytes, 16);
 
-    assertEquals(16, paddedBytes.length);
+    assertThat(paddedBytes).hasSize(16);
     BigInteger result = new BigInteger(paddedBytes);
-    assertEquals(bigInt, result);
+    assertThat(result).isEqualTo(bigInt);
   }
 
   @Test
@@ -43,9 +43,9 @@ public class DecimalVectorUtilTest {
     byte[] bytes = bigInt.toByteArray();
     byte[] paddedBytes = DecimalVectorUtil.padBigEndianBytes(bytes, 16);
 
-    assertEquals(16, paddedBytes.length);
+    assertThat(paddedBytes).hasSize(16);
     BigInteger result = new BigInteger(paddedBytes);
-    assertEquals(bigInt, result);
+    assertThat(result).isEqualTo(bigInt);
   }
 
   @Test
@@ -53,16 +53,16 @@ public class DecimalVectorUtilTest {
     byte[] bytes = BigInteger.ZERO.toByteArray();
     byte[] paddedBytes = DecimalVectorUtil.padBigEndianBytes(bytes, 16);
 
-    assertEquals(16, paddedBytes.length);
+    assertThat(paddedBytes).hasSize(16);
     BigInteger result = new BigInteger(paddedBytes);
-    assertEquals(BigInteger.ZERO, result);
+    assertThat(result).isEqualTo(BigInteger.ZERO);
 
     bytes = new byte[0];
     paddedBytes = DecimalVectorUtil.padBigEndianBytes(bytes, 16);
 
-    assertEquals(16, paddedBytes.length);
+    assertThat(paddedBytes).hasSize(16);
     result = new BigInteger(paddedBytes);
-    assertEquals(BigInteger.ZERO, result);
+    assertThat(result).isEqualTo(BigInteger.ZERO);
   }
 
   @Test
diff --git a/build.gradle b/build.gradle
index 805f708359..b627c4f733 100644
--- a/build.gradle
+++ b/build.gradle
@@ -758,6 +758,9 @@ project(':iceberg-parquet') {
 }
 
 project(':iceberg-arrow') {
+  test {
+    useJUnitPlatform()
+  }
   dependencies {
     implementation project(path: ':iceberg-bundled-guava', configuration: 
'shadow')
     api project(':iceberg-api')
@@ -860,6 +863,9 @@ project(':iceberg-nessie') {
 }
 
 project(':iceberg-dell') {
+  test {
+    useJUnitPlatform()
+  }
   dependencies {
     implementation project(':iceberg-core')
     implementation project(':iceberg-common')
diff --git 
a/dell/src/test/java/org/apache/iceberg/dell/ecs/TestEcsAppendOutputStream.java 
b/dell/src/test/java/org/apache/iceberg/dell/ecs/TestEcsAppendOutputStream.java
index 18b5d621b8..bf5ed46a07 100644
--- 
a/dell/src/test/java/org/apache/iceberg/dell/ecs/TestEcsAppendOutputStream.java
+++ 
b/dell/src/test/java/org/apache/iceberg/dell/ecs/TestEcsAppendOutputStream.java
@@ -18,6 +18,8 @@
  */
 package org.apache.iceberg.dell.ecs;
 
+import static org.assertj.core.api.Assertions.assertThat;
+
 import com.emc.object.Range;
 import java.io.IOException;
 import java.io.InputStream;
@@ -25,7 +27,6 @@ import java.nio.charset.StandardCharsets;
 import org.apache.iceberg.dell.mock.ecs.EcsS3MockRule;
 import org.apache.iceberg.metrics.MetricsContext;
 import org.apache.iceberg.relocated.com.google.common.io.ByteStreams;
-import org.junit.Assert;
 import org.junit.ClassRule;
 import org.junit.Test;
 
@@ -54,10 +55,9 @@ public class TestEcsAppendOutputStream {
 
     try (InputStream input =
         rule.client().readObjectStream(rule.bucket(), objectName, 
Range.fromOffset(0))) {
-      Assert.assertEquals(
-          "Must write all the object content",
-          "1" + "123" + "1234567" + "12345678901",
-          new String(ByteStreams.toByteArray(input), StandardCharsets.UTF_8));
+      assertThat(new String(ByteStreams.toByteArray(input), 
StandardCharsets.UTF_8))
+          .as("Must write all the object content")
+          .isEqualTo("1" + "123" + "1234567" + "12345678901");
     }
   }
 
@@ -87,10 +87,9 @@ public class TestEcsAppendOutputStream {
 
     try (InputStream input =
         rule.client().readObjectStream(rule.bucket(), objectName, 
Range.fromOffset(0))) {
-      Assert.assertEquals(
-          "Must replace the object content",
-          "1234567" + "1234567",
-          new String(ByteStreams.toByteArray(input), StandardCharsets.UTF_8));
+      assertThat(new String(ByteStreams.toByteArray(input), 
StandardCharsets.UTF_8))
+          .as("Must replace the object content")
+          .isEqualTo("1234567" + "1234567");
     }
   }
 }
diff --git a/dell/src/test/java/org/apache/iceberg/dell/ecs/TestEcsCatalog.java 
b/dell/src/test/java/org/apache/iceberg/dell/ecs/TestEcsCatalog.java
index c61bd1db17..6c6136fade 100644
--- a/dell/src/test/java/org/apache/iceberg/dell/ecs/TestEcsCatalog.java
+++ b/dell/src/test/java/org/apache/iceberg/dell/ecs/TestEcsCatalog.java
@@ -19,6 +19,7 @@
 package org.apache.iceberg.dell.ecs;
 
 import static org.apache.iceberg.types.Types.NestedField.required;
+import static org.assertj.core.api.Assertions.assertThat;
 
 import java.io.IOException;
 import java.util.Map;
@@ -135,23 +136,27 @@ public class TestEcsCatalog {
         .isInstanceOf(NamespaceNotEmptyException.class)
         .hasMessage("Namespace a is not empty");
 
-    Assert.assertTrue("Drop namespace [a, b1]", 
ecsCatalog.dropNamespace(Namespace.of("a", "b1")));
+    assertThat(ecsCatalog.dropNamespace(Namespace.of("a", "b1")))
+        .as("Drop namespace [a, b1]")
+        .isTrue();
 
-    Assert.assertFalse(
-        "The [a, b1] is absent", ecsCatalog.namespaceExists(Namespace.of("a", 
"b1")));
-    Assert.assertTrue(
-        "The [a, b1] is not in list result of [a]",
-        ecsCatalog.listNamespaces(Namespace.of("a")).isEmpty());
+    assertThat(ecsCatalog.namespaceExists(Namespace.of("a", "b1")))
+        .as("The [a, b1] is absent")
+        .isFalse();
+    assertThat(ecsCatalog.listNamespaces(Namespace.of("a")))
+        .as("The [a, b1] is not in list result of [a]")
+        .isEmpty();
   }
 
   @Test
   public void testDropTable() {
     ecsCatalog.createTable(TableIdentifier.of("a"), SCHEMA);
 
-    Assert.assertFalse(
-        "Drop an unknown table return false", 
ecsCatalog.dropTable(TableIdentifier.of("unknown")));
+    assertThat(ecsCatalog.dropTable(TableIdentifier.of("unknown")))
+        .as("Drop an unknown table return false")
+        .isFalse();
 
-    Assert.assertTrue("Drop a table", 
ecsCatalog.dropTable(TableIdentifier.of("a"), true));
+    assertThat(ecsCatalog.dropTable(TableIdentifier.of("a"), true)).as("Drop a 
table").isTrue();
   }
 
   @Test
@@ -176,9 +181,12 @@ public class TestEcsCatalog {
 
     ecsCatalog.renameTable(TableIdentifier.of("a", "t1"), 
TableIdentifier.of("b", "t2"));
 
-    Assert.assertFalse(
-        "Old table does not exist", 
ecsCatalog.tableExists(TableIdentifier.of("a", "t1")));
-    Assert.assertTrue("New table exists", 
ecsCatalog.tableExists(TableIdentifier.of("b", "t2")));
+    assertThat(ecsCatalog.tableExists(TableIdentifier.of("a", "t1")))
+        .as("Old table does not exist")
+        .isFalse();
+    assertThat(ecsCatalog.tableExists(TableIdentifier.of("b", "t2")))
+        .as("New table exists")
+        .isTrue();
   }
 
   @Test
diff --git 
a/dell/src/test/java/org/apache/iceberg/dell/ecs/TestEcsInputFile.java 
b/dell/src/test/java/org/apache/iceberg/dell/ecs/TestEcsInputFile.java
index e2bb907bac..4f48c01f13 100644
--- a/dell/src/test/java/org/apache/iceberg/dell/ecs/TestEcsInputFile.java
+++ b/dell/src/test/java/org/apache/iceberg/dell/ecs/TestEcsInputFile.java
@@ -18,13 +18,14 @@
  */
 package org.apache.iceberg.dell.ecs;
 
+import static org.assertj.core.api.Assertions.assertThat;
+
 import com.emc.object.s3.request.PutObjectRequest;
 import java.io.IOException;
 import java.io.InputStream;
 import java.nio.charset.StandardCharsets;
 import org.apache.iceberg.dell.mock.ecs.EcsS3MockRule;
 import org.apache.iceberg.relocated.com.google.common.io.ByteStreams;
-import org.junit.Assert;
 import org.junit.ClassRule;
 import org.junit.Test;
 
@@ -37,7 +38,7 @@ public class TestEcsInputFile {
     String objectName = rule.randomObjectName();
     EcsInputFile inputFile =
         EcsInputFile.fromLocation(new EcsURI(rule.bucket(), 
objectName).toString(), rule.client());
-    Assert.assertFalse("File is absent", inputFile.exists());
+    assertThat(inputFile.exists()).as("File is absent").isFalse();
   }
 
   @Test
@@ -49,13 +50,12 @@ public class TestEcsInputFile {
     rule.client()
         .putObject(new PutObjectRequest(rule.bucket(), objectName, 
"0123456789".getBytes()));
 
-    Assert.assertTrue("File should exists", inputFile.exists());
-    Assert.assertEquals("File length should be 10", 10, inputFile.getLength());
+    assertThat(inputFile.exists()).as("File should exists").isTrue();
+    assertThat(inputFile.getLength()).as("File length should be 
10").isEqualTo(10);
     try (InputStream inputStream = inputFile.newStream()) {
-      Assert.assertEquals(
-          "The file content should be 0123456789",
-          "0123456789",
-          new String(ByteStreams.toByteArray(inputStream), 
StandardCharsets.UTF_8));
+      assertThat(new String(ByteStreams.toByteArray(inputStream), 
StandardCharsets.UTF_8))
+          .as("The file content should be 0123456789")
+          .isEqualTo("0123456789");
     }
   }
 }
diff --git 
a/dell/src/test/java/org/apache/iceberg/dell/ecs/TestEcsOutputFile.java 
b/dell/src/test/java/org/apache/iceberg/dell/ecs/TestEcsOutputFile.java
index 6d12a6aaa2..ab9ebfdcc6 100644
--- a/dell/src/test/java/org/apache/iceberg/dell/ecs/TestEcsOutputFile.java
+++ b/dell/src/test/java/org/apache/iceberg/dell/ecs/TestEcsOutputFile.java
@@ -18,6 +18,8 @@
  */
 package org.apache.iceberg.dell.ecs;
 
+import static org.assertj.core.api.Assertions.assertThat;
+
 import com.emc.object.Range;
 import java.io.IOException;
 import java.io.InputStream;
@@ -27,7 +29,6 @@ import org.apache.iceberg.exceptions.AlreadyExistsException;
 import org.apache.iceberg.io.PositionOutputStream;
 import org.apache.iceberg.relocated.com.google.common.io.ByteStreams;
 import org.assertj.core.api.Assertions;
-import org.junit.Assert;
 import org.junit.ClassRule;
 import org.junit.Test;
 
@@ -48,10 +49,9 @@ public class TestEcsOutputFile {
 
     try (InputStream input =
         rule.client().readObjectStream(rule.bucket(), objectName, 
Range.fromOffset(0))) {
-      Assert.assertEquals(
-          "File content is expected",
-          "1234567890",
-          new String(ByteStreams.toByteArray(input), StandardCharsets.UTF_8));
+      assertThat(new String(ByteStreams.toByteArray(input), 
StandardCharsets.UTF_8))
+          .as("File content is expected")
+          .isEqualTo("1234567890");
     }
   }
 
@@ -71,10 +71,9 @@ public class TestEcsOutputFile {
 
     try (InputStream input =
         rule.client().readObjectStream(rule.bucket(), objectName, 
Range.fromOffset(0))) {
-      Assert.assertEquals(
-          "File content should be overwritten",
-          "abcdefghij",
-          new String(ByteStreams.toByteArray(input), StandardCharsets.UTF_8));
+      assertThat(new String(ByteStreams.toByteArray(input), 
StandardCharsets.UTF_8))
+          .as("File content should be overwritten")
+          .isEqualTo("abcdefghij");
     }
   }
 
diff --git 
a/dell/src/test/java/org/apache/iceberg/dell/ecs/TestEcsSeekableInputStream.java
 
b/dell/src/test/java/org/apache/iceberg/dell/ecs/TestEcsSeekableInputStream.java
index 6e747f2ace..a49793fec8 100644
--- 
a/dell/src/test/java/org/apache/iceberg/dell/ecs/TestEcsSeekableInputStream.java
+++ 
b/dell/src/test/java/org/apache/iceberg/dell/ecs/TestEcsSeekableInputStream.java
@@ -18,12 +18,13 @@
  */
 package org.apache.iceberg.dell.ecs;
 
+import static org.assertj.core.api.Assertions.assertThat;
+
 import com.emc.object.s3.request.PutObjectRequest;
 import java.io.IOException;
 import java.nio.charset.StandardCharsets;
 import org.apache.iceberg.dell.mock.ecs.EcsS3MockRule;
 import org.apache.iceberg.metrics.MetricsContext;
-import org.junit.Assert;
 import org.junit.ClassRule;
 import org.junit.Test;
 
@@ -41,7 +42,7 @@ public class TestEcsSeekableInputStream {
         new EcsSeekableInputStream(
             rule.client(), new EcsURI(rule.bucket(), objectName), 
MetricsContext.nullMetrics())) {
       input.seek(2);
-      Assert.assertEquals("Expect 2 when seek to 2", '2', input.read());
+      assertThat(input.read()).as("Expect 2 when seek to 2").isEqualTo('2');
     }
   }
 
@@ -56,7 +57,7 @@ public class TestEcsSeekableInputStream {
             rule.client(), new EcsURI(rule.bucket(), objectName), 
MetricsContext.nullMetrics())) {
       input.seek(999);
       input.seek(3);
-      Assert.assertEquals("Expect 3 when seek to 3 finally", '3', 
input.read());
+      assertThat(input.read()).as("Expect 3 when seek to 3 
finally").isEqualTo('3');
     }
   }
 
@@ -69,7 +70,7 @@ public class TestEcsSeekableInputStream {
     try (EcsSeekableInputStream input =
         new EcsSeekableInputStream(
             rule.client(), new EcsURI(rule.bucket(), objectName), 
MetricsContext.nullMetrics())) {
-      Assert.assertEquals("The first byte should be 0 ", '0', input.read());
+      assertThat(input.read()).as("The first byte should be 0 
").isEqualTo('0');
     }
   }
 
@@ -83,9 +84,10 @@ public class TestEcsSeekableInputStream {
         new EcsSeekableInputStream(
             rule.client(), new EcsURI(rule.bucket(), objectName), 
MetricsContext.nullMetrics())) {
       byte[] buffer = new byte[3];
-      Assert.assertEquals("The first read should be 3 bytes", 3, 
input.read(buffer));
-      Assert.assertEquals(
-          "The first 3 bytes should be 012", "012", new String(buffer, 
StandardCharsets.UTF_8));
+      assertThat(input.read(buffer)).as("The first read should be 3 
bytes").isEqualTo(3);
+      assertThat(new String(buffer, StandardCharsets.UTF_8))
+          .as("The first 3 bytes should be 012")
+          .isEqualTo("012");
     }
   }
 }
diff --git a/dell/src/test/java/org/apache/iceberg/dell/ecs/TestEcsURI.java 
b/dell/src/test/java/org/apache/iceberg/dell/ecs/TestEcsURI.java
index 9952ffd82b..0e80ac03d5 100644
--- a/dell/src/test/java/org/apache/iceberg/dell/ecs/TestEcsURI.java
+++ b/dell/src/test/java/org/apache/iceberg/dell/ecs/TestEcsURI.java
@@ -18,10 +18,11 @@
  */
 package org.apache.iceberg.dell.ecs;
 
+import static org.assertj.core.api.Assertions.assertThat;
+
 import org.apache.iceberg.exceptions.ValidationException;
 import org.assertj.core.api.Assertions;
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 public class TestEcsURI {
 
@@ -48,13 +49,12 @@ public class TestEcsURI {
   }
 
   private void assertURI(String bucket, String name, EcsURI ecsURI) {
-    Assert.assertEquals("bucket", bucket, ecsURI.bucket());
-    Assert.assertEquals("name", name, ecsURI.name());
+    assertThat(ecsURI.bucket()).as("bucket").isEqualTo(bucket);
+    assertThat(ecsURI.name()).as("name").isEqualTo(name);
   }
 
   @Test
   public void testInvalidLocation() {
-
     Assertions.assertThatThrownBy(() -> new EcsURI("http://bucket/a";))
         .isInstanceOf(ValidationException.class)
         .hasMessage("Invalid ecs location: http://bucket/a";);
diff --git 
a/dell/src/test/java/org/apache/iceberg/dell/ecs/TestPropertiesSerDesUtil.java 
b/dell/src/test/java/org/apache/iceberg/dell/ecs/TestPropertiesSerDesUtil.java
index 90587bf695..dbc93fdf25 100644
--- 
a/dell/src/test/java/org/apache/iceberg/dell/ecs/TestPropertiesSerDesUtil.java
+++ 
b/dell/src/test/java/org/apache/iceberg/dell/ecs/TestPropertiesSerDesUtil.java
@@ -18,10 +18,11 @@
  */
 package org.apache.iceberg.dell.ecs;
 
+import static org.assertj.core.api.Assertions.assertThat;
+
 import java.util.Map;
 import org.apache.iceberg.relocated.com.google.common.collect.ImmutableMap;
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 public class TestPropertiesSerDesUtil {
 
@@ -31,6 +32,6 @@ public class TestPropertiesSerDesUtil {
     byte[] byteValue = PropertiesSerDesUtil.toBytes(properties);
     Map<String, String> result =
         PropertiesSerDesUtil.read(byteValue, 
PropertiesSerDesUtil.currentVersion());
-    Assert.assertEquals("Ser/Des will return the same content.", properties, 
result);
+    assertThat(properties).as("Ser/Des will return the same 
content.").isEqualTo(result);
   }
 }
diff --git 
a/dell/src/test/java/org/apache/iceberg/dell/mock/ecs/EcsS3MockRule.java 
b/dell/src/test/java/org/apache/iceberg/dell/mock/ecs/EcsS3MockRule.java
index f02a0d13a6..7948531846 100644
--- a/dell/src/test/java/org/apache/iceberg/dell/mock/ecs/EcsS3MockRule.java
+++ b/dell/src/test/java/org/apache/iceberg/dell/mock/ecs/EcsS3MockRule.java
@@ -18,6 +18,8 @@
  */
 package org.apache.iceberg.dell.mock.ecs;
 
+import static org.assertj.core.api.Assertions.assertThat;
+
 import com.emc.object.s3.S3Client;
 import com.emc.object.s3.bean.ListObjectsResult;
 import com.emc.object.s3.bean.ObjectKey;
@@ -31,7 +33,6 @@ import java.util.stream.Collectors;
 import org.apache.iceberg.dell.DellClientFactories;
 import org.apache.iceberg.dell.DellProperties;
 import org.apache.iceberg.dell.mock.MockDellClientFactory;
-import org.junit.Assert;
 import org.junit.rules.TestRule;
 import org.junit.runner.Description;
 import org.junit.runners.model.Statement;
@@ -71,7 +72,7 @@ public class EcsS3MockRule implements TestRule {
   /** Load rule from thread local and check bucket */
   public static EcsS3MockRule rule(String id) {
     EcsS3MockRule rule = TEST_RULE_FOR_MOCK_CLIENT.get();
-    Assert.assertTrue("Test Rule must match id", rule != null && 
rule.bucket().equals(id));
+    
assertThat(rule).isNotNull().extracting(EcsS3MockRule::bucket).isEqualTo(id);
     return rule;
   }
 
diff --git 
a/dell/src/test/java/org/apache/iceberg/dell/mock/ecs/MockS3Client.java 
b/dell/src/test/java/org/apache/iceberg/dell/mock/ecs/MockS3Client.java
index fc401c7c42..e0b3b19c04 100644
--- a/dell/src/test/java/org/apache/iceberg/dell/mock/ecs/MockS3Client.java
+++ b/dell/src/test/java/org/apache/iceberg/dell/mock/ecs/MockS3Client.java
@@ -18,6 +18,8 @@
  */
 package org.apache.iceberg.dell.mock.ecs;
 
+import static org.assertj.core.api.Assertions.assertThat;
+
 import com.emc.object.Protocol;
 import com.emc.object.Range;
 import com.emc.object.s3.S3Client;
@@ -91,7 +93,6 @@ import 
org.apache.iceberg.relocated.com.google.common.collect.Lists;
 import org.apache.iceberg.relocated.com.google.common.collect.Maps;
 import org.apache.iceberg.relocated.com.google.common.collect.Sets;
 import org.apache.iceberg.relocated.com.google.common.io.ByteStreams;
-import org.junit.Assert;
 
 /** Memorized s3 client used in tests. */
 public class MockS3Client implements S3Client {
@@ -121,7 +122,7 @@ public class MockS3Client implements S3Client {
       }
     } else if (request.getIfNoneMatch() != null) {
       // Put if absent
-      Assert.assertEquals("If-None-Match only allow *", "*", 
request.getIfNoneMatch());
+      assertThat(request.getIfNoneMatch()).as("If-None-Match only allow 
*").isEqualTo("*");
       if (this.objectData.putIfAbsent(objectId, data) != null) {
         throw new S3Exception("", 412, "PreconditionFailed", "");
       }
@@ -212,7 +213,7 @@ public class MockS3Client implements S3Client {
     String marker = request.getMarker();
     String delimiter = request.getDelimiter();
     // Use a small default value in mock client
-    Assert.assertNull("MaxKeys does not set", request.getMaxKeys());
+    assertThat(request.getMaxKeys()).as("MaxKeys does not set").isNull();
     int maxKeys = 5;
 
     List<S3Object> objectResults = Lists.newArrayListWithCapacity(maxKeys);


Reply via email to