mjsax commented on a change in pull request #8964:
URL: https://github.com/apache/kafka/pull/8964#discussion_r466717212



##########
File path: 
streams/src/test/java/org/apache/kafka/streams/tests/EosTestDriver.java
##########
@@ -379,9 +379,18 @@ private static void verifyReceivedAllRecords(final 
Map<TopicPartition, List<Cons
         final IntegerDeserializer integerDeserializer = new 
IntegerDeserializer();
         for (final Map.Entry<TopicPartition, List<ConsumerRecord<byte[], 
byte[]>>> partitionRecords : receivedRecords.entrySet()) {
             final TopicPartition inputTopicPartition = new 
TopicPartition("data", partitionRecords.getKey().partition());
-            final Iterator<ConsumerRecord<byte[], byte[]>> expectedRecord = 
expectedRecords.get(inputTopicPartition).iterator();
+            final List<ConsumerRecord<byte[], byte[]>> 
receivedRecordsForPartition = partitionRecords.getValue();
+            final List<ConsumerRecord<byte[], byte[]>> 
expectedRecordsForPartition = expectedRecords.get(inputTopicPartition);
+
+            System.out.println(partitionRecords.getKey() + " with " + 
receivedRecordsForPartition.size() + ", " +
+                    inputTopicPartition + " with " + 
expectedRecordsForPartition.size());
+
+            final Iterator<ConsumerRecord<byte[], byte[]>> expectedRecord = 
expectedRecordsForPartition.iterator();
+            RuntimeException exception = null;
+            for (final ConsumerRecord<byte[], byte[]> receivedRecord : 
receivedRecordsForPartition) {
+                if (!expectedRecord.hasNext())
+                    exception = new RuntimeException("Result verification 
failed for " + receivedRecord + " since there's no more expected record");

Review comment:
       Sure. The question is, why do we not break the `for` loop? If we run out 
of` expectedRecord` there does not seem to be a reason to iterator to the end 
of `receivedRecord` (and assign `exception` over and over again)?




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

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


Reply via email to