chia7712 commented on code in PR #23221:
URL: https://github.com/apache/kafka/pull/23221#discussion_r3889009291
##########
clients/src/test/java/org/apache/kafka/clients/consumer/internals/FetcherTest.java:
##########
@@ -297,13 +291,27 @@ public void testInflightFetchOnPendingPartitions() {
@Test
public void testCloseShouldBeIdempotent() {
- buildFetcher();
+ final int[] closeCount = {0};
Review Comment:
Or we could leverage `var` to access the field of the anonymous class :)
```
var fetcher = new Fetcher<>(logContext, consumerClient, metadata,
subscriptions, fetchConfig,
new Deserializers<>(new ByteArrayDeserializer(), new
ByteArrayDeserializer(), metrics),
metricsManager, time, apiVersions) {
int count = 0;
@Override
protected void closeInternal(Timer timer) {
count++;
super.closeInternal(timer);
}
};
fetcher.close();
fetcher.close();
fetcher.close();
assertEquals(1, fetcher.count);
```
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]