lucasbru commented on code in PR #14503: URL: https://github.com/apache/kafka/pull/14503#discussion_r1356663540
########## clients/src/test/java/org/apache/kafka/clients/consumer/internals/PrototypeAsyncConsumerTest.java: ########## @@ -322,6 +323,25 @@ public void testOffsetsForTimesOnNullPartitions() { Duration.ofMillis(1))); } + @Test + public void testOffsetsForTimesFailsOnNegativeTargetTimes() { + PrototypeAsyncConsumer<?, ?> consumer = newConsumer(time, new StringDeserializer(), new StringDeserializer()); + assertThrows(IllegalArgumentException.class, + () -> consumer.offsetsForTimes(Collections.singletonMap(new TopicPartition( + "topic1", 1), ListOffsetsRequest.EARLIEST_TIMESTAMP), + Duration.ofMillis(1))); + + assertThrows(IllegalArgumentException.class, + () -> consumer.offsetsForTimes(Collections.singletonMap(new TopicPartition( Review Comment: Actually, under which circumstances would a user even use these constants? All uses seem to be internal, if I see correctly. Checking non-negative makes sense, just not sure why we are checking for these (internal?) constants specifically. -- 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. To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org