chia7712 commented on code in PR #16253:
URL: https://github.com/apache/kafka/pull/16253#discussion_r1632146085


##########
connect/runtime/src/test/java/org/apache/kafka/connect/integration/RebalanceSourceConnectorsIntegrationTest.java:
##########
@@ -350,16 +350,14 @@ private boolean 
assertConnectorAndTasksAreUniqueAndBalanced() {
             log.debug("Connector balance: {}", formatAssignment(connectors));
             log.debug("Task balance: {}", formatAssignment(tasks));
 
-            assertNotEquals("Found no connectors running!", maxConnectors, 0);
-            assertNotEquals("Found no tasks running!", maxTasks, 0);
-            assertEquals("Connector assignments are not unique: " + connectors,
-                    connectors.values().size(),
-                    connectors.values().stream().distinct().count());
-            assertEquals("Task assignments are not unique: " + tasks,
-                    tasks.values().size(),
-                    tasks.values().stream().distinct().count());
-            assertTrue("Connectors are imbalanced: " + 
formatAssignment(connectors), maxConnectors - minConnectors < 2);
-            assertTrue("Tasks are imbalanced: " + formatAssignment(tasks), 
maxTasks - minTasks < 2);
+            assertNotEquals(maxConnectors, 0, "Found no connectors running!");

Review Comment:
   it should be `assertNotEquals(0, maxConnectors, "Found no connectors 
running!");`



##########
connect/runtime/src/test/java/org/apache/kafka/connect/runtime/distributed/IncrementalCooperativeAssignorTest.java:
##########
@@ -1508,25 +1545,25 @@ private List<Integer> 
allocations(Function<ConnectorsAndTasks, ? extends Collect
     private void assertNoRevocations() {
         returnedAssignments.newlyRevokedConnectors().forEach((worker, 
revocations) ->
                 assertEquals(
-                        "Expected no revocations to take place during this 
round, but connector revocations were issued for worker " + worker,
                         Collections.emptySet(),
-                        new HashSet<>(revocations)
+                        new HashSet<>(revocations),

Review Comment:
   it can be `assertEquals(0, revocations.size)` or 
`assertTrue(revocations.isEmpty)`



##########
connect/runtime/src/test/java/org/apache/kafka/connect/integration/RebalanceSourceConnectorsIntegrationTest.java:
##########
@@ -350,16 +350,14 @@ private boolean 
assertConnectorAndTasksAreUniqueAndBalanced() {
             log.debug("Connector balance: {}", formatAssignment(connectors));
             log.debug("Task balance: {}", formatAssignment(tasks));
 
-            assertNotEquals("Found no connectors running!", maxConnectors, 0);
-            assertNotEquals("Found no tasks running!", maxTasks, 0);
-            assertEquals("Connector assignments are not unique: " + connectors,
-                    connectors.values().size(),
-                    connectors.values().stream().distinct().count());
-            assertEquals("Task assignments are not unique: " + tasks,
-                    tasks.values().size(),
-                    tasks.values().stream().distinct().count());
-            assertTrue("Connectors are imbalanced: " + 
formatAssignment(connectors), maxConnectors - minConnectors < 2);
-            assertTrue("Tasks are imbalanced: " + formatAssignment(tasks), 
maxTasks - minTasks < 2);
+            assertNotEquals(maxConnectors, 0, "Found no connectors running!");
+            assertNotEquals(maxTasks, 0, "Found no tasks running!");

Review Comment:
   ditto



##########
connect/runtime/src/test/java/org/apache/kafka/connect/runtime/distributed/IncrementalCooperativeAssignorTest.java:
##########
@@ -1508,25 +1545,25 @@ private List<Integer> 
allocations(Function<ConnectorsAndTasks, ? extends Collect
     private void assertNoRevocations() {
         returnedAssignments.newlyRevokedConnectors().forEach((worker, 
revocations) ->
                 assertEquals(
-                        "Expected no revocations to take place during this 
round, but connector revocations were issued for worker " + worker,
                         Collections.emptySet(),
-                        new HashSet<>(revocations)
+                        new HashSet<>(revocations),
+                        "Expected no revocations to take place during this 
round, but connector revocations were issued for worker " + worker
                 )
         );
         returnedAssignments.newlyRevokedTasks().forEach((worker, revocations) 
->
                 assertEquals(
-                        "Expected no revocations to take place during this 
round, but task revocations were issued for worker " + worker,
                         Collections.emptySet(),
-                        new HashSet<>(revocations)

Review Comment:
   it can be `assertEquals(0, revocations.size)` or 
`assertTrue(revocations.isEmpty)`



-- 
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: jira-unsubscr...@kafka.apache.org

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

Reply via email to