gaborkaszab commented on code in PR #17329:
URL: https://github.com/apache/iceberg/pull/17329#discussion_r3657301513
##########
api/src/test/java/org/apache/iceberg/encryption/TestEncryptingFileIO.java:
##########
@@ -151,6 +154,39 @@ public void closeClosesEncryptionManagerWhenCloseable()
throws Exception {
verify((Closeable) em).close();
}
+ @Test
+ public void closeClosesEncryptionManagerWhenFileIOCloseFails() throws
Exception {
+ RuntimeException fileIOFailure = new RuntimeException("FileIO close
failure");
+ EncryptionManager em =
+ mock(EncryptionManager.class,
withSettings().extraInterfaces(Closeable.class));
+ DelegateFileIO delegate = mock(DelegateFileIO.class);
+ doThrow(fileIOFailure).when(delegate).close();
+
+ EncryptingFileIO fileIO = EncryptingFileIO.combine(delegate, em);
+
+ assertThatThrownBy(fileIO::close).isSameAs(fileIOFailure);
Review Comment:
Instead of testing it's the same object, I'd rather assert the exception
type and message.
--
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]