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

ASF GitHub Bot commented on HADOOP-19425:
-----------------------------------------

slfan1989 commented on code in PR #7369:
URL: https://github.com/apache/hadoop/pull/7369#discussion_r1948132038


##########
hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azure/ITestWasbRemoteCallHelper.java:
##########
@@ -434,10 +431,6 @@ class MatchesPattern extends TypeSafeMatcher<String> {
       }
     }
 
-    expectedEx.expectMessage(new MatchesPattern(

Review Comment:
   In JUnit 5, `org.junit.rules.ExpectedException` has been deprecated, and it 
is recommended to use assertThrows to validate exception throwing, as shown 
below:
   
   ```
   import static org.junit.jupiter.api.Assertions.assertThrows;
   
   @Test
   public void shouldThrowException() {
     assertThrows(IllegalArgumentException.class, () -> {
         someMethodThatThrows();
     });
   }
   ```
   
   The change is primarily in syntax, where assertThrows captures exceptions 
via lambda expressions, replacing the ExpectedException rule from JUnit 4. 
However, it does not have any fundamental impact on the logic of unit tests.
   
   I can further improve this unit test to also validate the exception message 
using a regular expression.





> [ABFS] Upgrade JUnit from 4 to 5 in hadoop-azure.
> -------------------------------------------------
>
>                 Key: HADOOP-19425
>                 URL: https://issues.apache.org/jira/browse/HADOOP-19425
>             Project: Hadoop Common
>          Issue Type: Sub-task
>          Components: build, fs/azure, test
>    Affects Versions: 3.5.0
>            Reporter: Shilun Fan
>            Assignee: Shilun Fan
>            Priority: Major
>              Labels: pull-request-available
>




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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to