tombentley commented on a change in pull request #8311: URL: https://github.com/apache/kafka/pull/8311#discussion_r435162174
########## File path: clients/src/test/java/org/apache/kafka/clients/admin/KafkaAdminClientTest.java ########## @@ -477,6 +484,27 @@ public void testCreateTopics() throws Exception { } } + @Test + public void testCreateTopicsPartialResponse() throws Exception { + try (AdminClientUnitTestEnv env = mockClientEnv()) { + env.kafkaClient().setNodeApiVersions(NodeApiVersions.create()); + env.kafkaClient().prepareResponse(body -> body instanceof CreateTopicsRequest, + prepareCreateTopicsResponse("myTopic", Errors.NONE)); + CreateTopicsResult topicsResult = env.adminClient().createTopics( + asList(new NewTopic("myTopic", Collections.singletonMap(0, asList(0, 1, 2))), + new NewTopic("myTopic2", Collections.singletonMap(0, asList(0, 1, 2)))), + new CreateTopicsOptions().timeoutMs(10000)); + topicsResult.values().get("myTopic").get(); + try { + topicsResult.values().get("myTopic2").get(); + fail("Expected an exception."); + } catch (ExecutionException e) { Review comment: I don't think we can, at least not if we want to check that `topicsResult.values().get("myTopic2").get()` throws an `ExecutionException` _wrapping an `ApiException`_. `assertThrows()` would only let us assert the outer exception type. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org