mjsax commented on a change in pull request #8847: URL: https://github.com/apache/kafka/pull/8847#discussion_r438482188
########## File path: streams/src/test/java/org/apache/kafka/streams/processor/internals/InternalTopologyBuilderTest.java ########## @@ -372,48 +373,112 @@ public void testAddStateStoreWithSink() { @Test public void shouldNotAllowToAddStoresWithSameName() { + final StoreBuilder<KeyValueStore<Object, Object>> otherBuilder = Review comment: Just refactoring: - add missing generic types - use `assertThrows` - add check for error message ########## File path: streams/src/test/java/org/apache/kafka/streams/processor/internals/InternalTopologyBuilderTest.java ########## @@ -372,48 +373,112 @@ public void testAddStateStoreWithSink() { @Test public void shouldNotAllowToAddStoresWithSameName() { + final StoreBuilder<KeyValueStore<Object, Object>> otherBuilder = + new MockKeyValueStoreBuilder("testStore", false); + builder.addStateStore(storeBuilder); - final StoreBuilder otherBuilder = new MockKeyValueStoreBuilder("store", false); - try { - builder.addStateStore(otherBuilder); - fail("Should throw TopologyException with store name conflict"); - } catch (final TopologyException expected) { /* ok */ } + + final TopologyException exception = assertThrows( + TopologyException.class, + () -> builder.addStateStore(otherBuilder) + ); + + assertThat( + exception.getMessage(), + equalTo("Invalid topology: A different StateStore has already been added with the name testStore") + ); } @Test public void shouldNotAllowToAddStoresWithSameNameWhenFirstStoreIsGlobal() { - final StoreBuilder storeBuilder = new MockKeyValueStoreBuilder("store", false).withLoggingDisabled(); Review comment: As above ---------------------------------------------------------------- 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