Skip to content

Commit

Permalink
HDDS-12130. Improve assertion compatibility with old Hadoop (#7738)
Browse files Browse the repository at this point in the history
  • Loading branch information
adoroszlai authored Jan 24, 2025
1 parent 47525b2 commit c0a6ffd
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ private void validateListingForFile(Path f,
Assertions.assertThat(statusList)
.describedAs(msg)
.hasSize(1);
Assertions.assertThat(statusList.get(0).getPath())
Assertions.assertThatObject(statusList.get(0).getPath())
.describedAs("path returned should match with the input path")
.isEqualTo(f);
Assertions.assertThat(statusList.get(0).isFile())
Expand Down Expand Up @@ -471,7 +471,7 @@ private void verifyStatusArrayMatchesFile(Path f, FileStatus[] status) {
* @param fileStatus status to validate
*/
private void assertIsNamedFile(Path f, FileStatus fileStatus) {
Assertions.assertThat(fileStatus.getPath())
Assertions.assertThatObject(fileStatus.getPath())
.withFailMessage("Wrong pathname in " + fileStatus)
.isEqualTo(f);
Assertions.assertThat(fileStatus.isFile())
Expand Down Expand Up @@ -569,15 +569,15 @@ public void testListStatusFiltering() throws Throwable {

MatchesNameFilter file1Filter = new MatchesNameFilter("file-1.txt");
result = verifyListStatus(1, parent, file1Filter);
Assertions.assertThat(result[0].getPath())
Assertions.assertThatObject(result[0].getPath())
.isEqualTo(file1);

verifyListStatus(0, file1, NO_PATHS);
result = verifyListStatus(1, file1, ALL_PATHS);
Assertions.assertThat(result[0].getPath())
Assertions.assertThatObject(result[0].getPath())
.isEqualTo(file1);
result = verifyListStatus(1, file1, file1Filter);
Assertions.assertThat(result[0].getPath())
Assertions.assertThatObject(result[0].getPath())
.isEqualTo(file1);

// empty subdirectory
Expand Down Expand Up @@ -608,15 +608,15 @@ public void testListLocatedStatusFiltering() throws Throwable {

MatchesNameFilter file1Filter = new MatchesNameFilter("file-1.txt");
result = verifyListLocatedStatus(xfs, 1, parent, file1Filter);
Assertions.assertThat(result.get(0).getPath())
Assertions.assertThatObject(result.get(0).getPath())
.isEqualTo(file1);

verifyListLocatedStatus(xfs, 0, file1, NO_PATHS);
verifyListLocatedStatus(xfs, 1, file1, ALL_PATHS);
Assertions.assertThat(result.get(0).getPath())
Assertions.assertThatObject(result.get(0).getPath())
.isEqualTo(file1);
verifyListLocatedStatus(xfs, 1, file1, file1Filter);
Assertions.assertThat(result.get(0).getPath())
Assertions.assertThatObject(result.get(0).getPath())
.isEqualTo(file1);
verifyListLocatedStatusNextCalls(xfs, 1, file1, file1Filter);

Expand Down

0 comments on commit c0a6ffd

Please sign in to comment.