Skip to content
Permalink
Browse files

MINOR: Replacing for with foreach loop in stream test classes

Author: Prabhat Kashyap <prabhat.kashyap@knoldus.in>

Reviewers: Ismael Juma, Damian Guy, Guozhang Wang

Closes #2305 from PKOfficial/code-refactor
  • Loading branch information...
PKOfficial authored and guozhangwang committed Jan 10, 2017
1 parent fe82330 commit 75469a3b602c26ea81d6fc0a409d39d321195ea4
Showing with 227 additions and 226 deletions.
  1. +2 −2 streams/src/test/java/org/apache/kafka/streams/kstream/internals/KStreamBranchTest.java
  2. +4 −4 streams/src/test/java/org/apache/kafka/streams/kstream/internals/KStreamFilterTest.java
  3. +2 −2 streams/src/test/java/org/apache/kafka/streams/kstream/internals/KStreamFlatMapTest.java
  4. +2 −2 streams/src/test/java/org/apache/kafka/streams/kstream/internals/KStreamFlatMapValuesTest.java
  5. +92 −92 streams/src/test/java/org/apache/kafka/streams/kstream/internals/KStreamKStreamJoinTest.java
  6. +24 −24 streams/src/test/java/org/apache/kafka/streams/kstream/internals/KStreamKStreamLeftJoinTest.java
  7. +8 −8 streams/src/test/java/org/apache/kafka/streams/kstream/internals/KStreamKTableJoinTest.java
  8. +8 −8 streams/src/test/java/org/apache/kafka/streams/kstream/internals/KStreamKTableLeftJoinTest.java
  9. +2 −2 streams/src/test/java/org/apache/kafka/streams/kstream/internals/KStreamMapTest.java
  10. +2 −2 streams/src/test/java/org/apache/kafka/streams/kstream/internals/KStreamMapValuesTest.java
  11. +2 −2 streams/src/test/java/org/apache/kafka/streams/kstream/internals/KStreamTransformTest.java
  12. +2 −2 streams/src/test/java/org/apache/kafka/streams/kstream/internals/KStreamTransformValuesTest.java
  13. +5 −4 streams/src/test/java/org/apache/kafka/streams/kstream/internals/KTableAggregateTest.java
  14. +16 −16 streams/src/test/java/org/apache/kafka/streams/kstream/internals/KTableKTableJoinTest.java
  15. +24 −24 streams/src/test/java/org/apache/kafka/streams/kstream/internals/KTableKTableLeftJoinTest.java
  16. +24 −24 streams/src/test/java/org/apache/kafka/streams/kstream/internals/KTableKTableOuterJoinTest.java
  17. +8 −8 ...est/java/org/apache/kafka/streams/state/internals/MergedSortedCacheKeyValueStoreIteratorTest.java
@@ -87,8 +87,8 @@ public boolean test(Integer key, String value) {
}

driver = new KStreamTestDriver(builder);
for (int i = 0; i < expectedKeys.length; i++) {
driver.process(topicName, expectedKeys[i], "V" + expectedKeys[i]);
for (int expectedKey : expectedKeys) {
driver.process(topicName, expectedKey, "V" + expectedKey);
}

assertEquals(3, processors[0].processed.size());
@@ -63,8 +63,8 @@ public void testFilter() {
stream.filter(isMultipleOfThree).process(processor);

driver = new KStreamTestDriver(builder);
for (int i = 0; i < expectedKeys.length; i++) {
driver.process(topicName, expectedKeys[i], "V" + expectedKeys[i]);
for (int expectedKey : expectedKeys) {
driver.process(topicName, expectedKey, "V" + expectedKey);
}

assertEquals(2, processor.processed.size());
@@ -83,8 +83,8 @@ public void testFilterNot() {
stream.filterNot(isMultipleOfThree).process(processor);

driver = new KStreamTestDriver(builder);
for (int i = 0; i < expectedKeys.length; i++) {
driver.process(topicName, expectedKeys[i], "V" + expectedKeys[i]);
for (int expectedKey : expectedKeys) {
driver.process(topicName, expectedKey, "V" + expectedKey);
}

assertEquals(5, processor.processed.size());
@@ -71,8 +71,8 @@ public void testFlatMap() {
stream.flatMap(mapper).process(processor);

driver = new KStreamTestDriver(builder);
for (int i = 0; i < expectedKeys.length; i++) {
driver.process(topicName, expectedKeys[i], "V" + expectedKeys[i]);
for (int expectedKey : expectedKeys) {
driver.process(topicName, expectedKey, "V" + expectedKey);
}

assertEquals(6, processor.processed.size());
@@ -70,8 +70,8 @@ public void testFlatMapValues() {
stream.flatMapValues(mapper).process(processor);

driver = new KStreamTestDriver(builder);
for (int i = 0; i < expectedKeys.length; i++) {
driver.process(topicName, expectedKeys[i], "V" + expectedKeys[i]);
for (int expectedKey : expectedKeys) {
driver.process(topicName, expectedKey, "V" + expectedKey);
}

assertEquals(8, processor.processed.size());
Oops, something went wrong.

0 comments on commit 75469a3

Please sign in to comment.
You can’t perform that action at this time.