- Message.of(
- Word.of("peter","Hallo"),
- WordCount.of("peter","Hallo",1)),
- Message.of(
- Word.of("klaus","Müsch"),
- WordCount.of("klaus","Müsch",1)),
- Message.of(
- Word.of("peter","Welt"),
- WordCount.of("peter","Welt",1)),
- Message.of(
- Word.of("klaus","Müsch"),
- WordCount.of("klaus","Müsch",2)),
- Message.of(
- Word.of("klaus","s"),
- WordCount.of("klaus","s",1)),
- Message.of(
- Word.of("peter","Boäh"),
- WordCount.of("peter","Boäh",1)),
- Message.of(
- Word.of("peter","Welt"),
- WordCount.of("peter","Welt",2)),
- Message.of(
- Word.of("peter","Boäh"),
- WordCount.of("peter","Boäh",2)),
- Message.of(
- Word.of("klaus","s"),
- WordCount.of("klaus","s",2)),
- Message.of(
- Word.of("peter","Boäh"),
- WordCount.of("peter","Boäh",3)),
- Message.of(
- Word.of("klaus","s"),
- WordCount.of("klaus","s",3)),
+ expectedMessages().forEach(
+ (word, counter) ->
+ assertThat(receivedMessages.get(word))
+ .containsExactlyElementsOf(counter));
+ }
+
+ private static final KeyValue<TestOutputWord, TestOutputWordCounter>[] EXPECTED_MESSAGES = new KeyValue[]
+ {
+ KeyValue.pair(
+ PETER_HALLO,
+ TestOutputWordCounter.of(PETER, WORD_HALLO,1)),
+ KeyValue.pair(
+ KLAUS_MÜSCH,
+ TestOutputWordCounter.of(KLAUS, WORD_MÜSCH,1)),
+ KeyValue.pair(
+ PETER_WELT,
+ TestOutputWordCounter.of(PETER, WORD_WELT,1)),
+ KeyValue.pair(
+ KLAUS_MÜSCH,
+ TestOutputWordCounter.of(KLAUS, WORD_MÜSCH,2)),
+ KeyValue.pair(
+ KLAUS_S,
+ TestOutputWordCounter.of(KLAUS, WORD_S,1)),
+ KeyValue.pair(
+ PETER_BOÄH,
+ TestOutputWordCounter.of(PETER, WORD_BOÄH,1)),
+ KeyValue.pair(
+ PETER_WELT,
+ TestOutputWordCounter.of(PETER, WORD_WELT,2)),
+ KeyValue.pair(
+ PETER_BOÄH,
+ TestOutputWordCounter.of(PETER, WORD_BOÄH,2)),
+ KeyValue.pair(
+ KLAUS_S,
+ TestOutputWordCounter.of(KLAUS, WORD_S,2)),
+ KeyValue.pair(
+ PETER_BOÄH,
+ TestOutputWordCounter.of(PETER, WORD_BOÄH,3)),
+ KeyValue.pair(
+ KLAUS_S,
+ TestOutputWordCounter.of(KLAUS, WORD_S,3)),