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


##########
extensions-contrib/influxdb-emitter/src/test/java/org/apache/druid/emitter/influxdb/InfluxdbEmitterConfigTest.java:
##########
@@ -79,27 +81,29 @@
         "password",
         null
     );
-    Assert.assertNotEquals(influxdbEmitterConfig, 
influxdbEmitterConfigComparison);
+    Assertions.assertNotEquals(influxdbEmitterConfig, 
influxdbEmitterConfigComparison);
   }
 
-  @Test(expected = NullPointerException.class)
+  @Test
   public void testConfigWithNullHostname()
   {
-    InfluxdbEmitterConfig influxdbEmitterConfigWithNullHostname = new 
InfluxdbEmitterConfig(
-        null,
-        8080,
-        null,
-        null,
-        null,
-        null,
-        "dbname",
-        10000,
-        15000,
-        30000,
-        "adam",
-        "password",
-        null
-    );
+    assertThrows(NullPointerException.class, () -> {
+      InfluxdbEmitterConfig influxdbEmitterConfigWithNullHostname = new 
InfluxdbEmitterConfig(
+          null,
+          8080,
+          null,
+          null,
+          null,
+          null,
+          "dbname",
+          10000,
+          15000,
+          30000,
+          "adam",
+          "password",
+          null
+      );

Review Comment:
   Thanks for flagging this. The unused `InfluxdbEmitterConfig 
influxdbEmitterConfigWithNullHostname` assignment predates this JUnit 
migration; this change only moves the JUnit 4 `@Test(expected = ...)` body into 
JUnit 5 `assertThrows`. The constructor call remains intentional inside 
`assertThrows` because constructing the config is the behavior under test and 
must execute to verify the expected exception. Cleanup of the unused local is 
deferred and out of scope for this migration.



##########
extensions-contrib/influxdb-emitter/src/test/java/org/apache/druid/emitter/influxdb/InfluxdbEmitterConfigTest.java:
##########
@@ -163,47 +167,51 @@
         "password",
         null
     );
-    
Assert.assertFalse(influxdbEmitterConfig.equals(influxdbEmitterConfigComparison));
+    
Assertions.assertFalse(influxdbEmitterConfig.equals(influxdbEmitterConfigComparison));
   }
 
-  @Test(expected = NullPointerException.class)
+  @Test
   public void testConfigWithNullInfluxdbUserName()
   {
-    InfluxdbEmitterConfig influxdbEmitterConfigWithNullHostname = new 
InfluxdbEmitterConfig(
-        "localhost",
-        8086,
-        null,
-        null,
-        null,
-        null,
-        "dbname",
-        10000,
-        15000,
-        30000,
-        null,
-        "password",
-        null
-    );
+    assertThrows(NullPointerException.class, () -> {
+      InfluxdbEmitterConfig influxdbEmitterConfigWithNullHostname = new 
InfluxdbEmitterConfig(
+          "localhost",
+          8086,
+          null,
+          null,
+          null,
+          null,
+          "dbname",
+          10000,
+          15000,
+          30000,
+          null,
+          "password",
+          null
+      );

Review Comment:
   Thanks for flagging this. The unused `InfluxdbEmitterConfig 
influxdbEmitterConfigWithNullHostname` assignment predates this JUnit 
migration; this change only moves the JUnit 4 `@Test(expected = ...)` body into 
JUnit 5 `assertThrows`. The constructor call remains intentional inside 
`assertThrows` because constructing the config is the behavior under test and 
must execute to verify the expected exception. Cleanup of the unused local is 
deferred and out of scope for this migration.



##########
extensions-contrib/influxdb-emitter/src/test/java/org/apache/druid/emitter/influxdb/InfluxdbEmitterConfigTest.java:
##########
@@ -163,47 +167,51 @@
         "password",
         null
     );
-    
Assert.assertFalse(influxdbEmitterConfig.equals(influxdbEmitterConfigComparison));
+    
Assertions.assertFalse(influxdbEmitterConfig.equals(influxdbEmitterConfigComparison));
   }
 
-  @Test(expected = NullPointerException.class)
+  @Test
   public void testConfigWithNullInfluxdbUserName()
   {
-    InfluxdbEmitterConfig influxdbEmitterConfigWithNullHostname = new 
InfluxdbEmitterConfig(
-        "localhost",
-        8086,
-        null,
-        null,
-        null,
-        null,
-        "dbname",
-        10000,
-        15000,
-        30000,
-        null,
-        "password",
-        null
-    );
+    assertThrows(NullPointerException.class, () -> {
+      InfluxdbEmitterConfig influxdbEmitterConfigWithNullHostname = new 
InfluxdbEmitterConfig(
+          "localhost",
+          8086,
+          null,
+          null,
+          null,
+          null,
+          "dbname",
+          10000,
+          15000,
+          30000,
+          null,
+          "password",
+          null
+      );
+    });
   }
 
-  @Test(expected = NullPointerException.class)
+  @Test
   public void testConfigWithNullInfluxdbPassword()
   {
-    InfluxdbEmitterConfig influxdbEmitterConfigWithNullHostname = new 
InfluxdbEmitterConfig(
-        "localhost",
-        8086,
-        null,
-        null,
-        null,
-        null,
-        "dbname",
-        10000,
-        15000,
-        30000,
-        "adam",
-        null,
-        null
-    );
+    assertThrows(NullPointerException.class, () -> {
+      InfluxdbEmitterConfig influxdbEmitterConfigWithNullHostname = new 
InfluxdbEmitterConfig(
+          "localhost",
+          8086,
+          null,
+          null,
+          null,
+          null,
+          "dbname",
+          10000,
+          15000,
+          30000,
+          "adam",
+          null,
+          null
+      );

Review Comment:
   Thanks for flagging this. The unused `InfluxdbEmitterConfig 
influxdbEmitterConfigWithNullHostname` assignment predates this JUnit 
migration; this change only moves the JUnit 4 `@Test(expected = ...)` body into 
JUnit 5 `assertThrows`. The constructor call remains intentional inside 
`assertThrows` because constructing the config is the behavior under test and 
must execute to verify the expected exception. Cleanup of the unused local is 
deferred and out of scope for this migration.



##########
extensions-contrib/influxdb-emitter/src/test/java/org/apache/druid/emitter/influxdb/InfluxdbEmitterTest.java:
##########
@@ -219,97 +221,105 @@
     String expected = 
"druid_metric,service=druid/historical,hostname=localhost,dataSource=wikipedia,taskType=index
 druid_time=1234 1509357600000000000"
                       + "\n";
     String actual = influxdbEmitter.transformForInfluxSystems(event);
-    Assert.assertEquals(expected, actual);
+    Assertions.assertEquals(expected, actual);
   }
 
   @Test
   public void testJacksonModules()
   {
-    Assert.assertTrue(new 
InfluxdbEmitterModule().getJacksonModules().isEmpty());
+    Assertions.assertTrue(new 
InfluxdbEmitterModule().getJacksonModules().isEmpty());
   }
 
-  @Test(expected = IllegalStateException.class)
+  @Test
   public void testBuildInfluxdbClientWithHttpsProtocolAndNoTrustStore()
   {
-    InfluxdbEmitterConfig config = new InfluxdbEmitterConfig(
-        "localhost",
-        8086,
-        "https",
-        null,
-        null,
-        null,
-        "dbname",
-        10000,
-        15000,
-        30000,
-        "adam",
-        "password",
-        null
-    );
-    InfluxdbEmitter influxdbEmitter = new InfluxdbEmitter(config);
+    assertThrows(IllegalStateException.class, () -> {
+      InfluxdbEmitterConfig config = new InfluxdbEmitterConfig(
+          "localhost",
+          8086,
+          "https",
+          null,
+          null,
+          null,
+          "dbname",
+          10000,
+          15000,
+          30000,
+          "adam",
+          "password",
+          null
+      );
+      InfluxdbEmitter influxdbEmitter = new InfluxdbEmitter(config);

Review Comment:
   Thanks for flagging this. The unused `InfluxdbEmitter influxdbEmitter` 
assignment predates this JUnit migration; this change only moves the JUnit 4 
`@Test(expected = ...)` body into JUnit 5 `assertThrows`. The constructor call 
remains intentional inside `assertThrows` because constructing the emitter is 
the behavior under test and must execute to verify the expected exception. 
Cleanup of the unused local is deferred and out of scope for this migration.



##########
extensions-contrib/influxdb-emitter/src/test/java/org/apache/druid/emitter/influxdb/InfluxdbEmitterTest.java:
##########
@@ -219,97 +221,105 @@
     String expected = 
"druid_metric,service=druid/historical,hostname=localhost,dataSource=wikipedia,taskType=index
 druid_time=1234 1509357600000000000"
                       + "\n";
     String actual = influxdbEmitter.transformForInfluxSystems(event);
-    Assert.assertEquals(expected, actual);
+    Assertions.assertEquals(expected, actual);
   }
 
   @Test
   public void testJacksonModules()
   {
-    Assert.assertTrue(new 
InfluxdbEmitterModule().getJacksonModules().isEmpty());
+    Assertions.assertTrue(new 
InfluxdbEmitterModule().getJacksonModules().isEmpty());
   }
 
-  @Test(expected = IllegalStateException.class)
+  @Test
   public void testBuildInfluxdbClientWithHttpsProtocolAndNoTrustStore()
   {
-    InfluxdbEmitterConfig config = new InfluxdbEmitterConfig(
-        "localhost",
-        8086,
-        "https",
-        null,
-        null,
-        null,
-        "dbname",
-        10000,
-        15000,
-        30000,
-        "adam",
-        "password",
-        null
-    );
-    InfluxdbEmitter influxdbEmitter = new InfluxdbEmitter(config);
+    assertThrows(IllegalStateException.class, () -> {
+      InfluxdbEmitterConfig config = new InfluxdbEmitterConfig(
+          "localhost",
+          8086,
+          "https",
+          null,
+          null,
+          null,
+          "dbname",
+          10000,
+          15000,
+          30000,
+          "adam",
+          "password",
+          null
+      );
+      InfluxdbEmitter influxdbEmitter = new InfluxdbEmitter(config);
+    });
   }
 
-  @Test(expected = IllegalStateException.class)
+  @Test
   public void testBuildInfluxdbClientWithHttpsProtocolAndNullTrustStorePath()
   {
-    InfluxdbEmitterConfig config = new InfluxdbEmitterConfig(
-        "localhost",
-        8086,
-        "https",
-        null,
-        null,
-        "pass",
-        "dbname",
-        10000,
-        15000,
-        30000,
-        "adam",
-        "password",
-        null
-    );
-    InfluxdbEmitter influxdbEmitter = new InfluxdbEmitter(config);
+    assertThrows(IllegalStateException.class, () -> {
+      InfluxdbEmitterConfig config = new InfluxdbEmitterConfig(
+          "localhost",
+          8086,
+          "https",
+          null,
+          null,
+          "pass",
+          "dbname",
+          10000,
+          15000,
+          30000,
+          "adam",
+          "password",
+          null
+      );
+      InfluxdbEmitter influxdbEmitter = new InfluxdbEmitter(config);

Review Comment:
   Thanks for flagging this. The unused `InfluxdbEmitter influxdbEmitter` 
assignment predates this JUnit migration; this change only moves the JUnit 4 
`@Test(expected = ...)` body into JUnit 5 `assertThrows`. The constructor call 
remains intentional inside `assertThrows` because constructing the emitter is 
the behavior under test and must execute to verify the expected exception. 
Cleanup of the unused local is deferred and out of scope for this migration.



##########
extensions-contrib/influxdb-emitter/src/test/java/org/apache/druid/emitter/influxdb/InfluxdbEmitterTest.java:
##########
@@ -219,97 +221,105 @@
     String expected = 
"druid_metric,service=druid/historical,hostname=localhost,dataSource=wikipedia,taskType=index
 druid_time=1234 1509357600000000000"
                       + "\n";
     String actual = influxdbEmitter.transformForInfluxSystems(event);
-    Assert.assertEquals(expected, actual);
+    Assertions.assertEquals(expected, actual);
   }
 
   @Test
   public void testJacksonModules()
   {
-    Assert.assertTrue(new 
InfluxdbEmitterModule().getJacksonModules().isEmpty());
+    Assertions.assertTrue(new 
InfluxdbEmitterModule().getJacksonModules().isEmpty());
   }
 
-  @Test(expected = IllegalStateException.class)
+  @Test
   public void testBuildInfluxdbClientWithHttpsProtocolAndNoTrustStore()
   {
-    InfluxdbEmitterConfig config = new InfluxdbEmitterConfig(
-        "localhost",
-        8086,
-        "https",
-        null,
-        null,
-        null,
-        "dbname",
-        10000,
-        15000,
-        30000,
-        "adam",
-        "password",
-        null
-    );
-    InfluxdbEmitter influxdbEmitter = new InfluxdbEmitter(config);
+    assertThrows(IllegalStateException.class, () -> {
+      InfluxdbEmitterConfig config = new InfluxdbEmitterConfig(
+          "localhost",
+          8086,
+          "https",
+          null,
+          null,
+          null,
+          "dbname",
+          10000,
+          15000,
+          30000,
+          "adam",
+          "password",
+          null
+      );
+      InfluxdbEmitter influxdbEmitter = new InfluxdbEmitter(config);
+    });
   }
 
-  @Test(expected = IllegalStateException.class)
+  @Test
   public void testBuildInfluxdbClientWithHttpsProtocolAndNullTrustStorePath()
   {
-    InfluxdbEmitterConfig config = new InfluxdbEmitterConfig(
-        "localhost",
-        8086,
-        "https",
-        null,
-        null,
-        "pass",
-        "dbname",
-        10000,
-        15000,
-        30000,
-        "adam",
-        "password",
-        null
-    );
-    InfluxdbEmitter influxdbEmitter = new InfluxdbEmitter(config);
+    assertThrows(IllegalStateException.class, () -> {
+      InfluxdbEmitterConfig config = new InfluxdbEmitterConfig(
+          "localhost",
+          8086,
+          "https",
+          null,
+          null,
+          "pass",
+          "dbname",
+          10000,
+          15000,
+          30000,
+          "adam",
+          "password",
+          null
+      );
+      InfluxdbEmitter influxdbEmitter = new InfluxdbEmitter(config);
+    });
   }
 
-  @Test(expected = IllegalStateException.class)
+  @Test
   public void 
testBuildInfluxdbClientWithHttpsProtocolAndNullTrustStorePassword()
   {
-    InfluxdbEmitterConfig config = new InfluxdbEmitterConfig(
-        "localhost",
-        8086,
-        "https",
-        "path",
-        null,
-        null,
-        "dbname",
-        10000,
-        15000,
-        30000,
-        "adam",
-        "password",
-        null
-    );
-    InfluxdbEmitter influxdbEmitter = new InfluxdbEmitter(config);
+    assertThrows(IllegalStateException.class, () -> {
+      InfluxdbEmitterConfig config = new InfluxdbEmitterConfig(
+          "localhost",
+          8086,
+          "https",
+          "path",
+          null,
+          null,
+          "dbname",
+          10000,
+          15000,
+          30000,
+          "adam",
+          "password",
+          null
+      );
+      InfluxdbEmitter influxdbEmitter = new InfluxdbEmitter(config);

Review Comment:
   Thanks for flagging this. The unused `InfluxdbEmitter influxdbEmitter` 
assignment predates this JUnit migration; this change only moves the JUnit 4 
`@Test(expected = ...)` body into JUnit 5 `assertThrows`. The constructor call 
remains intentional inside `assertThrows` because constructing the emitter is 
the behavior under test and must execute to verify the expected exception. 
Cleanup of the unused local is deferred and out of scope for this migration.



##########
extensions-contrib/influxdb-emitter/src/test/java/org/apache/druid/emitter/influxdb/InfluxdbEmitterTest.java:
##########
@@ -219,97 +221,105 @@
     String expected = 
"druid_metric,service=druid/historical,hostname=localhost,dataSource=wikipedia,taskType=index
 druid_time=1234 1509357600000000000"
                       + "\n";
     String actual = influxdbEmitter.transformForInfluxSystems(event);
-    Assert.assertEquals(expected, actual);
+    Assertions.assertEquals(expected, actual);
   }
 
   @Test
   public void testJacksonModules()
   {
-    Assert.assertTrue(new 
InfluxdbEmitterModule().getJacksonModules().isEmpty());
+    Assertions.assertTrue(new 
InfluxdbEmitterModule().getJacksonModules().isEmpty());
   }
 
-  @Test(expected = IllegalStateException.class)
+  @Test
   public void testBuildInfluxdbClientWithHttpsProtocolAndNoTrustStore()
   {
-    InfluxdbEmitterConfig config = new InfluxdbEmitterConfig(
-        "localhost",
-        8086,
-        "https",
-        null,
-        null,
-        null,
-        "dbname",
-        10000,
-        15000,
-        30000,
-        "adam",
-        "password",
-        null
-    );
-    InfluxdbEmitter influxdbEmitter = new InfluxdbEmitter(config);
+    assertThrows(IllegalStateException.class, () -> {
+      InfluxdbEmitterConfig config = new InfluxdbEmitterConfig(
+          "localhost",
+          8086,
+          "https",
+          null,
+          null,
+          null,
+          "dbname",
+          10000,
+          15000,
+          30000,
+          "adam",
+          "password",
+          null
+      );
+      InfluxdbEmitter influxdbEmitter = new InfluxdbEmitter(config);
+    });
   }
 
-  @Test(expected = IllegalStateException.class)
+  @Test
   public void testBuildInfluxdbClientWithHttpsProtocolAndNullTrustStorePath()
   {
-    InfluxdbEmitterConfig config = new InfluxdbEmitterConfig(
-        "localhost",
-        8086,
-        "https",
-        null,
-        null,
-        "pass",
-        "dbname",
-        10000,
-        15000,
-        30000,
-        "adam",
-        "password",
-        null
-    );
-    InfluxdbEmitter influxdbEmitter = new InfluxdbEmitter(config);
+    assertThrows(IllegalStateException.class, () -> {
+      InfluxdbEmitterConfig config = new InfluxdbEmitterConfig(
+          "localhost",
+          8086,
+          "https",
+          null,
+          null,
+          "pass",
+          "dbname",
+          10000,
+          15000,
+          30000,
+          "adam",
+          "password",
+          null
+      );
+      InfluxdbEmitter influxdbEmitter = new InfluxdbEmitter(config);
+    });
   }
 
-  @Test(expected = IllegalStateException.class)
+  @Test
   public void 
testBuildInfluxdbClientWithHttpsProtocolAndNullTrustStorePassword()
   {
-    InfluxdbEmitterConfig config = new InfluxdbEmitterConfig(
-        "localhost",
-        8086,
-        "https",
-        "path",
-        null,
-        null,
-        "dbname",
-        10000,
-        15000,
-        30000,
-        "adam",
-        "password",
-        null
-    );
-    InfluxdbEmitter influxdbEmitter = new InfluxdbEmitter(config);
+    assertThrows(IllegalStateException.class, () -> {
+      InfluxdbEmitterConfig config = new InfluxdbEmitterConfig(
+          "localhost",
+          8086,
+          "https",
+          "path",
+          null,
+          null,
+          "dbname",
+          10000,
+          15000,
+          30000,
+          "adam",
+          "password",
+          null
+      );
+      InfluxdbEmitter influxdbEmitter = new InfluxdbEmitter(config);
+    });
   }
 
-  @Test(expected = IllegalStateException.class)
+  @Test
   public void testUnableToLoadTrustStore()
   {
-    InfluxdbEmitterConfig config = new InfluxdbEmitterConfig(
-        "localhost",
-        8086,
-        "https",
-        "path",
-        null,
-        "pass",
-        "dbname",
-        10000,
-        15000,
-        30000,
-        "adam",
-        "password",
-        null
-    );
-    InfluxdbEmitter influxdbEmitter = new InfluxdbEmitter(config);
+    assertThrows(IllegalStateException.class, () -> {
+      InfluxdbEmitterConfig config = new InfluxdbEmitterConfig(
+          "localhost",
+          8086,
+          "https",
+          "path",
+          null,
+          "pass",
+          "dbname",
+          10000,
+          15000,
+          30000,
+          "adam",
+          "password",
+          null
+      );
+      InfluxdbEmitter influxdbEmitter = new InfluxdbEmitter(config);

Review Comment:
   Thanks for flagging this. The unused `InfluxdbEmitter influxdbEmitter` 
assignment predates this JUnit migration; this change only moves the JUnit 4 
`@Test(expected = ...)` body into JUnit 5 `assertThrows`. The constructor call 
remains intentional inside `assertThrows` because constructing the emitter is 
the behavior under test and must execute to verify the expected exception. 
Cleanup of the unused local is deferred and out of scope for this migration.



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