From: Kai Moritz Date: Mon, 27 May 2024 19:53:26 +0000 (+0200) Subject: counter: 1.2.15 - Refined `TestData.writeInputData(..)` X-Git-Tag: counter-1.2.15~16 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=f08dc87a018fb2cd84de1a274c20fb9f4487b7a0;p=demos%2Fkafka%2Fwordcount counter: 1.2.15 - Refined `TestData.writeInputData(..)` --- diff --git a/src/test/java/de/juplo/kafka/wordcount/counter/TestData.java b/src/test/java/de/juplo/kafka/wordcount/counter/TestData.java index 1687a33..ea33cb0 100644 --- a/src/test/java/de/juplo/kafka/wordcount/counter/TestData.java +++ b/src/test/java/de/juplo/kafka/wordcount/counter/TestData.java @@ -19,41 +19,26 @@ class TestData { static void writeInputData(BiConsumer consumer) { - consumer.accept( - "peter", - Word.of("peter","Hallo")); - consumer.accept( - "klaus", - Word.of("klaus","Müsch")); - consumer.accept( - "peter", - Word.of("peter","Welt")); - consumer.accept( - "klaus", - Word.of("klaus","Müsch")); - consumer.accept( - "klaus", - Word.of("klaus","s")); - consumer.accept( - "peter", - Word.of("peter","Boäh")); - consumer.accept( - "peter", - Word.of("peter","Welt")); - consumer.accept( - "peter", - Word.of("peter","Boäh")); - consumer.accept( - "klaus", - Word.of("klaus","s")); - consumer.accept( - "peter", - Word.of("peter","Boäh")); - consumer.accept( - "klaus", - Word.of("klaus","s")); + Stream + .of(inputMessagesArray) + .forEach(word -> consumer.accept(word.getUser(), word)); } + static Word[] inputMessagesArray = new Word[] + { + Word.of("peter","Hallo"), + Word.of("klaus","Müsch"), + Word.of("peter","Welt"), + Word.of("klaus","Müsch"), + Word.of("klaus","s"), + Word.of("peter","Boäh"), + Word.of("peter","Welt"), + Word.of("peter","Boäh"), + Word.of("klaus","s"), + Word.of("peter","Boäh"), + Word.of("klaus","s"), + }; + static void assertExpectedResult(MultiValueMap receivedMessages) { expectedMessages.forEach(