@Test
public void testGetAvailableTopics() {

    final String topic1 = "MyTopic1" + System.currentTimeMillis();
    final String topic2 = "MyTopic2" + System.currentTimeMillis();
    // Create two topics
    sharedKafkaTestResource
        .getKafkaTestUtils()
        .createTopic(topic1, 2, (short) 1);
    sharedKafkaTestResource
        .getKafkaTestUtils()
        .createTopic(topic2, 1, (short) 1);
    // List topics
    final TopicList topics = kafkaOperations.getAvailableTopics();
    // Should have our two topics
    assertTrue("Should have topic1", topics.getTopicNames().contains(topic1));
    assertTrue("Should have topic2", topics.getTopicNames().contains(topic2));
    boolean foundTopic1 = false;
    boolean foundTopic2 = false;
    for (final TopicListing topicList: topics.getTopics()) {
        if (topicList.getName().equals(topic1)) {
            assertFalse("Haven't seen topic1 yet", foundTopic1);
            assertFalse("Shouldn't be an internal topic", topicList.isInternal());
            foundTopic1 = true;
        } else if (topicList.getName().equals(topic2)) {
            assertFalse("Haven't seen topic2 yet", foundTopic2);
            assertFalse("Shouldn't be an internal topic", topicList.isInternal());
            foundTopic2 = true;
        }
    }
    assertTrue("Found topic1", foundTopic1);
    assertTrue("Found topic1", foundTopic2);
}