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


##########
core/src/test/java/org/apache/iceberg/jdbc/TestJdbcCatalog.java:
##########
@@ -970,6 +976,51 @@ public void testCatalogWithCustomMetricsReporter() throws 
IOException {
     Assertions.assertThat(CustomMetricsReporter.COUNTER.get()).isEqualTo(2);
   }
 
+  @Test
+  public void testCommitExceptionWithoutMessage() {

Review Comment:
   can be simplified to 
   ```
   @Test
     public void testCommitExceptionWithoutMessage() {
       TableIdentifier tableIdent = TableIdentifier.of("db", "tbl");
       BaseTable table = (BaseTable) catalog.buildTable(tableIdent, 
SCHEMA).create();
       TableOperations ops = table.operations();
       TableMetadata metadataV1 = ops.current();
   
       table.updateSchema().addColumn("n", Types.IntegerType.get()).commit();
       ops.refresh();
   
       try (MockedStatic<JdbcUtil> mockedStatic = 
Mockito.mockStatic(JdbcUtil.class)) {
         mockedStatic
             .when(() -> JdbcUtil.loadTable(any(), any(), any(), any()))
             .thenThrow(new SQLException());
         assertThatThrownBy(() -> ops.commit(ops.current(), metadataV1))
             .isInstanceOf(UncheckedSQLException.class)
             .hasMessageStartingWith("Unknown failure");
       }
     }
   ```
   
   please also update the other tests accordingly. The spying on `ops` isn't 
necessary here, because you're throwing the exception when the table/view is 
being loaded (which is different from 
https://github.com/apache/iceberg/pull/10069)



-- 
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: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to