ableegoldman commented on a change in pull request #9582: URL: https://github.com/apache/kafka/pull/9582#discussion_r522476382
########## File path: streams/src/test/java/org/apache/kafka/streams/StreamsBuilderTest.java ########## @@ -895,6 +898,55 @@ public void shouldUseSpecifiedNameForAggregateOperationGivenTable() { STREAM_OPERATION_NAME); } + @Test + public void shouldAllowReadingFromSameTopic() { + builder.stream("topic"); + builder.stream("topic"); + builder.build(); + } + + @Test + public void shouldAllowSubscribingToSamePattern() { + builder.stream(Pattern.compile("some-regex")); + builder.stream(Pattern.compile("some-regex")); + builder.build(); + } + + @Test + public void shouldAllowReadingFromSameCollectionOfTopics() { + builder.stream(Collections.singletonList("topic")); + builder.stream(Collections.singletonList("topic")); + builder.build(); + } + + @Test + public void shouldNotAllowReadingFromOverlappingAndUnequalCollectionOfTopics() { + builder.stream(Collections.singletonList("topic")); + builder.stream(asList("topic", "anotherTopic")); + assertThrows(TopologyException.class, builder::build); + } + + @Test + public void shouldThrowWhenSubscribedToATopicWithDifferentResetPolicies() { + builder.stream("topic", Consumed.with(AutoOffsetReset.EARLIEST)); + builder.stream("topic", Consumed.with(AutoOffsetReset.LATEST)); + assertThrows(TopologyException.class, builder::build); + } + + @Test + public void shouldThrowWhenSubscribedToATopicWithSetAndUnsetResetPolicies() { + builder.stream("topic", Consumed.with(AutoOffsetReset.EARLIEST)); + builder.stream("topic"); + assertThrows(TopologyException.class, builder::build); + } Review comment: Yep that was just an oversight in the condition in `merge()`. I fixed that and added another unit test for the case ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org