Copilot commented on code in PR #7861:
URL: https://github.com/apache/hbase/pull/7861#discussion_r2981829035
##########
hbase-mapreduce/src/test/java/org/apache/hadoop/hbase/mapreduce/MRIncrementalLoadTestBase.java:
##########
@@ -169,10 +172,10 @@ public void doIncrementalLoadTest() throws Exception {
}
}
}
- assertEquals("Column family not found in FS.", FAMILIES.length, dir);
+ assertEquals(FAMILIES.length, dir, "Column family not found in FS.");
}
if (writeMultipleTables) {
- assertEquals("Dir for all input tables not created", numTableDirs,
allTables.size());
+ assertEquals(numTableDirs, allTables.size(), "Dir for all input tables
not created");
Review Comment:
This `assertEquals` also has expected/actual reversed (`numTableDirs` is the
measured value, `allTables.size()` is the expected count). Swapping the
parameters will make assertion failure output correctly describe what was
expected vs what was observed.
```suggestion
assertEquals(allTables.size(), numTableDirs, "Dir for all input tables
not created");
```
##########
hbase-mapreduce/src/test/java/org/apache/hadoop/hbase/mapreduce/MRIncrementalLoadTestBase.java:
##########
@@ -110,17 +102,16 @@ public void setUp() throws IOException {
Table table = UTIL.createTable(tableName, FAMILIES, splitKeys);
RegionLocator r = UTIL.getConnection().getRegionLocator(tableName);
- assertEquals("Should start with empty table", 0,
HBaseTestingUtil.countRows(table));
+ assertEquals(0, HBaseTestingUtil.countRows(table), "Should start with
empty table");
int numRegions = r.getStartKeys().length;
- assertEquals("Should make " + regionNum + " regions", numRegions,
regionNum);
+ assertEquals(numRegions, regionNum, "Should make " + regionNum + "
regions");
Review Comment:
In JUnit assertions, expected/actual order appears reversed, which makes
failures harder to interpret. For example, this compares `numRegions` (actual)
against `regionNum` (expected) but passes them as expected/actual in the
opposite order. Please swap the arguments so the expected value is `regionNum`
and the actual value is `numRegions` (and similarly for the later
`numTableDirs` vs `allTables.size()` assertion).
```suggestion
assertEquals(regionNum, numRegions, "Should make " + regionNum + "
regions");
```
--
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]