FrankChen021 commented on code in PR #20058:
URL: https://github.com/apache/druid/pull/20058#discussion_r3805092902


##########
server/src/test/java/org/apache/druid/server/log/FileRequestLoggerTest.java:
##########
@@ -112,26 +108,27 @@
     fileRequestLogger.logNativeQuery(nativeRequestLogLine);
     File logFile = new File(logDir, dateTime.toString("yyyy-MM-dd'.log'"));
     Thread.sleep(100);
-    Assert.assertFalse(oldLogFile.exists());
-    Assert.assertTrue(logFile.exists());
+    Assertions.assertFalse(oldLogFile.exists());
+    Assertions.assertTrue(logFile.exists());
     fileRequestLogger.stop();
   }
 
   @Test
-  public void testLogRemoveWithInvalidDuration() throws Exception
+  public void testLogRemoveWithInvalidDuration()
   {
-    expectedException.expect(IllegalArgumentException.class);
-    expectedException.expectMessage("request logs retention period must be 
atleast as long as roll period");
-    ObjectMapper objectMapper = new ObjectMapper();
-    File logDir = temporaryFolder.newFolder();
-    FileRequestLogger fileRequestLogger = new FileRequestLogger(
-        objectMapper,
-        scheduler,
-        logDir,
-        "yyyy-MM-dd'.log'",
-        Duration.standardMinutes(30),
-        Duration.standardDays(1)
-    );
+    Throwable exception = 
Assertions.assertThrows(IllegalArgumentException.class, () -> {
+      ObjectMapper objectMapper = new ObjectMapper();
+      File logDir = temporaryFolder.newFolder();
+      FileRequestLogger fileRequestLogger = new FileRequestLogger(
+          objectMapper,
+          scheduler,
+          logDir,
+          "yyyy-MM-dd'.log'",
+          Duration.standardMinutes(30),
+          Duration.standardDays(1)
+      );

Review Comment:
   Fixed in 1d66e0e97f. This was introduced by the JUnit 4→5 migration: the 
constructor is now invoked as a statement inside assertThrows, so its expected 
IllegalArgumentException and message assertion are preserved without an unread 
local.



-- 
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]


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

Reply via email to