Copilot commented on code in PR #8200:
URL: https://github.com/apache/hbase/pull/8200#discussion_r3221844698
##########
hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSimpleTimeRangeTracker.java:
##########
@@ -17,29 +17,24 @@
*/
package org.apache.hadoop.hbase.regionserver;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.DataOutputStream;
import java.io.IOException;
-import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.io.ByteArrayOutputStream;
import org.apache.hadoop.hbase.io.TimeRange;
+import org.apache.hadoop.hbase.testclassification.MediumTests;
Review Comment:
This PR is scoped as a JUnit5 migration, but `TestSimpleTimeRangeTracker`
changes its test classification from `SmallTests` to `MediumTests`. If this
wasn’t intentional, restore the original `SmallTests` tag to avoid changing how
the test is selected/executed in different build profiles. If it was
intentional, consider adding a brief note in the PR description explaining why
the classification changes.
##########
hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSimpleTimeRangeTracker.java:
##########
@@ -17,29 +17,24 @@
*/
package org.apache.hadoop.hbase.regionserver;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.DataOutputStream;
import java.io.IOException;
-import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.io.ByteArrayOutputStream;
import org.apache.hadoop.hbase.io.TimeRange;
+import org.apache.hadoop.hbase.testclassification.MediumTests;
import org.apache.hadoop.hbase.testclassification.RegionServerTests;
-import org.apache.hadoop.hbase.testclassification.SmallTests;
import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
-import org.junit.ClassRule;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
+import org.junit.jupiter.api.Tag;
+import org.junit.jupiter.api.Test;
-@Category({ RegionServerTests.class, SmallTests.class })
+@Tag(RegionServerTests.TAG)
+@Tag(MediumTests.TAG)
Review Comment:
This PR is scoped as a JUnit5 migration, but `TestSimpleTimeRangeTracker`
changes its test classification from `SmallTests` to `MediumTests`. If this
wasn’t intentional, restore the original `SmallTests` tag to avoid changing how
the test is selected/executed in different build profiles. If it was
intentional, consider adding a brief note in the PR description explaining why
the classification changes.
##########
hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestStoreFileScannerWithTagCompression.java:
##########
@@ -43,25 +42,20 @@
import org.apache.hadoop.hbase.testclassification.SmallTests;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
-import org.junit.BeforeClass;
-import org.junit.ClassRule;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
-@Category({ RegionServerTests.class, SmallTests.class })
[email protected](RegionServerTests.TAG)
[email protected](SmallTests.TAG)
Review Comment:
This file uses fully-qualified `@org.junit.jupiter.api.Tag` while most other
migrated tests import `org.junit.jupiter.api.Tag` and use `@Tag(...)`. For
consistency and readability, import `Tag` and use `@Tag(...)` here as well.
##########
hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSecureBulkLoadManager.java:
##########
@@ -184,17 +179,17 @@ public void run() {
laterBulkload.start();
Threads.shutdown(ealierBulkload);
Threads.shutdown(laterBulkload);
- Assert.assertNull(t1Exception.get());
- Assert.assertNull(t2Exception.get());
+ assertNull(t1Exception.get());
+ assertNull(t2Exception.get());
/// check bulkload ok
Get get1 = new Get(key1);
Get get3 = new Get(key3);
Table t = testUtil.getConnection().getTable(TABLE);
Result r = t.get(get1);
- Assert.assertArrayEquals(r.getValue(FAMILY, COLUMN), value1);
+ assertArrayEquals(r.getValue(FAMILY, COLUMN), value1);
r = t.get(get3);
- Assert.assertArrayEquals(r.getValue(FAMILY, COLUMN), value3);
+ assertArrayEquals(r.getValue(FAMILY, COLUMN), value3);
Review Comment:
JUnit’s `assertArrayEquals` expects `(expected, actual)`. These calls
currently pass the actual value first, which makes failure output misleading.
Swap the arguments to `assertArrayEquals(value1, r.getValue(...))` (and
similarly for `value3`) so expected/actual are reported correctly.
--
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]