- Message.of(
- "{\"user\":\"peter\",\"word\":\"Hallo\"}",
- "{\"user\":\"peter\",\"word\":\"Hallo\",\"count\":1}"),
- Message.of(
- "{\"user\":\"klaus\",\"word\":\"Müsch\"}",
- "{\"user\":\"klaus\",\"word\":\"Müsch\",\"count\":1}"),
- Message.of(
- "{\"user\":\"peter\",\"word\":\"Welt\"}",
- "{\"user\":\"peter\",\"word\":\"Welt\",\"count\":1}"),
- Message.of(
- "{\"user\":\"klaus\",\"word\":\"Müsch\"}",
- "{\"user\":\"klaus\",\"word\":\"Müsch\",\"count\":2}"),
- Message.of(
- "{\"user\":\"klaus\",\"word\":\"s\"}",
- "{\"user\":\"klaus\",\"word\":\"s\",\"count\":1}"),
- Message.of(
- "{\"user\":\"peter\",\"word\":\"Boäh\"}",
- "{\"user\":\"peter\",\"word\":\"Boäh\",\"count\":1}"),
- Message.of(
- "{\"user\":\"peter\",\"word\":\"Welt\"}",
- "{\"user\":\"peter\",\"word\":\"Welt\",\"count\":2}"),
- Message.of(
- "{\"user\":\"peter\",\"word\":\"Boäh\"}",
- "{\"user\":\"peter\",\"word\":\"Boäh\",\"count\":2}"),
- Message.of(
- "{\"user\":\"klaus\",\"word\":\"s\"}",
- "{\"user\":\"klaus\",\"word\":\"s\",\"count\":2}"),
- Message.of(
- "{\"user\":\"peter\",\"word\":\"Boäh\"}",
- "{\"user\":\"peter\",\"word\":\"Boäh\",\"count\":3}"),
- Message.of(
- "{\"user\":\"klaus\",\"word\":\"s\"}",
- "{\"user\":\"klaus\",\"word\":\"s\",\"count\":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)),