{
static void writeInputData(BiConsumer<String, Word> consumer)
{
- consumer.accept(
- "peter",
- Word.of("peter","Hallo"));
- consumer.accept(
- "klaus",
- Word.of("klaus","Müsch"));
- consumer.accept(
- "peter",
- Word.of("peter","Welt"));
- consumer.accept(
- "klaus",
- Word.of("klaus","Müsch"));
- consumer.accept(
- "klaus",
- Word.of("klaus","s"));
- consumer.accept(
- "peter",
- Word.of("peter","Boäh"));
- consumer.accept(
- "peter",
- Word.of("peter","Welt"));
- consumer.accept(
- "peter",
- Word.of("peter","Boäh"));
- consumer.accept(
- "klaus",
- Word.of("klaus","s"));
- consumer.accept(
- "peter",
- Word.of("peter","Boäh"));
- consumer.accept(
- "klaus",
- Word.of("klaus","s"));
+ Stream
+ .of(inputMessagesArray)
+ .forEach(word -> consumer.accept(word.getUser(), word));
}
+ static Word[] inputMessagesArray = new Word[]
+ {
+ Word.of("peter","Hallo"),
+ Word.of("klaus","Müsch"),
+ Word.of("peter","Welt"),
+ Word.of("klaus","Müsch"),
+ Word.of("klaus","s"),
+ Word.of("peter","Boäh"),
+ Word.of("peter","Welt"),
+ Word.of("peter","Boäh"),
+ Word.of("klaus","s"),
+ Word.of("peter","Boäh"),
+ Word.of("klaus","s"),
+ };
+
static void assertExpectedResult(MultiValueMap<Word, WordCounter> receivedMessages)
{
expectedMessages.forEach(