splitter: 1.2.0 - Refined `TestData` clearified concerns
[demos/kafka/wordcount] / src / test / java / de / juplo / kafka / wordcount / splitter / TestData.java
index e2bf9cc..a3f7575 100644 (file)
@@ -7,7 +7,6 @@ import org.springframework.util.LinkedMultiValueMap;
 import org.springframework.util.MultiValueMap;
 
 import java.time.Duration;
-import java.util.function.BiConsumer;
 import java.util.stream.Stream;
 
 import static org.assertj.core.api.Assertions.assertThat;
@@ -19,14 +18,13 @@ public class TestData
        static final String PETER = "peter";
        static final String KLAUS = "klaus";
 
-       static void writeInputData(BiConsumer<String, TestRecording> consumer)
+
+       static final Stream<KeyValue<String, TestRecording>> getInputMessages()
        {
-               Stream
-                               .of(INPUT_MESSAGES)
-                               .forEach(kv -> consumer.accept(kv.key, kv.value));
+               return Stream.of(INPUT_MESSAGES);
        }
 
-       static final KeyValue<String, TestRecording>[] INPUT_MESSAGES = new KeyValue[]
+       private static final KeyValue<String, TestRecording>[] INPUT_MESSAGES = new KeyValue[]
        {
                        new KeyValue<>(
                                        PETER,
@@ -47,7 +45,7 @@ public class TestData
                                                assertThat(receivedMessages.get(user)).containsExactlyElementsOf(word)));
        }
 
-       static final KeyValue<String, TestWord>[] EXPECTED_MESSAGES = new KeyValue[]
+       private static final KeyValue<String, TestWord>[] EXPECTED_MESSAGES = new KeyValue[]
        {
                        KeyValue.pair(
                                        "peter",