recorder: 1.2.0 - Refined `TestData` clearified concerns
authorKai Moritz <kai@juplo.de>
Sun, 2 Jun 2024 16:16:33 +0000 (18:16 +0200)
committerKai Moritz <kai@juplo.de>
Thu, 6 Jun 2024 18:42:22 +0000 (20:42 +0200)
src/test/java/de/juplo/kafka/wordcount/recorder/RecorderApplicationIT.java
src/test/java/de/juplo/kafka/wordcount/recorder/TestData.java

index 5f5893e..9d73e7e 100644 (file)
@@ -22,7 +22,6 @@ import org.springframework.util.MultiValueMap;
 
 import java.time.Duration;
 import java.util.List;
-import java.util.stream.Stream;
 
 import static de.juplo.kafka.wordcount.recorder.RecorderApplicationIT.TOPIC_OUT;
 import static org.assertj.core.api.Assertions.assertThat;
@@ -63,8 +62,8 @@ class RecorderApplicationIT
        {
                MultiValueMap<String, TestRecording> recordings = new LinkedMultiValueMap<>();
 
-               Stream
-                               .of(TestData.INPUT_MESSAGES)
+               TestData
+                               .getInputMessages()
                                .forEach(kv ->
                                {
                                        sendRedording(kv.key, kv.value);
index 4081258..2f98595 100644 (file)
@@ -2,13 +2,20 @@ package de.juplo.kafka.wordcount.recorder;
 
 import org.apache.kafka.streams.KeyValue;
 
+import java.util.stream.Stream;
+
 
 class TestData
 {
        static final String PETER = "päter";
        static final String KLAUS = "klühs";
 
-       static final KeyValue<String, String>[] INPUT_MESSAGES = new KeyValue[]
+       static final Stream<KeyValue<String, String>> getInputMessages()
+       {
+               return Stream.of(INPUT_MESSAGES);
+       }
+
+       private static final KeyValue<String, String>[] INPUT_MESSAGES = new KeyValue[]
        {
                        new KeyValue<>("päter", "Hall° Wält?¢*&%€!"),
                        new KeyValue<>("päter", "Hallo Welt!"),