Copilot commented on code in PR #19875:
URL: https://github.com/apache/druid/pull/19875#discussion_r3717412960


##########
extensions-core/testing-tools/src/test/java/org/apache/druid/query/expressions/SleepExprTest.java:
##########
@@ -59,10 +59,10 @@ private void assertTimeElapsed(String expression, long 
expectedTimeElapsedMs)
     expr.eval(InputBindings.nilBindings()).value();
     final long after = System.currentTimeMillis();
     final long elapsed = after - before;
-    Assert.assertTrue(
-        StringUtils.format("Expected [%s], but actual elapsed was [%s]", 
expectedTimeElapsedMs, elapsed),
+    Assertions.assertTrue(
         elapsed >= expectedTimeElapsedMs
-        && elapsed < expectedTimeElapsedMs + detla
+        && elapsed < expectedTimeElapsedMs + detla,
+        StringUtils.format("Expected [%s], but actual elapsed was [%s]", 
expectedTimeElapsedMs, elapsed)

Review Comment:
   The tolerance variable is named `detla`, which looks like a typo and reduces 
readability. Renaming it to `deltaMs` (or similar) will make the assertion 
clearer.



##########
extensions-core/druid-bloom-filter/src/test/java/org/apache/druid/query/aggregation/bloom/BloomFilterGroupByQueryTest.java:
##########
@@ -97,15 +94,17 @@ public static Collection<?> constructorFeeder()
     return constructors;
   }
 
-  @After
+  @AfterEach
   public void teardown() throws IOException
   {
     helper.close();
   }

Review Comment:
   `teardown()` unconditionally calls `helper.close()`. If 
`initBloomFilterGroupByQueryTest` fails (or `helper` was never initialized), 
this will throw a NullPointerException and can mask the real test failure.



##########
extensions-core/ec2-extensions/src/test/java/org/apache/druid/indexing/overlord/autoscaling/ec2/EC2AutoScalerTest.java:
##########
@@ -119,13 +119,13 @@ public void testScale()
 
     AutoScalingData created = autoScaler.provision();
 
-    Assert.assertEquals(created.getNodeIds().size(), 1);
-    Assert.assertEquals("theInstance", created.getNodeIds().get(0));
+    Assertions.assertEquals(created.getNodeIds().size(), 1);
+    Assertions.assertEquals("theInstance", created.getNodeIds().get(0));
 
     AutoScalingData deleted = 
autoScaler.terminate(Collections.singletonList("dummyIP"));
 
-    Assert.assertEquals(deleted.getNodeIds().size(), 1);
-    Assert.assertEquals(INSTANCE_ID, deleted.getNodeIds().get(0));
+    Assertions.assertEquals(deleted.getNodeIds().size(), 1);
+    Assertions.assertEquals(INSTANCE_ID, deleted.getNodeIds().get(0));

Review Comment:
   `Assertions.assertEquals` takes arguments in `expected, actual` order. 
Passing `created.getNodeIds().size()` as the expected value makes failures 
harder to interpret; swap the arguments to keep expected constants first.



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