- Message.of(
- "{\"username\":\"peter\",\"word\":\"Hallo\"}",
- "1"),
- Message.of(
- "{\"username\":\"klaus\",\"word\":\"Müsch\"}",
- "1"),
- Message.of(
- "{\"username\":\"peter\",\"word\":\"Welt\"}",
- "1"),
- Message.of(
- "{\"username\":\"klaus\",\"word\":\"Müsch\"}",
- "2"),
- Message.of(
- "{\"username\":\"klaus\",\"word\":\"s\"}",
- "1"),
- Message.of(
- "{\"username\":\"peter\",\"word\":\"Boäh\"}",
- "1"),
- Message.of(
- "{\"username\":\"peter\",\"word\":\"Welt\"}",
- "2"),
- Message.of(
- "{\"username\":\"peter\",\"word\":\"Boäh\"}",
- "2"),
- Message.of(
- "{\"username\":\"klaus\",\"word\":\"s\"}",
- "2"),
- Message.of(
- "{\"username\":\"peter\",\"word\":\"Boäh\"}",
- "3"),
- Message.of(
- "{\"username\":\"klaus\",\"word\":\"s\"}",
- "3"),
+ expectedMessages().forEach(
+ (word, counter) ->
+ assertThat(receivedMessages.get(word))
+ .containsExactlyElementsOf(counter));
+ }
+
+ private static final KeyValue<TestOutputWord, TestOutputWordCounter>[] EXPECTED_MESSAGES = new KeyValue[]
+ {
+ KeyValue.pair(
+ TestOutputWord.of(PETER, "Hallo"),
+ TestOutputWordCounter.of(PETER, "Hallo",1)),
+ KeyValue.pair(
+ TestOutputWord.of(KLAUS, "Müsch"),
+ TestOutputWordCounter.of(KLAUS, "Müsch",1)),
+ KeyValue.pair(
+ TestOutputWord.of(PETER, "Welt"),
+ TestOutputWordCounter.of(PETER, "Welt",1)),
+ KeyValue.pair(
+ TestOutputWord.of(KLAUS, "Müsch"),
+ TestOutputWordCounter.of(KLAUS, "Müsch",2)),
+ KeyValue.pair(
+ TestOutputWord.of(KLAUS, "s"),
+ TestOutputWordCounter.of(KLAUS, "s",1)),
+ KeyValue.pair(
+ TestOutputWord.of(PETER, "Boäh"),
+ TestOutputWordCounter.of(PETER, "Boäh",1)),
+ KeyValue.pair(
+ TestOutputWord.of(PETER, "Welt"),
+ TestOutputWordCounter.of(PETER, "Welt",2)),
+ KeyValue.pair(
+ TestOutputWord.of(PETER, "Boäh"),
+ TestOutputWordCounter.of(PETER, "Boäh",2)),
+ KeyValue.pair(
+ TestOutputWord.of(KLAUS, "s"),
+ TestOutputWordCounter.of(KLAUS, "s",2)),
+ KeyValue.pair(
+ TestOutputWord.of(PETER, "Boäh"),
+ TestOutputWordCounter.of(PETER, "Boäh",3)),
+ KeyValue.pair(
+ TestOutputWord.of(KLAUS, "s"),
+ TestOutputWordCounter.of(KLAUS, "s",3)),