query: 2.0.1 - (RED) Corrected expectations for JSON in input-messages
authorKai Moritz <kai@juplo.de>
Sun, 16 Jun 2024 19:35:58 +0000 (21:35 +0200)
committerKai Moritz <kai@juplo.de>
Sun, 16 Jun 2024 19:39:29 +0000 (21:39 +0200)
pom.xml
src/test/java/de/juplo/kafka/wordcount/query/TestData.java
src/test/java/de/juplo/kafka/wordcount/top10/TestEntry.java
src/test/java/de/juplo/kafka/wordcount/top10/TestUser.java

diff --git a/pom.xml b/pom.xml
index 3edc6d3..707d82d 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -10,7 +10,7 @@
        </parent>
        <groupId>de.juplo.kafka.wordcount</groupId>
        <artifactId>query</artifactId>
-       <version>2.0.0</version>
+       <version>2.0.1</version>
        <name>Wordcount-Query</name>
        <description>Query stream-processor of the multi-user wordcount-example</description>
        <properties>
index c190eed..cf58173 100644 (file)
@@ -30,8 +30,8 @@ class TestData
 
        static void assertExpectedState(Function<String, UserRanking> function)
        {
-               assertRankingEqualsRankingFromLastMessage(PETER.getUsername(), function.apply(PETER.getUsername()));
-               assertRankingEqualsRankingFromLastMessage(KLAUS.getUsername(), function.apply(KLAUS.getUsername()));
+               assertRankingEqualsRankingFromLastMessage(PETER.getUser(), function.apply(PETER.getUser()));
+               assertRankingEqualsRankingFromLastMessage(KLAUS.getUser(), function.apply(KLAUS.getUser()));
        }
 
        private static void assertRankingEqualsRankingFromLastMessage(String user, UserRanking rankingJson)
@@ -42,7 +42,7 @@ class TestData
        private static UserRanking getLastMessageFor(String user)
        {
                return getTop10Messages()
-                               .filter(kv -> kv.key.getUsername().equals(user))
+                               .filter(kv -> kv.key.getUser().equals(user))
                                .map(kv -> kv.value)
                                .map(testRanking -> userRankingFor(user, testRanking))
                                .reduce(null, (left, right) -> right);
@@ -70,7 +70,7 @@ class TestData
        {
                Entry entry = new Entry();
                entry.setWord(testEntry.getWord());
-               entry.setCount(testEntry.getCount());
+               entry.setCount(testEntry.getCounter());
                return entry;
        }
        private static KeyValue<TestUser, TestRanking>[] TOP10_MESSAGES = new KeyValue[]
@@ -136,10 +136,10 @@ class TestData
        private static KeyValue<String, TestUserData>[] USERS_MESSAGES = new KeyValue[]
        {
                        KeyValue.pair(
-                                       PETER.getUsername(),
-                                       TestUserData.of(PETER.getUsername(), "Peter", "Pan", TestUserData.Sex.MALE)),
+                                       PETER.getUser(),
+                                       TestUserData.of(PETER.getUser(), "Peter", "Pan", TestUserData.Sex.MALE)),
                        KeyValue.pair(
-                                       KLAUS.getUsername(),
-                                       TestUserData.of(KLAUS.getUsername(), "Klaus", "Klüse", TestUserData.Sex.OTHER)),
+                                       KLAUS.getUser(),
+                                       TestUserData.of(KLAUS.getUser(), "Klaus", "Klüse", TestUserData.Sex.OTHER)),
        };
 }
index 215327f..ceafa82 100644 (file)
@@ -11,5 +11,5 @@ import lombok.NoArgsConstructor;
 public class TestEntry
 {
   String word;
-  long count;
+  long counter;
 }
index cc48496..cc63c34 100644 (file)
@@ -10,5 +10,5 @@ import lombok.NoArgsConstructor;
 @Data
 public class TestUser
 {
-  String username;
+  String user;
 }