@Test
public void testGetTopicMetadataLeaderNotAvailable() {

    client.prepareResponse(newMetadataResponse(topicName, Errors.LEADER_NOT_AVAILABLE).toStruct());
    client.prepareResponse(newMetadataResponse(topicName, Errors.NONE).toStruct());
    Map<String, List<PartitionInfo>> topicMetadata = fetcher.getTopicMetadata(new MetadataRequest(Collections.singletonList(topicName)), 5000L);
    assertTrue(topicMetadata.containsKey(topicName));
}