From c3e50474632b180d531661a3d70628d62fa03762 Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Fri, 5 Jul 2024 23:27:11 +0200 Subject: [PATCH] Compacted & clearified code: records are created "in place" --- .../counter/StreamStreamJoinTopologyTest.java | 36 ++++++------------- 1 file changed, 11 insertions(+), 25 deletions(-) diff --git a/src/test/java/de/juplo/kafka/wordcount/counter/StreamStreamJoinTopologyTest.java b/src/test/java/de/juplo/kafka/wordcount/counter/StreamStreamJoinTopologyTest.java index c930c9e..de45d53 100644 --- a/src/test/java/de/juplo/kafka/wordcount/counter/StreamStreamJoinTopologyTest.java +++ b/src/test/java/de/juplo/kafka/wordcount/counter/StreamStreamJoinTopologyTest.java @@ -22,20 +22,6 @@ import static org.assertj.core.api.Assertions.assertThat; @Slf4j public class StreamStreamJoinTopologyTest { - TestRecord A = recordOf("A", 3); - TestRecord a = recordOf("a", 4); - TestRecord B = recordOf("B", 5); - TestRecord b = recordOf("b", 6); - TestRecord C = recordOf("C", 9); - TestRecord c = recordOf("c", 10); - TestRecord D = recordOf("D", 15); - TestRecord d = recordOf("d", 14); - TestRecord E = recordOf("E", 40); - TestRecord F = recordOf("F", 60); - TestRecord f = recordOf("f", 80); - TestRecord G = recordOf("G", 100); - - @Test public void test() { @@ -75,37 +61,37 @@ public class StreamStreamJoinTopologyTest Serdes.String().deserializer()); - inLeft.pipeInput(A); + inLeft.pipeInput(recordOf("A", 3)); assertThat(outcome()).containsExactlyInAnyOrder(); - inRight.pipeInput(a); + inRight.pipeInput(recordOf("a", 4)); assertThat(outcome()).containsExactlyInAnyOrder("A-a"); - inLeft.pipeInput(B); + inLeft.pipeInput(recordOf("B", 5)); assertThat(outcome()).containsExactlyInAnyOrder("B-a"); - inRight.pipeInput(b); + inRight.pipeInput(recordOf("b", 6)); assertThat(outcome()).containsExactlyInAnyOrder("A-b", "B-b"); - inLeft.pipeInput(C); + inLeft.pipeInput(recordOf("C", 9)); assertThat(outcome()).containsExactlyInAnyOrder("C-a", "C-b"); - inRight.pipeInput(c); + inRight.pipeInput(recordOf("c", 10)); assertThat(outcome()).containsExactlyInAnyOrder("A-c", "B-c", "C-c"); - inRight.pipeInput(d); + inRight.pipeInput(recordOf("d", 14)); assertThat(outcome()).containsExactlyInAnyOrder("B-d", "C-d"); // ! - inLeft.pipeInput(D); + inLeft.pipeInput(recordOf("D", 15)); assertThat(outcome()).containsExactlyInAnyOrder("D-b", "D-c", "D-d"); - inLeft.pipeInput(E); + inLeft.pipeInput(recordOf("E", 40)); assertThat(outcome()).containsExactlyInAnyOrder(); - inLeft.pipeInput(F); + inLeft.pipeInput(recordOf("F", 60)); assertThat(outcome()).containsExactlyInAnyOrder(); - inLeft.pipeInput(G); + inLeft.pipeInput(recordOf("G", 100)); assertThat(outcome()).containsExactlyInAnyOrder(); } -- 2.20.1