From: Kai Moritz Date: Sun, 2 Jun 2024 16:16:33 +0000 (+0200) Subject: recorder: 1.2.0 - Refined `TestData` clearified concerns X-Git-Tag: recorder-1.2.0~3 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=2893aaa541057a9ab6a253b1995307c1f9fe0ed8;p=demos%2Fkafka%2Fwordcount recorder: 1.2.0 - Refined `TestData` clearified concerns --- 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 5f5893e..9d73e7e 100644 --- a/src/test/java/de/juplo/kafka/wordcount/recorder/RecorderApplicationIT.java +++ b/src/test/java/de/juplo/kafka/wordcount/recorder/RecorderApplicationIT.java @@ -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 recordings = new LinkedMultiValueMap<>(); - Stream - .of(TestData.INPUT_MESSAGES) + TestData + .getInputMessages() .forEach(kv -> { sendRedording(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 index 4081258..2f98595 100644 --- a/src/test/java/de/juplo/kafka/wordcount/recorder/TestData.java +++ b/src/test/java/de/juplo/kafka/wordcount/recorder/TestData.java @@ -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[] INPUT_MESSAGES = new KeyValue[] + static final Stream> getInputMessages() + { + return Stream.of(INPUT_MESSAGES); + } + + private static final KeyValue[] INPUT_MESSAGES = new KeyValue[] { new KeyValue<>("päter", "Hall° Wält?¢*&%€!"), new KeyValue<>("päter", "Hallo Welt!"),