[
https://issues.apache.org/jira/browse/KAFKA-9631?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Eduardo Pinto reassigned KAFKA-9631:
------------------------------------
Assignee: Eduardo Pinto
> MockAdminClient doesn't handle CreateTopics optional fields
> -----------------------------------------------------------
>
> Key: KAFKA-9631
> URL: https://issues.apache.org/jira/browse/KAFKA-9631
> Project: Kafka
> Issue Type: Bug
> Reporter: Gwen Shapira
> Assignee: Eduardo Pinto
> Priority: Major
>
> AdminClient's {{createTopics()}} method has a variant with two optional
> fields. So I'd expect the following code to work correctly:
> {{admin.createTopics(Collections.singletonList(new NewTopic(TOPIC_NAME,
> Optional.empty(), Optional.empty())))}}
> Indeed it works great, as long as we are using the real KafkaAdminClient.
> MockKafkaAdminClient tries to get number of replicas without checking that
> the values make sense , and therefore it fails with:
> {{java.lang.IllegalArgumentException: Illegal Capacity: -1}}{{at
> java.base/java.util.ArrayList.<init>(ArrayList.java:158)}}
> {{ at
> org.apache.kafka.clients.admin.MockAdminClient.createTopics(MockAdminClient.java:183)}}
> {{ at org.apache.kafka.clients.admin.Admin.createTopics(Admin.java:125)}}
> Making a mockery of the mock.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)