From: Kai Moritz Date: Sun, 2 Jun 2024 16:03:15 +0000 (+0200) Subject: splitter: 1.2.0 - Refined `TestData` clearified concerns X-Git-Tag: splitter-1.2.0~6 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=53b03696e9e3890d9aeca795482cf66252449fad;p=demos%2Fkafka%2Fwordcount splitter: 1.2.0 - Refined `TestData` clearified concerns --- diff --git a/src/test/java/de/juplo/kafka/wordcount/splitter/SplitterApplicationIT.java b/src/test/java/de/juplo/kafka/wordcount/splitter/SplitterApplicationIT.java index 743c06e..b91af13 100644 --- a/src/test/java/de/juplo/kafka/wordcount/splitter/SplitterApplicationIT.java +++ b/src/test/java/de/juplo/kafka/wordcount/splitter/SplitterApplicationIT.java @@ -20,7 +20,6 @@ import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.MultiValueMap; import java.time.Duration; -import java.util.stream.Stream; import static de.juplo.kafka.wordcount.splitter.SplitterApplicationIT.TOPIC_IN; import static de.juplo.kafka.wordcount.splitter.SplitterApplicationIT.TOPIC_OUT; @@ -54,8 +53,8 @@ public class SplitterApplicationIT public static void testSendMessage( @Autowired KafkaTemplate kafkaTemplate) { - Stream - .of(TestData.INPUT_MESSAGES) + TestData + .getInputMessages() .forEach(kv -> { try diff --git a/src/test/java/de/juplo/kafka/wordcount/splitter/TestData.java b/src/test/java/de/juplo/kafka/wordcount/splitter/TestData.java index 8c343d5..a3f7575 100644 --- a/src/test/java/de/juplo/kafka/wordcount/splitter/TestData.java +++ b/src/test/java/de/juplo/kafka/wordcount/splitter/TestData.java @@ -19,7 +19,12 @@ public class TestData static final String KLAUS = "klaus"; - 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<>( PETER, @@ -40,7 +45,7 @@ public class TestData assertThat(receivedMessages.get(user)).containsExactlyElementsOf(word))); } - static final KeyValue[] EXPECTED_MESSAGES = new KeyValue[] + private static final KeyValue[] EXPECTED_MESSAGES = new KeyValue[] { KeyValue.pair( "peter",