counter: 1.3.0 - (RED) Made `CounterApplicationIT` fail too
[demos/kafka/wordcount] / src / test / java / de / juplo / kafka / wordcount / counter / TestData.java
index 4e431e1..54e6287 100644 (file)
@@ -1,5 +1,6 @@
 package de.juplo.kafka.wordcount.counter;
 
+import de.juplo.kafka.wordcount.splitter.TestInputUser;
 import de.juplo.kafka.wordcount.splitter.TestInputWord;
 import de.juplo.kafka.wordcount.top10.TestOutputWord;
 import de.juplo.kafka.wordcount.top10.TestOutputWordCounter;
@@ -8,7 +9,6 @@ import org.apache.kafka.streams.state.ReadOnlyKeyValueStore;
 import org.springframework.util.LinkedMultiValueMap;
 import org.springframework.util.MultiValueMap;
 
-import java.util.function.Consumer;
 import java.util.stream.Stream;
 
 import static org.assertj.core.api.Assertions.assertThat;
@@ -31,53 +31,48 @@ class TestData
        static final TestOutputWord KLAUS_MÜSCH = TestOutputWord.of(KLAUS, WORD_MÜSCH);
        static final TestOutputWord KLAUS_S = TestOutputWord.of(KLAUS, WORD_S);
 
-       private static final KeyValue<String, TestInputWord>[] INPUT_MESSAGES = new KeyValue[]
+       private static final KeyValue<TestInputUser, TestInputWord>[] INPUT_MESSAGES = new KeyValue[]
        {
                        new KeyValue<>(
-                                       PETER,
+                                       TestInputUser.of(PETER),
                                        TestInputWord.of(PETER, WORD_HALLO)),
                        new KeyValue<>(
-                                       KLAUS,
+                                       TestInputUser.of(KLAUS),
                                        TestInputWord.of(KLAUS, WORD_MÜSCH)),
                        new KeyValue<>(
-                                       PETER,
+                                       TestInputUser.of(PETER),
                                        TestInputWord.of(PETER, WORD_WELT)),
                        new KeyValue<>(
-                                       KLAUS,
+                                       TestInputUser.of(KLAUS),
                                        TestInputWord.of(KLAUS, WORD_MÜSCH)),
                        new KeyValue<>(
-                                       KLAUS,
+                                       TestInputUser.of(KLAUS),
                                        TestInputWord.of(KLAUS, WORD_S)),
                        new KeyValue<>(
-                                       PETER,
+                                       TestInputUser.of(PETER),
                                        TestInputWord.of(PETER, WORD_BOÄH)),
                        new KeyValue<>(
-                                       PETER,
+                                       TestInputUser.of(PETER),
                                        TestInputWord.of(PETER, WORD_WELT)),
                        new KeyValue<>(
-                                       PETER,
+                                       TestInputUser.of(PETER),
                                        TestInputWord.of(PETER, WORD_BOÄH)),
                        new KeyValue<>(
-                                       KLAUS,
+                                       TestInputUser.of(KLAUS),
                                        TestInputWord.of(KLAUS, WORD_S)),
                        new KeyValue<>(
-                                       PETER,
+                                       TestInputUser.of(PETER),
                                        TestInputWord.of(PETER, WORD_BOÄH)),
                        new KeyValue<>(
-                                       KLAUS,
+                                       TestInputUser.of(KLAUS),
                                        TestInputWord.of(KLAUS, WORD_S)),
        };
 
-       static Stream<KeyValue<String, TestInputWord>> getInputMessages()
+       static Stream<KeyValue<TestInputUser, TestInputWord>> getInputMessages()
        {
                return Stream.of(TestData.INPUT_MESSAGES);
        }
 
-       static Consumer<MultiValueMap<TestOutputWord, TestOutputWordCounter>> expectedMessagesAssertion()
-       {
-               return receivedMessages -> assertExpectedMessages(receivedMessages);
-       }
-
        static void assertExpectedMessages(MultiValueMap<TestOutputWord, TestOutputWordCounter> receivedMessages)
        {
                expectedMessages().forEach(
@@ -86,11 +81,6 @@ class TestData
                                                                .containsExactlyElementsOf(counter));
        }
 
-       static Consumer<MultiValueMap<TestOutputWord, TestOutputWordCounter>> expectedNumberOfMessagesForWordAssertion()
-       {
-               return receivedMessages -> assertExpectedNumberOfMessagesForWord(receivedMessages);
-       }
-
        static void assertExpectedNumberOfMessagesForWord(MultiValueMap<TestOutputWord, TestOutputWordCounter> receivedMessages)
        {
                assertThat(countMessagesForWord(PETER_HALLO, receivedMessages));
@@ -105,11 +95,6 @@ class TestData
                return messagesForUsers.get(word).size();
        }
 
-       static Consumer<MultiValueMap<TestOutputWord, TestOutputWordCounter>> expectedLastMessagesForWordAssertion()
-       {
-               return receivedMessages -> assertExpectedLastMessagesForWord(receivedMessages);
-       }
-
        static void assertExpectedState(ReadOnlyKeyValueStore<Word, Long> store)
        {
                assertWordCountEqualsWordCountFromLastMessage(PETER_HALLO, store.get(wordOf(PETER_HALLO)));