clolov commented on code in PR #23428:
URL: https://github.com/apache/kafka/pull/23428#discussion_r3989007073
##########
streams/src/test/java/org/apache/kafka/streams/processor/internals/StateDirectoryTest.java:
##########
@@ -446,13 +434,13 @@ public void shouldOnlyListNonEmptyTaskDirectories()
throws IOException {
final File storeDir = new File(taskDir1.file(), "store");
assertTrue(storeDir.mkdir());
- assertThat(Set.of(taskDir1, taskDir2), equalTo(new
HashSet<>(directory.listAllTaskDirectories())));
- assertThat(singletonList(taskDir1),
equalTo(directory.listNonEmptyTaskDirectories()));
+ assertEquals(Set.of(taskDir1, taskDir2), new
HashSet<>(directory.listAllTaskDirectories()));
Review Comment:
Both here and elsewhere there are examples of seemingly extraneous wrappings
into sets. Are they needed? If yes, shouldn't the underlying method return a
set?
##########
streams/src/test/java/org/apache/kafka/streams/processor/internals/RepartitionOptimizingTest.java:
##########
@@ -214,14 +209,14 @@ private void runTest(final String optimizationConfig,
final int expectedNumberRe
assertEquals(expectedNumberRepartitionTopics,
getCountOfRepartitionTopicsFound(topologyString));
// Verify the values collected by the processor
- assertThat(3, equalTo(processorValueCollector.size()));
- assertThat(processorValueCollector,
equalTo(expectedCollectedProcessorValues));
+ assertEquals(3, processorValueCollector.size());
+ assertEquals(expectedCollectedProcessorValues,
processorValueCollector);
// Verify the expected output
- assertThat(countOutputTopic.readKeyValuesToMap(),
equalTo(keyValueListToMap(expectedCountKeyValues)));
- assertThat(aggregationOutputTopic.readKeyValuesToMap(),
equalTo(keyValueListToMap(expectedAggKeyValues)));
- assertThat(reduceOutputTopic.readKeyValuesToMap(),
equalTo(keyValueListToMap(expectedReduceKeyValues)));
- assertThat(joinedOutputTopic.readKeyValuesToMap(),
equalTo(keyValueListToMap(expectedJoinKeyValues)));
+ assertEquals(expectedCountKeyValues,
countOutputTopic.readKeyValuesToMap());
+ assertEquals(expectedAggKeyValues,
aggregationOutputTopic.readKeyValuesToMap());
+ assertEquals(expectedReduceKeyValues,
reduceOutputTopic.readKeyValuesToMap());
+ assertEquals(keyValueListToMap(expectedJoinKeyValues),
joinedOutputTopic.readKeyValuesToMap());
Review Comment:
You could do the same trick for expectedJoinKeyValues as you did for the
other three, no?
##########
streams/src/test/java/org/apache/kafka/streams/processor/internals/StreamsPartitionAssignorTest.java:
##########
@@ -1636,7 +1629,7 @@ public void
shouldGenerateTasksForAllCreatedPartitions(final Map<String, Object>
);
// check if we created a task for all expected topicPartitions.
- assertThat(new HashSet<>(assignment.get(client).partitions()),
equalTo(new HashSet<>(expectedAssignment)));
+ assertEquals(expectedAssignment, new
HashSet<>(assignment.get(client).partitions()));
Review Comment:
In a similar vein as my previous comment - is the HashSet wrapper needed,
because if not then I believe you can just remove it rather than change the
list to a set?
--
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]