You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by GitBox <gi...@apache.org> on 2022/09/10 19:12:11 UTC

[GitHub] [hadoop] aajisaka commented on a diff in pull request #4777: YARN-11261. Upgrade JUnit from 4 to 5 in hadoop-yarn-server-web-proxy

aajisaka commented on code in PR #4777:
URL: https://github.com/apache/hadoop/pull/4777#discussion_r967691879


##########
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-web-proxy/src/test/java/org/apache/hadoop/yarn/server/webproxy/amfilter/TestSecureAmFilter.java:
##########
@@ -88,11 +89,11 @@ public static void setUp() {
       testMiniKDC = new MiniKdc(MiniKdc.createConf(), TEST_ROOT_DIR);
       setupKDC();
     } catch (Exception e) {
-      assertTrue("Couldn't create MiniKDC", false);
+      assertTrue(false, "Couldn't create MiniKDC");

Review Comment:
   Here, we should use `fail("Couldn't create MiniKDC");`
   https://junit.org/junit5/docs/5.8.2/api/org.junit.jupiter.api/org/junit/jupiter/api/Assertions.html#fail(java.lang.String)



##########
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-web-proxy/src/test/java/org/apache/hadoop/yarn/server/webproxy/TestAppReportFetcher.java:
##########
@@ -63,29 +66,29 @@ public void testHelper(boolean isAHSEnabled)
   }
 
   @Test
-  public void testFetchReportAHSEnabled() throws YarnException, IOException {
+  void testFetchReportAHSEnabled() throws YarnException, IOException {
     testHelper(true);
     Mockito.verify(historyManager, Mockito.times(1))
-    .getApplicationReport(Mockito.any(GetApplicationReportRequest.class));
+        .getApplicationReport(Mockito.any(GetApplicationReportRequest.class));
     Mockito.verify(appManager, Mockito.times(1))
-    .getApplicationReport(Mockito.any(GetApplicationReportRequest.class));
+        .getApplicationReport(Mockito.any(GetApplicationReportRequest.class));
   }
 
   @Test
-  public void testFetchReportAHSDisabled() throws YarnException, IOException {
+  void testFetchReportAHSDisabled() throws YarnException, IOException {
     try {
       testHelper(false);
     } catch (ApplicationNotFoundException e) {
-      Assert.assertTrue(e.getMessage() == appNotFoundExceptionMsg);
+      assertTrue(e.getMessage() == appNotFoundExceptionMsg);

Review Comment:
   We can refactor as `assertEquals(appNotFoundExceptionMsg, e.getMessage())`



-- 
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: common-issues-unsubscribe@hadoop.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org