zhongyujiang commented on code in PR #7315:
URL: https://github.com/apache/iceberg/pull/7315#discussion_r1162251882
##########
core/src/test/java/org/apache/iceberg/TestFastAppend.java:
##########
@@ -555,19 +555,22 @@ public void testAppendToBranchEmptyTable() {
@Test
public void testAppendToNullBranchFails() {
- AssertHelpers.assertThrows(
- "Invalid branch",
- IllegalArgumentException.class,
- () -> table.newFastAppend().appendFile(FILE_A).toBranch(null));
+ Assertions.assertThatThrownBy(() ->
table.newFastAppend().appendFile(FILE_A).toBranch(null))
+ .as("Invalid branch")
+ .isInstanceOf(IllegalArgumentException.class)
+ .hasMessageContaining("Invalid branch name: null");
}
@Test
public void testAppendToTagFails() {
table.newFastAppend().appendFile(FILE_A).commit();
table.manageSnapshots().createTag("some-tag",
table.currentSnapshot().snapshotId()).commit();
- AssertHelpers.assertThrows(
- "Invalid branch",
- IllegalArgumentException.class,
- () ->
table.newFastAppend().appendFile(FILE_A).toBranch("some-tag").commit());
+
+ Assertions.assertThatThrownBy(
+ () ->
table.newFastAppend().appendFile(FILE_A).toBranch("some-tag").commit())
+ .as("Invalid branch")
+ .isInstanceOf(IllegalArgumentException.class)
+ .hasMessageContaining(
+ "some-tag is a tag, not a branch. Tags cannot be targets for
producing snapshots");
Review Comment:
@amogh-jahagirdar These two unit tests already test the precondition check,
but the exception msg is not validated, so I updated them.
--
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]