Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThrows;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyCollection;
import static org.mockito.ArgumentMatchers.anyLong;
import static org.mockito.ArgumentMatchers.anyMap;
import static org.mockito.ArgumentMatchers.argThat;
Expand Down Expand Up @@ -109,7 +110,7 @@ public void setUp() {
topicConfigs.clear();

when(adminClient.listTopics()).thenAnswer(listTopicResult());
when(adminClient.describeTopics(any(), any())).thenAnswer(describeTopicsResult());
when(adminClient.describeTopics(anyCollection(), any())).thenAnswer(describeTopicsResult());
when(adminClient.createTopics(any(), any())).thenAnswer(createTopicsResult());
when(adminClient.deleteTopics(any(Collection.class))).thenAnswer(deleteTopicsResult());
when(adminClient.describeConfigs(any())).thenAnswer(describeConfigsResult());
Expand Down Expand Up @@ -193,7 +194,7 @@ public void shouldRetryDescribeTopicDuringCreateTopicOnRetryableException() {
// Given:
givenTopicExists("topicName", 1, 2);

when(adminClient.describeTopics(any(), any()))
when(adminClient.describeTopics(anyCollection(), any()))
.thenAnswer(describeTopicsResult()) // checks that topic exists
.thenAnswer(describeTopicsResult(new UnknownTopicOrPartitionException("meh"))) // fails during validateProperties
.thenAnswer(describeTopicsResult()); // succeeds the third time
Expand All @@ -202,7 +203,7 @@ public void shouldRetryDescribeTopicDuringCreateTopicOnRetryableException() {
kafkaTopicClient.createTopic("topicName", 1, (short) 2);

// Then:
verify(adminClient, times(3)).describeTopics(any(), any());
verify(adminClient, times(3)).describeTopics(anyCollection(), any());
}

@Test
Expand Down Expand Up @@ -279,7 +280,7 @@ public void shouldRetryDescribeTopicDuringValidateCreateTopicOnRetryableExceptio
// Given:
givenTopicExists("topicName", 1, 2);

when(adminClient.describeTopics(any(), any()))
when(adminClient.describeTopics(anyCollection(), any()))
.thenAnswer(describeTopicsResult()) // checks that topic exists
.thenAnswer(describeTopicsResult(new UnknownTopicOrPartitionException("meh"))) // fails during validateProperties
.thenAnswer(describeTopicsResult()); // succeeds the third time
Expand All @@ -288,13 +289,13 @@ public void shouldRetryDescribeTopicDuringValidateCreateTopicOnRetryableExceptio
kafkaTopicClient.validateCreateTopic("topicName", 1, (short) 2);

// Then:
verify(adminClient, times(3)).describeTopics(any(), any());
verify(adminClient, times(3)).describeTopics(anyCollection(), any());
}

@Test
public void shouldThrowOnDescribeTopicsWhenRetriesExpire() {
// Given:
when(adminClient.describeTopics(any(), any()))
when(adminClient.describeTopics(anyCollection(), any()))
.thenAnswer(describeTopicsResult(new UnknownTopicOrPartitionException("meh")))
.thenAnswer(describeTopicsResult(new UnknownTopicOrPartitionException("meh")))
.thenAnswer(describeTopicsResult(new UnknownTopicOrPartitionException("meh")))
Expand All @@ -311,7 +312,7 @@ public void shouldThrowOnDescribeTopicsWhenRetriesExpire() {
@Test
public void shouldThrowOnDescribeOnTopicAuthorizationException() {
// Given:
when(adminClient.describeTopics(any(), any()))
when(adminClient.describeTopics(anyCollection(), any()))
.thenAnswer(describeTopicsResult(new TopicAuthorizationException("meh")));

// When:
Expand Down Expand Up @@ -810,7 +811,7 @@ public void shouldNotRetryIsTopicExistsOnUnknownTopicException() {
kafkaTopicClient.isTopicExists("foobar");

// Then
verify(adminClient, times(1)).describeTopics(any(), any());
verify(adminClient, times(1)).describeTopics(anyCollection(), any());
}

@Test
Expand Down