private void verifyPartitionsAndStoresForTopology(final String topologyName, final StreamsMetadataImpl metadata) {
        assertThat(metadata.topologyName(), equalTo(topologyName));
        assertThat(streams.getTopologyByName(topologyName).isPresent(), is(true));
        assertThat(streams2.getTopologyByName(topologyName).isPresent(), is(true));
        final List<String> streams1SourceTopicsForTopology = streams.getTopologyByName(topologyName).get().sourceTopics();
        final List<String> streams2SourceTopicsForTopology = streams2.getTopologyByName(topologyName).get().sourceTopics();

        // first check that all partitions in the metadata correspond to the given named topology
        assertThat(
            streams1SourceTopicsForTopology.containsAll(metadata.topicPartitions().stream()
                                                            .map(TopicPartition::topic)
                                                            .collect(Collectors.toList())),
            is(true));
        assertThat(
            streams2SourceTopicsForTopology.containsAll(metadata.topicPartitions().stream()
                                                            .map(TopicPartition::topic)
                                                            .collect(Collectors.toList())),
            is(true));

        // then verify that only this topology's one store appears if the host has partitions assigned
        if (!metadata.topicPartitions().isEmpty()) {
            assertThat(metadata.stateStoreNames(), equalTo(singleton("store-" + topologyName)));
        } else {
            assertThat(metadata.stateStoreNames().isEmpty(), is(true));
        }

        // finally make sure the standby fields are empty since they are not enabled for this test
        assertThat(metadata.standbyTopicPartitions().isEmpty(), is(true));
        assertThat(metadata.standbyStateStoreNames().isEmpty(), is(true));
    }
Validates that each metadata object has only partitions & state stores for its specific topology name and
asserts that {@code left} and {@code right} differ only by {@link StreamsMetadata#hostInfo()}
streams/src/test/java/org/apache/kafka/streams/integration/NamedTopologyIntegrationTest.java