recorder: 1.2.0 - Refined `ApplicationIT` (introduced ``TestData``)
authorKai Moritz <kai@juplo.de>
Sun, 2 Jun 2024 10:17:13 +0000 (12:17 +0200)
committerKai Moritz <kai@juplo.de>
Thu, 6 Jun 2024 18:42:04 +0000 (20:42 +0200)
src/test/java/de/juplo/kafka/wordcount/recorder/RecorderApplicationIT.java
src/test/java/de/juplo/kafka/wordcount/recorder/TestData.java [new file with mode: 0644]
src/test/java/de/juplo/kafka/wordcount/splitter/TestRecording.java

index aaed33e..5f5893e 100644 (file)
@@ -64,15 +64,11 @@ class RecorderApplicationIT
                MultiValueMap<String, TestRecording> recordings = new LinkedMultiValueMap<>();
 
                Stream
-                               .of(
-                                               new TestRecording("päter", "Hall° Wält?¢*&%€!"),
-                                               new TestRecording("päter", "Hallo Welt!"),
-                                               new TestRecording("klühs", "Müsch gäb's auch!"),
-                                               new TestRecording("päter", "Boäh, echt! ß mal nä Nümmäh!"))
-                               .forEach(recording ->
+                               .of(TestData.INPUT_MESSAGES)
+                               .forEach(kv ->
                                {
-                                       sendRedording(recording.getUser(), recording.getSentence());
-                                       recordings.add(recording.getUser(), recording);
+                                       sendRedording(kv.key, kv.value);
+                                       recordings.add(kv.key, TestRecording.of(kv.key, kv.value));
                                });
 
 
diff --git a/src/test/java/de/juplo/kafka/wordcount/recorder/TestData.java b/src/test/java/de/juplo/kafka/wordcount/recorder/TestData.java
new file mode 100644 (file)
index 0000000..4081258
--- /dev/null
@@ -0,0 +1,18 @@
+package de.juplo.kafka.wordcount.recorder;
+
+import org.apache.kafka.streams.KeyValue;
+
+
+class TestData
+{
+       static final String PETER = "päter";
+       static final String KLAUS = "klühs";
+
+       static final KeyValue<String, String>[] INPUT_MESSAGES = new KeyValue[]
+       {
+                       new KeyValue<>("päter", "Hall° Wält?¢*&%€!"),
+                       new KeyValue<>("päter", "Hallo Welt!"),
+                       new KeyValue<>("klühs", "Müsch gäb's auch!"),
+                       new KeyValue<>("päter", "Boäh, echt! ß mal nä Nümmäh!"),
+       };
+}
index f4aa016..06018c9 100644 (file)
@@ -7,7 +7,7 @@ import lombok.NoArgsConstructor;
 
 @Data
 @NoArgsConstructor
-@AllArgsConstructor
+@AllArgsConstructor(staticName = "of")
 public class TestRecording
 {
   String user;