fxbing commented on a change in pull request #11912:
URL: https://github.com/apache/kafka/pull/11912#discussion_r829903239
##########
File path:
clients/src/test/java/org/apache/kafka/common/requests/MetadataRequestTest.java
##########
@@ -20,6 +20,7 @@
import org.apache.kafka.common.errors.UnsupportedVersionException;
import org.apache.kafka.common.message.MetadataRequestData;
import org.apache.kafka.common.protocol.ApiKeys;
+import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
Review comment:
done
##########
File path:
clients/src/test/java/org/apache/kafka/common/requests/MetadataRequestTest.java
##########
@@ -74,20 +75,30 @@ public void testMetadataRequestVersion() {
@Test
public void testTopicIdAndNullTopicNameRequests() {
// Construct invalid MetadataRequestTopics. We will build each one
separately and ensure the error is thrown.
- List<MetadataRequestData.MetadataRequestTopic> topics = Arrays.asList(
+ List<MetadataRequestData.MetadataRequestTopic> invalidTopics =
Arrays.asList(
new
MetadataRequestData.MetadataRequestTopic().setName(null).setTopicId(Uuid.randomUuid()),
new MetadataRequestData.MetadataRequestTopic().setName(null),
new
MetadataRequestData.MetadataRequestTopic().setTopicId(Uuid.randomUuid()),
new
MetadataRequestData.MetadataRequestTopic().setName("topic").setTopicId(Uuid.randomUuid()));
+ List<MetadataRequestData.MetadataRequestTopic> validTopics =
Arrays.asList(
Review comment:
done
##########
File path:
clients/src/main/java/org/apache/kafka/common/requests/MetadataResponse.java
##########
@@ -151,7 +151,7 @@ public Cluster buildCluster() {
if (metadata.error == Errors.NONE) {
if (metadata.isInternal)
internalTopics.add(metadata.topic);
- if (metadata.topicId() != null && metadata.topicId() !=
Uuid.ZERO_UUID) {
+ if (metadata.topicId() != null &&
!Uuid.ZERO_UUID.equals(metadata.topicId())) {
Review comment:
As @jolshan say, MetadataResponseTest is less necessary since the server
should be building the response, but doesn't hurt.
##########
File path:
clients/src/main/java/org/apache/kafka/common/requests/MetadataResponse.java
##########
@@ -151,7 +151,7 @@ public Cluster buildCluster() {
if (metadata.error == Errors.NONE) {
if (metadata.isInternal)
internalTopics.add(metadata.topic);
- if (metadata.topicId() != null && metadata.topicId() !=
Uuid.ZERO_UUID) {
+ if (metadata.topicId() != null &&
!Uuid.ZERO_UUID.equals(metadata.topicId())) {
Review comment:
As @jolshan say, MetadataResponseTest is less necessary since the server
should be building the response, but doesn't hurt.
Do I need to add MetadataResponseTest?
--
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]