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


##########
dell/src/test/java/org/apache/iceberg/dell/ecs/TestEcsCatalog.java:
##########
@@ -128,15 +127,13 @@ public void testDropNamespace() {
     ecsCatalog.createNamespace(Namespace.of("a", "b1"));
     ecsCatalog.createTable(TableIdentifier.of("a", "t1"), SCHEMA);
 
-    AssertHelpers.assertThrows(
-        "Drop an unknown namespace should throw exception",
-        NoSuchNamespaceException.class,
-        () -> ecsCatalog.dropNamespace(Namespace.of("unknown")));
+    Assertions.assertThatThrownBy(() -> 
ecsCatalog.dropNamespace(Namespace.of("unknown")))
+        .isInstanceOf(NoSuchNamespaceException.class)
+        .hasMessageContaining("Namespace %s does not exist", "unknown");

Review Comment:
   why not make the namespace name directly part of the expected error msg? 
`"Namespace unknown does not exist"`
   Same for all the other places



##########
dell/src/test/java/org/apache/iceberg/dell/ecs/TestEcsURI.java:
##########
@@ -54,10 +54,9 @@ private void assertURI(String bucket, String name, EcsURI 
ecsURI) {
 
   @Test
   public void testInvalidLocation() {
-    AssertHelpers.assertThrows(
-        "Invalid location should cause exception",
-        ValidationException.class,
-        "http://bucket/a";,
-        () -> new EcsURI("http://bucket/a";));
+
+    Assertions.assertThatThrownBy(() -> new EcsURI("http://bucket/a";))
+        .isInstanceOf(ValidationException.class)
+        .hasMessageContaining("http://bucket/a";);

Review Comment:
   let's generally try and make the error msg check as specific as possible



##########
dell/src/test/java/org/apache/iceberg/dell/ecs/TestEcsOutputFile.java:
##########
@@ -88,10 +88,8 @@ public void testFileAlreadyExists() throws IOException {
       output.write("1234567890".getBytes());
     }
 
-    AssertHelpers.assertThrows(
-        "Create should throw exception",
-        AlreadyExistsException.class,
-        outputFile.location(),
-        outputFile::create);
+    Assertions.assertThatThrownBy(outputFile::create)
+        .isInstanceOf(AlreadyExistsException.class)
+        .hasMessageContaining(outputFile.location());

Review Comment:
   ```suggestion
           .hasMessage("ECS object already exists: " + outputFile.location());
   ```



##########
dell/src/test/java/org/apache/iceberg/dell/ecs/TestEcsTableOperations.java:
##########
@@ -57,15 +57,15 @@ public void testConcurrentCommit() {
     // Use the TableOperations to test the CommitFailedException
     // High level actions, such as Table#updateProperties(), may refresh 
metadata.
     TableOperations operations = ((HasTableOperations) 
catalog2Table).operations();
-    AssertHelpers.assertThrows(
-        "Commit failed when use out-dated status",
-        CommitFailedException.class,
-        () ->
-            operations.commit(
-                operations.current(),
-                TableMetadata.buildFrom(operations.current())
-                    .removeProperties(ImmutableSet.of("a"))
-                    .build()));
+    Assertions.assertThatThrownBy(
+            () ->
+                operations.commit(
+                    operations.current(),
+                    TableMetadata.buildFrom(operations.current())
+                        .removeProperties(ImmutableSet.of("a"))
+                        .build()))
+        .isInstanceOf(CommitFailedException.class)
+        .hasMessageContaining("Replace failed, E-Tag ");

Review Comment:
   ```suggestion
           .hasMessageStartingWith("Replace failed, E-Tag")
           .hasMessageContaining("mismatch for table test2.t1");
   ```



##########
dell/src/test/java/org/apache/iceberg/dell/ecs/TestEcsURI.java:
##########
@@ -54,10 +54,9 @@ private void assertURI(String bucket, String name, EcsURI 
ecsURI) {
 
   @Test
   public void testInvalidLocation() {
-    AssertHelpers.assertThrows(
-        "Invalid location should cause exception",
-        ValidationException.class,
-        "http://bucket/a";,
-        () -> new EcsURI("http://bucket/a";));
+
+    Assertions.assertThatThrownBy(() -> new EcsURI("http://bucket/a";))
+        .isInstanceOf(ValidationException.class)
+        .hasMessageContaining("http://bucket/a";);

Review Comment:
   ```suggestion
           .hasMessage("Invalid ecs location: http://bucket/a";);
   ```



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