[ 
https://issues.apache.org/jira/browse/HDFS-12431?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18016225#comment-18016225
 ] 

ASF GitHub Bot commented on HDFS-12431:
---------------------------------------

Copilot commented on code in PR #7895:
URL: https://github.com/apache/hadoop/pull/7895#discussion_r2300174122


##########
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/snapshot/TestSnapshotFileLength.java:
##########
@@ -26,15 +26,14 @@
 import org.apache.hadoop.fs.FileStatus;
 import org.apache.hadoop.hdfs.AppendTestUtil;
 import org.apache.hadoop.hdfs.DFSConfigKeys;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.not;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Timeout;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
+import static org.assertj.core.api.Assertions.assertThat;

Review Comment:
   The import should use JUnit 5 assertions instead of AssertJ. Replace `import 
static org.assertj.core.api.Assertions.assertThat;` with `import static 
org.junit.jupiter.api.Assertions.assertThat;` to maintain consistency with the 
rest of the migration.
   ```suggestion
   import static org.junit.jupiter.api.Assertions.assertThat;
   ```



##########
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/snapshot/TestRenameWithOrderedSnapshotDeletion.java:
##########
@@ -101,10 +102,10 @@ public void testRename() throws Exception {
   private void validateRename(Path src, Path dest) {
     try {
       hdfs.rename(src, dest);
-      Assert.fail("Expected exception not thrown.");
+      Assertions.fail("Expected exception not thrown.");
     } catch (IOException ioe) {
-      Assert.assertTrue(ioe.getMessage().contains("are not under the" +
-          " same snapshot root."));
+      Assertions
+          .assertTrue(ioe.getMessage().contains("are not under the" +          
" same snapshot root."));

Review Comment:
   [nitpick] The string concatenation is split awkwardly across the line break. 
Consider keeping the complete string on one line or properly formatting the 
concatenation for better readability.
   ```suggestion
         Assertions.assertTrue(ioe.getMessage().contains("are not under the 
same snapshot root."));
   ```



##########
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/snapshot/TestSnapshot.java:
##########
@@ -473,7 +472,8 @@ public void testSnapshotMtime() throws Exception {
         newSnapshotStatus.getModificationTime());
   }
 
-  @Test(timeout = 60000)
+@Test
+@Timeout(value = 60)

Review Comment:
   [nitpick] Inconsistent formatting for the @Test and @Timeout annotations. 
Most other test methods in the migration have these on the same line or with 
consistent spacing.
   ```suggestion
   @Test @Timeout(value = 60)
   ```





> Upgrade JUnit from 4 to 5 in hadoop-hdfs hdfs  
> -----------------------------------------------
>
>                 Key: HDFS-12431
>                 URL: https://issues.apache.org/jira/browse/HDFS-12431
>             Project: Hadoop HDFS
>          Issue Type: Sub-task
>          Components: test
>            Reporter: Ajay Kumar
>            Assignee: Hualong Zhang
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 3.5.0
>
>
> Upgrade JUnit from 4 to 5 in hadoop-hdfs hdfs (i.e org.apache.hadoop.hdfs)



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org

Reply via email to