rdblue commented on code in PR #6029:
URL: https://github.com/apache/iceberg/pull/6029#discussion_r1001902318


##########
api/src/test/java/org/apache/iceberg/util/TestExceptionUtil.java:
##########
@@ -37,178 +34,110 @@ private CustomCheckedException(String message) {
   @Test
   public void testRunSafely() {
     CustomCheckedException exc = new CustomCheckedException("test");
-    try {
-      ExceptionUtil.runSafely(
-          () -> {
-            throw exc;
-          },
-          e -> {
-            throw new Exception("test catch suppression");
-          },
-          () -> {
-            throw new RuntimeException("test finally suppression");
-          },
-          CustomCheckedException.class);
-
-      Assert.fail("Should have thrown CustomCheckedException");
-
-    } catch (CustomCheckedException e) {
-      LOG.info("Final exception", e);
-      Assert.assertEquals("Should throw correct exception instance", exc, e);
-      Assert.assertEquals("Should not alter exception message", "test", 
e.getMessage());
-      Assert.assertEquals("Should have 2 suppressed exceptions", 2, 
e.getSuppressed().length);
-
-      Throwable throwSuppressed = e.getSuppressed()[0];
-      Assertions.assertThat(throwSuppressed)
-          .as("Should be an Exception")
-          .isInstanceOf(Exception.class);
-      Assert.assertEquals(
-          "Should have correct message", "test catch suppression", 
throwSuppressed.getMessage());
-
-      Throwable finallySuppressed = e.getSuppressed()[1];
-      Assertions.assertThat(finallySuppressed)
-          .as("Should be a RuntimeException")
-          .isInstanceOf(RuntimeException.class);
-      Assert.assertEquals(
-          "Should have correct message",
-          "test finally suppression",
-          finallySuppressed.getMessage());
-    }
+    Exception suppressedOne = new Exception("test catch suppression");

Review Comment:
   This looks a lot better.



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