nastra commented on code in PR #9892: URL: https://github.com/apache/iceberg/pull/9892#discussion_r1517621786
########## core/src/test/java/org/apache/iceberg/TestSnapshotManager.java: ########## @@ -177,120 +177,115 @@ public void testCherryPickFromBranch() { long lastSnapshotId = table.currentSnapshot().snapshotId(); // pick the snapshot into the current state - Assertions.assertThatThrownBy( - () -> table.manageSnapshots().cherrypick(replaceSnapshotId).commit()) + assertThatThrownBy(() -> table.manageSnapshots().cherrypick(replaceSnapshotId).commit()) .isInstanceOf(ValidationException.class) .hasMessageStartingWith( "Cannot cherry-pick overwrite not based on an ancestor of the current state"); - Assert.assertEquals( - "Failed cherry-pick should not change the table state", - lastSnapshotId, - table.currentSnapshot().snapshotId()); + assertThat(table.currentSnapshot().snapshotId()) + .as("Failed cherry-pick should not change the table state") + .isEqualTo(lastSnapshotId); validateTableFiles(table, FILE_A); } - @Test + @TestTemplate public void testCherryPickOverwrite() { table.newAppend().appendFile(FILE_A).commit(); // stage an overwrite to replace FILE_A table.newOverwrite().deleteFile(FILE_A).addFile(REPLACEMENT_FILE_A).stageOnly().commit(); Snapshot staged = Iterables.getLast(table.snapshots()); - Assert.assertEquals( - "Should find the staged overwrite snapshot", DataOperations.OVERWRITE, staged.operation()); + assertThat(staged.operation()) + .as("Should find the staged overwrite snapshot") + .isEqualTo(DataOperations.OVERWRITE); // add another append so that the original commit can't be fast-forwarded table.newAppend().appendFile(FILE_B).commit(); long lastSnapshotId = table.currentSnapshot().snapshotId(); // pick the snapshot into the current state - Assertions.assertThatThrownBy( - () -> table.manageSnapshots().cherrypick(staged.snapshotId()).commit()) + assertThatThrownBy(() -> table.manageSnapshots().cherrypick(staged.snapshotId()).commit()) .isInstanceOf(ValidationException.class) .hasMessageEndingWith("not append, dynamic overwrite, or fast-forward"); - Assert.assertEquals( - "Failed cherry-pick should not change the table state", - lastSnapshotId, - table.currentSnapshot().snapshotId()); + assertThat(table.currentSnapshot().snapshotId()) + .as("Failed cherry-pick should not change the table state") + .isEqualTo(lastSnapshotId); validateTableFiles(table, FILE_A, FILE_B); } - @Test + @TestTemplate public void testCreateBranch() { table.newAppend().appendFile(FILE_A).commit(); long snapshotId = table.currentSnapshot().snapshotId(); // Test a basic case of creating a branch table.manageSnapshots().createBranch("branch1", snapshotId).commit(); SnapshotRef expectedBranch = table.ops().refresh().ref("branch1"); - Assert.assertTrue( - expectedBranch != null - && expectedBranch.equals(SnapshotRef.branchBuilder(snapshotId).build())); + assertThat(expectedBranch).isNotNull(); + assertThat(expectedBranch).isEqualTo(SnapshotRef.branchBuilder(snapshotId).build()); Review Comment: ```suggestion assertThat(expectedBranch).isNotNull().isEqualTo(SnapshotRef.branchBuilder(snapshotId).build()); ``` ########## core/src/test/java/org/apache/iceberg/TestSnapshotManager.java: ########## @@ -177,120 +177,115 @@ public void testCherryPickFromBranch() { long lastSnapshotId = table.currentSnapshot().snapshotId(); // pick the snapshot into the current state - Assertions.assertThatThrownBy( - () -> table.manageSnapshots().cherrypick(replaceSnapshotId).commit()) + assertThatThrownBy(() -> table.manageSnapshots().cherrypick(replaceSnapshotId).commit()) .isInstanceOf(ValidationException.class) .hasMessageStartingWith( "Cannot cherry-pick overwrite not based on an ancestor of the current state"); - Assert.assertEquals( - "Failed cherry-pick should not change the table state", - lastSnapshotId, - table.currentSnapshot().snapshotId()); + assertThat(table.currentSnapshot().snapshotId()) + .as("Failed cherry-pick should not change the table state") + .isEqualTo(lastSnapshotId); validateTableFiles(table, FILE_A); } - @Test + @TestTemplate public void testCherryPickOverwrite() { table.newAppend().appendFile(FILE_A).commit(); // stage an overwrite to replace FILE_A table.newOverwrite().deleteFile(FILE_A).addFile(REPLACEMENT_FILE_A).stageOnly().commit(); Snapshot staged = Iterables.getLast(table.snapshots()); - Assert.assertEquals( - "Should find the staged overwrite snapshot", DataOperations.OVERWRITE, staged.operation()); + assertThat(staged.operation()) + .as("Should find the staged overwrite snapshot") + .isEqualTo(DataOperations.OVERWRITE); // add another append so that the original commit can't be fast-forwarded table.newAppend().appendFile(FILE_B).commit(); long lastSnapshotId = table.currentSnapshot().snapshotId(); // pick the snapshot into the current state - Assertions.assertThatThrownBy( - () -> table.manageSnapshots().cherrypick(staged.snapshotId()).commit()) + assertThatThrownBy(() -> table.manageSnapshots().cherrypick(staged.snapshotId()).commit()) .isInstanceOf(ValidationException.class) .hasMessageEndingWith("not append, dynamic overwrite, or fast-forward"); - Assert.assertEquals( - "Failed cherry-pick should not change the table state", - lastSnapshotId, - table.currentSnapshot().snapshotId()); + assertThat(table.currentSnapshot().snapshotId()) + .as("Failed cherry-pick should not change the table state") + .isEqualTo(lastSnapshotId); validateTableFiles(table, FILE_A, FILE_B); } - @Test + @TestTemplate public void testCreateBranch() { table.newAppend().appendFile(FILE_A).commit(); long snapshotId = table.currentSnapshot().snapshotId(); // Test a basic case of creating a branch table.manageSnapshots().createBranch("branch1", snapshotId).commit(); SnapshotRef expectedBranch = table.ops().refresh().ref("branch1"); - Assert.assertTrue( - expectedBranch != null - && expectedBranch.equals(SnapshotRef.branchBuilder(snapshotId).build())); + assertThat(expectedBranch).isNotNull(); Review Comment: ```suggestion ``` -- 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