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


##########
connect/runtime/src/test/java/org/apache/kafka/connect/connector/policy/PrincipalConnectorClientConfigOverridePolicyTest.java:
##########
@@ -32,7 +31,7 @@ public class PrincipalConnectorClientConfigOverridePolicyTest 
extends BaseConnec
 
     @Test
     public void testPrincipalOnly() {
-        Map<String, Object> clientConfig = 
Collections.singletonMap(SaslConfigs.SASL_JAAS_CONFIG, "test");
+        Map<String, Object> clientConfig = 
Map.of(SaslConfigs.SASL_JAAS_CONFIG, "test");

Review Comment:
   ```java
   testValidOverride(Map.of(SaslConfigs.SASL_JAAS_CONFIG, "test"));
   ```



##########
connect/runtime/src/test/java/org/apache/kafka/connect/runtime/WorkerSinkTaskTest.java:
##########
@@ -135,7 +131,7 @@ public class WorkerSinkTaskTest {
     private static final TopicPartition TOPIC_PARTITION3 = new 
TopicPartition(TOPIC, PARTITION3);
 
     private static final Set<TopicPartition> INITIAL_ASSIGNMENT =
-            new HashSet<>(Arrays.asList(TOPIC_PARTITION, TOPIC_PARTITION2));
+            new HashSet<>(List.of(TOPIC_PARTITION, TOPIC_PARTITION2));

Review Comment:
   ```java
   Set.of(TOPIC_PARTITION, TOPIC_PARTITION2);
   ```



##########
connect/runtime/src/test/java/org/apache/kafka/connect/integration/BlockingConnectorTest.java:
##########
@@ -577,7 +576,7 @@ public Class<? extends Task> taskClass() {
         @Override
         public List<Map<String, String>> taskConfigs(int maxTasks) {
             block.maybeBlockOn(CONNECTOR_TASK_CONFIGS);
-            return Collections.singletonList(Collections.emptyMap());
+            return List.of(Map.of());

Review Comment:
   Could you please update line#790 also?
   
   ```java
           @Override
           public List<Map<String, String>> taskConfigs(int maxTasks) {
               return IntStream.range(0, maxTasks)
                   .mapToObj(i -> new HashMap<>(props))
                   .collect(Collectors.toList());
           }
   ```



##########
connect/runtime/src/test/java/org/apache/kafka/connect/runtime/distributed/DistributedConfigTest.java:
##########
@@ -215,7 +213,7 @@ public void shouldFailWithInvalidKeySize() throws 
NoSuchAlgorithmException {
     @Test
     public void shouldValidateAllVerificationAlgorithms() {
         List<String> algorithms =
-            new ArrayList<>(Arrays.asList("HmacSHA1", "HmacSHA256", "HmacMD5", 
"bad-algorithm"));
+            new ArrayList<>(List.of("HmacSHA1", "HmacSHA256", "HmacMD5", 
"bad-algorithm"));

Review Comment:
   Could we make `algorithms` immutable in this test?



##########
connect/runtime/src/test/java/org/apache/kafka/connect/runtime/distributed/DistributedHerderTest.java:
##########
@@ -4188,12 +4186,12 @@ private void expectRebalance(final Collection<String> 
revokedConnectors,
             if (connectProtocolVersion == CONNECT_PROTOCOL_V0) {
                 assignment = new ExtendedAssignment(
                         connectProtocolVersion, error, leader, leaderUrl, 
offset,
-                        assignedConnectors, assignedTasks,
-                        Collections.emptyList(), Collections.emptyList(), 0);
+                        new ArrayList<>(assignedConnectors), new 
ArrayList<>(assignedTasks),
+                        List.of(), List.of(), 0);
             } else {
                 assignment = new ExtendedAssignment(
                         connectProtocolVersion, error, leader, leaderUrl, 
offset,
-                        assignedConnectors, assignedTasks,
+                        new ArrayList<>(assignedConnectors), new 
ArrayList<>(assignedTasks),

Review Comment:
   Why to do a deep copy?



##########
connect/runtime/src/test/resources/test-plugins/read-version-from-resource-v1/test/plugins/ReadVersionFromResource.java:
##########
@@ -50,7 +50,7 @@ private String version(InputStream stream) throws IOException 
{
         try (BufferedReader reader = new BufferedReader(new 
InputStreamReader(stream))) {
             return reader.lines()
                     .filter(s -> !s.isEmpty() && !s.startsWith("#"))

Review Comment:
   ```java
               return reader.lines()
                       .filter(s -> !s.isEmpty() && !s.startsWith("#"))
                       .findFirst()
                       .get();
   ```



##########
connect/runtime/src/test/resources/test-plugins/read-version-from-resource-v1/test/plugins/ReadVersionFromResource.java:
##########
@@ -50,7 +50,7 @@ private String version(InputStream stream) throws IOException 
{
         try (BufferedReader reader = new BufferedReader(new 
InputStreamReader(stream))) {
             return reader.lines()
                     .filter(s -> !s.isEmpty() && !s.startsWith("#"))

Review Comment:
   another `ReadVersionFromResource` has analogous issue.



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