top10: 1.3.0 - Refined input JSON to match the new general stats-format
[demos/kafka/wordcount] / src / test / java / de / juplo / kafka / wordcount / top10 / TestData.java
index 7a3a27e..4fb229b 100644 (file)
@@ -18,6 +18,8 @@ import static org.assertj.core.api.Assertions.assertThat;
 
 class TestData
 {
+       static final String TYPE_COUNTER = "COUNTER";
+
        static final TestUser PETER = TestUser.of("peter");
        static final TestUser KLAUS = TestUser.of("klaus");
 
@@ -29,38 +31,38 @@ class TestData
        private static final KeyValue<TestWord, TestCounter>[] INPUT_MESSAGES = new KeyValue[]
        {
                        new KeyValue<>(
-                                       TestWord.of(PETER.getUser(),"Hallo"),
-                                       TestCounter.of(PETER.getUser(),"Hallo",1)),
+                                       TestWord.of(TYPE_COUNTER, PETER.getUser(),"Hallo"),
+                                       TestCounter.of("Hallo",1)),
                        new KeyValue<>(
-                                       TestWord.of(KLAUS.getUser(),"Müsch"),
-                                       TestCounter.of(KLAUS.getUser(),"Müsch",1)),
+                                       TestWord.of(TYPE_COUNTER, KLAUS.getUser(),"Müsch"),
+                                       TestCounter.of("Müsch",1)),
                        new KeyValue<>(
-                                       TestWord.of(PETER.getUser(),"Welt"),
-                                       TestCounter.of(PETER.getUser(),"Welt",1)),
+                                       TestWord.of(TYPE_COUNTER, PETER.getUser(),"Welt"),
+                                       TestCounter.of("Welt",1)),
                        new KeyValue<>(
-                                       TestWord.of(KLAUS.getUser(),"Müsch"),
-                                       TestCounter.of(KLAUS.getUser(),"Müsch",2)),
+                                       TestWord.of(TYPE_COUNTER, KLAUS.getUser(),"Müsch"),
+                                       TestCounter.of("Müsch",2)),
                        new KeyValue<>(
-                                       TestWord.of(KLAUS.getUser(),"s"),
-                                       TestCounter.of(KLAUS.getUser(),"s",1)),
+                                       TestWord.of(TYPE_COUNTER, KLAUS.getUser(),"s"),
+                                       TestCounter.of("s",1)),
                        new KeyValue<>(
-                                       TestWord.of(PETER.getUser(),"Boäh"),
-                                       TestCounter.of(PETER.getUser(),"Boäh",1)),
+                                       TestWord.of(TYPE_COUNTER, PETER.getUser(),"Boäh"),
+                                       TestCounter.of("Boäh",1)),
                        new KeyValue<>(
-                                       TestWord.of(PETER.getUser(),"Welt"),
-                                       TestCounter.of(PETER.getUser(),"Welt",2)),
+                                       TestWord.of(TYPE_COUNTER, PETER.getUser(),"Welt"),
+                                       TestCounter.of("Welt",2)),
                        new KeyValue<>(
-                                       TestWord.of(PETER.getUser(),"Boäh"),
-                                       TestCounter.of(PETER.getUser(),"Boäh",2)),
+                                       TestWord.of(TYPE_COUNTER, PETER.getUser(),"Boäh"),
+                                       TestCounter.of("Boäh",2)),
                        new KeyValue<>(
-                                       TestWord.of(KLAUS.getUser(),"s"),
-                                       TestCounter.of(KLAUS.getUser(),"s",2)),
+                                       TestWord.of(TYPE_COUNTER, KLAUS.getUser(),"s"),
+                                       TestCounter.of("s",2)),
                        new KeyValue<>(
-                                       TestWord.of(PETER.getUser(),"Boäh"),
-                                       TestCounter.of(PETER.getUser(),"Boäh",3)),
+                                       TestWord.of(TYPE_COUNTER, PETER.getUser(),"Boäh"),
+                                       TestCounter.of("Boäh",3)),
                        new KeyValue<>(
-                                       TestWord.of(KLAUS.getUser(),"s"),
-                                       TestCounter.of(KLAUS.getUser(),"s",3)),
+                                       TestWord.of(TYPE_COUNTER, KLAUS.getUser(),"s"),
+                                       TestCounter.of("s",3)),
        };
 
        static void assertExpectedMessages(MultiValueMap<TestUser, TestRanking> receivedMessages)
@@ -113,7 +115,7 @@ class TestData
                return Arrays
                                .stream(entries)
                                .map(entry -> TestEntry.of(
-                                               entry.getWord(),
+                                               entry.getKey(),
                                                entry.getCounter() == null
                                                                ? -1l
                                                                : entry.getCounter()))