frankvicky commented on code in PR #20336: URL: https://github.com/apache/kafka/pull/20336#discussion_r2266103006
########## tools/src/test/java/org/apache/kafka/tools/reassign/ReassignPartitionsCommandTest.java: ########## @@ -153,13 +153,18 @@ public void testGenerateAssignmentWithBootstrapServer() throws Exception { produceMessages(foo0.topic(), foo0.partition(), 100); try (Admin admin = Admin.create(Map.of(CommonClientConfigs.BOOTSTRAP_SERVERS_CONFIG, clusterInstance.bootstrapServers()))) { - String assignment = "{\"version\":1,\"partitions\":" + - "[{\"topic\":\"foo\",\"partition\":0,\"replicas\":[3,1,2],\"log_dirs\":[\"any\",\"any\",\"any\"]}" + - "]}"; - generateAssignment(admin, assignment, "1,2,3", false); + String topicsToMoveJson = "{\"topics\":\n\t[{\"topic\": \"foo\"}],\n\"version\":1\n}"; + var assignment = generateAssignment(admin, topicsToMoveJson, "1,2,3", false); + Map<TopicPartition, List<Integer>> proposedAssignments = assignment.getKey(); + String assignmentJson = String.format("{\"version\":1,\"partitions\":" + + "[{\"topic\":\"foo\",\"partition\":0,\"replicas\":%s,\"log_dirs\":[\"any\",\"any\",\"any\"]}" + + "]}", proposedAssignments.get(foo0)); Review Comment: It's not easy to read. Can we use the text block feature from Java 17? For example: ```java String assignmentJson = String.format(""" {"version":1,"partitions":\ [{"topic":"foo","partition":0,"replicas":%s,"log_dirs":["any","any","any"]}\ ]}""", proposedAssignments.get(foo0)); ``` -- 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