brenden20 commented on code in PR #16115:
URL: https://github.com/apache/kafka/pull/16115#discussion_r1633783863


##########
clients/src/test/java/org/apache/kafka/clients/consumer/internals/CommitRequestManagerTest.java:
##########
@@ -123,6 +124,50 @@ public void setup() {
         this.props.put(VALUE_DESERIALIZER_CLASS_CONFIG, 
StringDeserializer.class);
     }
 
+    @Test
+    public void testOffsetFetchRequestStateToStringBase() {
+        ConsumerConfig config = mock(ConsumerConfig.class);
+        CommitRequestManager.MemberInfo memberInfo = new 
CommitRequestManager.MemberInfo();
+
+        CommitRequestManager commitRequestManager = new CommitRequestManager(
+                time,
+                logContext,
+                subscriptionState,
+                config,
+                coordinatorRequestManager,
+                offsetCommitCallbackInvoker,
+                "groupId",
+                Optional.of("groupInstanceId"),
+                metrics);
+
+        Set<TopicPartition> requestedPartitions = new HashSet<>();
+        TopicPartition topicPartition1 = new TopicPartition("topic-1", 1);
+        requestedPartitions.add(topicPartition1);
+
+        CommitRequestManager.OffsetFetchRequestState offsetFetchRequestState = 
commitRequestManager.new OffsetFetchRequestState(
+                requestedPartitions,
+                retryBackoffMs,
+                retryBackoffMaxMs,
+                1000,
+                memberInfo);
+
+        RequestState requestState = new RequestState(
+                logContext,
+                "CommitRequestManager",
+                retryBackoffMs,
+                retryBackoffMaxMs);
+
+        String target = requestState.toStringBase() +
+                ", memberInfo=" + memberInfo +
+                ", expirationTimeMs=" + 
(offsetFetchRequestState.expirationTimeMs().isPresent() ? 
offsetFetchRequestState.expirationTimeMs() : "undefined") +

Review Comment:
   Looking at the code, I am able to do this, however it will cause an issue 
with OffsetFetchRequestState.toStringBase(). ```expirationTimeMs()``` is needed 
to implement the ```toStringBase()``` method, since 
```OffsetFetchRequestState``` cannot access 
```RetriableRequestState.expirationTimeMs``` since it is a private field.



-- 
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

Reply via email to