+ static final String PETER = "peter";
+ static final String KLAUS = "klaus";
+
+ static final String WORD_HALLO = "Hallo";
+ static final String WORD_MÜSCH = "Müsch";
+ static final String WORD_WELT = "Welt";
+ static final String WORD_S = "s";
+ static final String WORD_BOÄH = "Boäh";
+
+ static final TestOutputWord PETER_HALLO = TestOutputWord.of(TYPE, PETER, WORD_HALLO);
+ static final TestOutputWord PETER_WELT = TestOutputWord.of(TYPE, PETER, WORD_WELT);
+ static final TestOutputWord PETER_BOÄH = TestOutputWord.of(TYPE, PETER, WORD_BOÄH);
+ static final TestOutputWord KLAUS_MÜSCH = TestOutputWord.of(TYPE, KLAUS, WORD_MÜSCH);
+ static final TestOutputWord KLAUS_S = TestOutputWord.of(TYPE, KLAUS, WORD_S);
+
+ private static final KeyValue<TestInputUser, TestInputWord>[] INPUT_MESSAGES = new KeyValue[]
+ {
+ KeyValue.pair(
+ TestInputUser.of(PETER),
+ TestInputWord.of(PETER, WORD_HALLO)),
+ KeyValue.pair(
+ TestInputUser.of(KLAUS),
+ TestInputWord.of(KLAUS, WORD_MÜSCH)),
+ KeyValue.pair(
+ TestInputUser.of(PETER),
+ TestInputWord.of(PETER, WORD_WELT)),
+ KeyValue.pair(
+ TestInputUser.of(KLAUS),
+ TestInputWord.of(KLAUS, WORD_MÜSCH)),
+ KeyValue.pair(
+ TestInputUser.of(KLAUS),
+ TestInputWord.of(KLAUS, WORD_S)),
+ KeyValue.pair(
+ TestInputUser.of(PETER),
+ TestInputWord.of(PETER, WORD_BOÄH)),
+ KeyValue.pair(
+ TestInputUser.of(PETER),
+ TestInputWord.of(PETER, WORD_WELT)),
+ KeyValue.pair(
+ TestInputUser.of(PETER),
+ TestInputWord.of(PETER, WORD_BOÄH)),
+ KeyValue.pair(
+ TestInputUser.of(KLAUS),
+ TestInputWord.of(KLAUS, WORD_S)),
+ KeyValue.pair(
+ TestInputUser.of(PETER),
+ TestInputWord.of(PETER, WORD_BOÄH)),
+ KeyValue.pair(
+ TestInputUser.of(KLAUS),
+ TestInputWord.of(KLAUS, WORD_S)),
+ };
+
+ static Stream<KeyValue<TestInputUser, TestInputWord>> getInputMessages()
+ {
+ return Stream.of(TestData.INPUT_MESSAGES);
+ }
+
+ static void assertExpectedMessages(MultiValueMap<TestOutputWord, TestOutputWordCounter> receivedMessages)
+ {
+ expectedMessages().forEach(
+ (word, counter) ->
+ assertThat(receivedMessages.get(word))
+ .containsExactlyElementsOf(counter));
+ }
+
+ static void assertExpectedNumberOfMessagesForWord(MultiValueMap<TestOutputWord, TestOutputWordCounter> receivedMessages)
+ {
+ assertThat(countMessagesForWord(PETER_HALLO, receivedMessages));
+ assertThat(countMessagesForWord(PETER_WELT, receivedMessages));
+ assertThat(countMessagesForWord(PETER_BOÄH, receivedMessages));
+ assertThat(countMessagesForWord(KLAUS_MÜSCH, receivedMessages));
+ assertThat(countMessagesForWord(KLAUS_S, receivedMessages));
+ }
+
+ private static int countMessagesForWord(TestOutputWord word, MultiValueMap<TestOutputWord, TestOutputWordCounter> messagesForUsers)
+ {
+ return messagesForUsers.get(word) == null
+ ? 0
+ : messagesForUsers.get(word).size();
+ }
+
+ static void assertExpectedState(ReadOnlyKeyValueStore<Word, Long> store)