From: Kai Moritz Date: Sun, 2 Jun 2024 10:17:13 +0000 (+0200) Subject: recorder: 1.2.0 - Refined `ApplicationIT` (introduced ``TestData``) X-Git-Tag: recorder-1.2.0~4 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=20648dca11997490c9e464afc07ccf15b9ef3e61;p=demos%2Fkafka%2Fwordcount recorder: 1.2.0 - Refined `ApplicationIT` (introduced ``TestData``) --- diff --git a/src/test/java/de/juplo/kafka/wordcount/recorder/RecorderApplicationIT.java b/src/test/java/de/juplo/kafka/wordcount/recorder/RecorderApplicationIT.java index aaed33e..5f5893e 100644 --- a/src/test/java/de/juplo/kafka/wordcount/recorder/RecorderApplicationIT.java +++ b/src/test/java/de/juplo/kafka/wordcount/recorder/RecorderApplicationIT.java @@ -64,15 +64,11 @@ class RecorderApplicationIT MultiValueMap 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 index 0000000..4081258 --- /dev/null +++ b/src/test/java/de/juplo/kafka/wordcount/recorder/TestData.java @@ -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[] 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!"), + }; +} diff --git a/src/test/java/de/juplo/kafka/wordcount/splitter/TestRecording.java b/src/test/java/de/juplo/kafka/wordcount/splitter/TestRecording.java index f4aa016..06018c9 100644 --- a/src/test/java/de/juplo/kafka/wordcount/splitter/TestRecording.java +++ b/src/test/java/de/juplo/kafka/wordcount/splitter/TestRecording.java @@ -7,7 +7,7 @@ import lombok.NoArgsConstructor; @Data @NoArgsConstructor -@AllArgsConstructor +@AllArgsConstructor(staticName = "of") public class TestRecording { String user;