From 53b03696e9e3890d9aeca795482cf66252449fad Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Sun, 2 Jun 2024 18:03:15 +0200 Subject: [PATCH] splitter: 1.2.0 - Refined `TestData` clearified concerns --- .../kafka/wordcount/splitter/SplitterApplicationIT.java | 5 ++--- .../java/de/juplo/kafka/wordcount/splitter/TestData.java | 9 +++++++-- 2 files changed, 9 insertions(+), 5 deletions(-) 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", -- 2.20.1