[ https://issues.apache.org/jira/browse/KAFKA-9631?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17793048#comment-17793048 ]
Eduardo Pinto commented on KAFKA-9631: -------------------------------------- I don't have the capacity to work on this and don't even know if this is still relevant so I've unsigned myself and will close the PR. > 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 > 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.20.10#820010)