From: Kai Moritz Date: Sun, 16 Jun 2024 19:35:58 +0000 (+0200) Subject: query: 2.0.1 - (RED) Corrected expectations for JSON in input-messages X-Git-Tag: query-2.0.1~1 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=035b1f29fc38866e699452aeabda9675cef24c82;p=demos%2Fkafka%2Fwordcount query: 2.0.1 - (RED) Corrected expectations for JSON in input-messages --- diff --git a/pom.xml b/pom.xml index 3edc6d3..707d82d 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ de.juplo.kafka.wordcount query - 2.0.0 + 2.0.1 Wordcount-Query Query stream-processor of the multi-user wordcount-example diff --git a/src/test/java/de/juplo/kafka/wordcount/query/TestData.java b/src/test/java/de/juplo/kafka/wordcount/query/TestData.java index c190eed..cf58173 100644 --- a/src/test/java/de/juplo/kafka/wordcount/query/TestData.java +++ b/src/test/java/de/juplo/kafka/wordcount/query/TestData.java @@ -30,8 +30,8 @@ class TestData static void assertExpectedState(Function 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[] TOP10_MESSAGES = new KeyValue[] @@ -136,10 +136,10 @@ class TestData private static KeyValue[] 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)), }; } diff --git a/src/test/java/de/juplo/kafka/wordcount/top10/TestEntry.java b/src/test/java/de/juplo/kafka/wordcount/top10/TestEntry.java index 215327f..ceafa82 100644 --- a/src/test/java/de/juplo/kafka/wordcount/top10/TestEntry.java +++ b/src/test/java/de/juplo/kafka/wordcount/top10/TestEntry.java @@ -11,5 +11,5 @@ import lombok.NoArgsConstructor; public class TestEntry { String word; - long count; + long counter; } diff --git a/src/test/java/de/juplo/kafka/wordcount/top10/TestUser.java b/src/test/java/de/juplo/kafka/wordcount/top10/TestUser.java index cc48496..cc63c34 100644 --- a/src/test/java/de/juplo/kafka/wordcount/top10/TestUser.java +++ b/src/test/java/de/juplo/kafka/wordcount/top10/TestUser.java @@ -10,5 +10,5 @@ import lombok.NoArgsConstructor; @Data public class TestUser { - String username; + String user; }