chinmay-bhat commented on code in PR #9341:
URL: https://github.com/apache/iceberg/pull/9341#discussion_r1431347428


##########
spark/v3.5/spark/src/test/java/org/apache/iceberg/spark/data/GenericsHelpers.java:
##########
@@ -116,88 +116,91 @@ private static void assertEqualsSafe(Type type, Object 
expected, Object actual)
       case LONG:
       case FLOAT:
       case DOUBLE:
-        Assert.assertEquals("Primitive value should be equal to expected", 
expected, actual);
+        assertThat(expected).as("Primitive value should be equal to 
expected").isEqualTo(actual);
         break;
       case DATE:
-        Assertions.assertThat(expected)
+        assertThat(expected)
             .as("Should expect a LocalDate")
             .isInstanceOf(LocalDate.class);
-        Assertions.assertThat(actual).as("Should be a 
Date").isInstanceOf(Date.class);
-        Assert.assertEquals(
-            "ISO-8601 date should be equal", expected.toString(), 
actual.toString());
+        assertThat(actual).as("Should be a Date").isInstanceOf(Date.class);
+        assertThat(actual.toString())
+                .as("ISO-8601 date should be equal")
+                .isEqualTo(String.valueOf(expected));
         break;
       case TIMESTAMP:
         Types.TimestampType timestampType = (Types.TimestampType) type;
         if (timestampType.shouldAdjustToUTC()) {
           // Timestamptz
-          Assertions.assertThat(actual).as("Should be a 
Timestamp").isInstanceOf(Timestamp.class);
+          assertThat(actual).as("Should be a 
Timestamp").isInstanceOf(Timestamp.class);
           Timestamp ts = (Timestamp) actual;
           // milliseconds from nanos has already been added by getTime
           OffsetDateTime actualTs =
               EPOCH.plusNanos((ts.getTime() * 1_000_000) + (ts.getNanos() % 
1_000_000));
 
-          Assertions.assertThat(expected)
+          assertThat(expected)
               .as("Should expect an OffsetDateTime")
               .isInstanceOf(OffsetDateTime.class);
-          Assert.assertEquals("Timestamp should be equal", expected, actualTs);
+
+          assertThat(actualTs).as("Timestamp should be 
equal").isEqualTo(expected);
         } else {
           // Timestamp
-          Assertions.assertThat(actual)
+          assertThat(actual)
               .as("Should be a LocalDateTime")
               .isInstanceOf(LocalDateTime.class);
-          LocalDateTime ts = (LocalDateTime) actual;
 
-          Assertions.assertThat(expected)
+          assertThat(expected)
               .as("Should expect an LocalDateTime")
               .isInstanceOf(LocalDateTime.class);
-          Assert.assertEquals("Timestamp should be equal", expected, ts);
+
+          assertThat(actual).as("Timestamp should be 
equal").isEqualTo(expected);
         }
         break;
       case STRING:
-        Assertions.assertThat(actual).as("Should be a 
String").isInstanceOf(String.class);
-        Assert.assertEquals("Strings should be equal", 
String.valueOf(expected), actual);
+        assertThat(actual).as("Should be a String").isInstanceOf(String.class);
+        assertThat(actual.toString()).as("Strings should be 
equal").isEqualTo(String.valueOf(expected));

Review Comment:
   Maybe this can be further simplified? Any input would be great!



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