projects
/
demos
/
kafka
/
wordcount
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
splitter: 1.2.0 - Renamed classes for test-input/-output -- ALIGN
[demos/kafka/wordcount]
/
src
/
test
/
java
/
de
/
juplo
/
kafka
/
wordcount
/
splitter
/
TestData.java
diff --git
a/src/test/java/de/juplo/kafka/wordcount/splitter/TestData.java
b/src/test/java/de/juplo/kafka/wordcount/splitter/TestData.java
index
8c343d5
..
feedb1e
100644
(file)
--- a/
src/test/java/de/juplo/kafka/wordcount/splitter/TestData.java
+++ b/
src/test/java/de/juplo/kafka/wordcount/splitter/TestData.java
@@
-1,7
+1,7
@@
package de.juplo.kafka.wordcount.splitter;
package de.juplo.kafka.wordcount.splitter;
-import de.juplo.kafka.wordcount.counter.TestWord;
-import de.juplo.kafka.wordcount.recorder.TestRecording;
+import de.juplo.kafka.wordcount.counter.Test
Output
Word;
+import de.juplo.kafka.wordcount.recorder.Test
Input
Recording;
import org.apache.kafka.streams.KeyValue;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.apache.kafka.streams.KeyValue;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
@@
-19,20
+19,25
@@
public class TestData
static final String KLAUS = "klaus";
static final String KLAUS = "klaus";
- static final KeyValue<String, TestRecording>[] INPUT_MESSAGES = new KeyValue[]
+ static final Stream<KeyValue<String, TestInputRecording>> getInputMessages()
+ {
+ return Stream.of(INPUT_MESSAGES);
+ }
+
+ private static final KeyValue<String, TestInputRecording>[] INPUT_MESSAGES = new KeyValue[]
{
new KeyValue<>(
PETER,
{
new KeyValue<>(
PETER,
- TestRecording.of(PETER, "Hallo Welt!")),
+ Test
Input
Recording.of(PETER, "Hallo Welt!")),
new KeyValue<>(
KLAUS,
new KeyValue<>(
KLAUS,
- TestRecording.of(KLAUS, "Müsch gäb's auch!")),
+ Test
Input
Recording.of(KLAUS, "Müsch gäb's auch!")),
new KeyValue<>(
PETER,
new KeyValue<>(
PETER,
- TestRecording.of(PETER, "Boäh, echt! ß mal nä Nümmäh!")),
+ Test
Input
Recording.of(PETER, "Boäh, echt! ß mal nä Nümmäh!")),
};
};
- static void assertExpectedMessages(MultiValueMap<String, TestWord> receivedMessages)
+ static void assertExpectedMessages(MultiValueMap<String, Test
Output
Word> receivedMessages)
{
await("Received expected messages")
.atMost(Duration.ofSeconds(5))
{
await("Received expected messages")
.atMost(Duration.ofSeconds(5))
@@
-40,49
+45,49
@@
public class TestData
assertThat(receivedMessages.get(user)).containsExactlyElementsOf(word)));
}
assertThat(receivedMessages.get(user)).containsExactlyElementsOf(word)));
}
-
static final KeyValue<String, Tes
tWord>[] EXPECTED_MESSAGES = new KeyValue[]
+
private static final KeyValue<String, TestOutpu
tWord>[] EXPECTED_MESSAGES = new KeyValue[]
{
KeyValue.pair(
"peter",
{
KeyValue.pair(
"peter",
- TestWord.of("peter", "Hallo")),
+ Test
Output
Word.of("peter", "Hallo")),
KeyValue.pair(
"peter",
KeyValue.pair(
"peter",
- TestWord.of("peter", "Welt")),
+ Test
Output
Word.of("peter", "Welt")),
KeyValue.pair(
"klaus",
KeyValue.pair(
"klaus",
- TestWord.of("klaus", "Müsch")),
+ Test
Output
Word.of("klaus", "Müsch")),
KeyValue.pair(
"klaus",
KeyValue.pair(
"klaus",
- TestWord.of("klaus", "gäb")),
+ Test
Output
Word.of("klaus", "gäb")),
KeyValue.pair(
"klaus",
KeyValue.pair(
"klaus",
- TestWord.of("klaus", "s")),
+ Test
Output
Word.of("klaus", "s")),
KeyValue.pair(
"klaus",
KeyValue.pair(
"klaus",
- TestWord.of("klaus", "auch")),
+ Test
Output
Word.of("klaus", "auch")),
KeyValue.pair(
"peter",
KeyValue.pair(
"peter",
- TestWord.of("peter", "Boäh")),
+ Test
Output
Word.of("peter", "Boäh")),
KeyValue.pair(
"peter",
KeyValue.pair(
"peter",
- TestWord.of("peter", "echt")),
+ Test
Output
Word.of("peter", "echt")),
KeyValue.pair(
"peter",
KeyValue.pair(
"peter",
- TestWord.of("peter", "ß")),
+ Test
Output
Word.of("peter", "ß")),
KeyValue.pair(
"peter",
KeyValue.pair(
"peter",
- TestWord.of("peter", "mal")),
+ Test
Output
Word.of("peter", "mal")),
KeyValue.pair(
"peter",
KeyValue.pair(
"peter",
- TestWord.of("peter", "nä")),
+ Test
Output
Word.of("peter", "nä")),
KeyValue.pair(
"peter",
KeyValue.pair(
"peter",
- TestWord.of("peter", "Nümmäh")),
+ Test
Output
Word.of("peter", "Nümmäh")),
};
};
- static MultiValueMap<String, TestWord> expectedMessages()
+ static MultiValueMap<String, Test
Output
Word> expectedMessages()
{
{
- MultiValueMap<String, TestWord> expectedMessages = new LinkedMultiValueMap<>();
+ MultiValueMap<String, Test
Output
Word> expectedMessages = new LinkedMultiValueMap<>();
Stream
.of(EXPECTED_MESSAGES)
.forEach(keyValue -> expectedMessages.add(keyValue.key, keyValue.value));
Stream
.of(EXPECTED_MESSAGES)
.forEach(keyValue -> expectedMessages.add(keyValue.key, keyValue.value));