sebastienviale commented on code in PR #18233:
URL: https://github.com/apache/kafka/pull/18233#discussion_r1948837239


##########
streams/src/test/java/org/apache/kafka/streams/StreamsBuilderTest.java:
##########
@@ -2354,6 +2363,418 @@ public void shouldNowAllowStreamAndTableFromSameTopic() 
{
         assertThrows(TopologyException.class, builder::build);
     }
 
+    @ParameterizedTest
+    @CsvSource({
+        "true, false, true, false",
+        "false, true, true, true",
+        "true, true, true, true",
+        "false, false, false, false"
+    })
+    public void groupByWithAggregationTest(final boolean isGroupByKeyNamed,
+                                           final boolean isMaterializedNamed,
+                                           final boolean isLoggingEnabled,
+                                           final boolean isValid) {
+        final Map<Object, Object> props = dummyStreamsConfigMap();
+        props.put(ENSURE_EXPLICIT_INTERNAL_RESOURCE_NAMING_CONFIG, true);
+
+        final Grouped<String, String> grouped;
+        final Materialized<String, Long, KeyValueStore<Bytes, byte[]>> 
materialized;
+        if (isGroupByKeyNamed) {
+            grouped = Grouped.with("repartition-name", Serdes.String(), 
Serdes.String());
+        } else {
+            grouped = Grouped.with(Serdes.String(), Serdes.String());
+        }
+        if (isMaterializedNamed) {
+            materialized = Materialized.<String, Long, KeyValueStore<Bytes, 
byte[]>>as("materialized-name")
+                .withKeySerde(Serdes.String()).withValueSerde(Serdes.Long());
+        } else {
+            if (isLoggingEnabled) {
+                materialized = Materialized.with(Serdes.String(), 
Serdes.Long());
+            } else {
+                materialized = Materialized.<String, Long, 
KeyValueStore<Bytes, byte[]>>with(Serdes.String(), Serdes.Long())
+                    .withLoggingDisabled();
+            }
+        }
+
+        final StreamsBuilder builder = new StreamsBuilder(new 
TopologyConfig(new StreamsConfig(props)));
+        final KStream<String, String> stream = builder.stream("input1");
+        stream
+            .groupBy((k, v) -> v, grouped)
+            .count(materialized)
+            .toStream()
+            .to("output", Produced.as("sink"));
+
+        if (isValid) {
+            assertDoesNotThrow(() -> builder.build());
+        } else {
+            final TopologyException e = assertThrows(TopologyException.class, 
() -> builder.build());

Review Comment:
   all unit tests have been refactored



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to