[ https://issues.apache.org/jira/browse/KAFKA-13752?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Xiaobing Fang updated KAFKA-13752: ---------------------------------- Description: `Uuid.ZERO_UUID == new Uuid(0L, 0L)` is true in scala, but in java is false. So this test run sccessfully. Is this the expected situation?? ``` @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( new MetadataRequestData.MetadataRequestTopic().setName(null).setTopicId(new Uuid(0L, 0L))); // if version is 10 or 11, the invalid topic metadata should return an error List<Short> invalidVersions = Arrays.asList((short) 10, (short) 11); invalidVersions.forEach(version -> topics.forEach(topic -> { MetadataRequestData metadataRequestData = new MetadataRequestData().setTopics(Collections.singletonList(topic)); MetadataRequest.Builder builder = new MetadataRequest.Builder(metadataRequestData); assertThrows(UnsupportedVersionException.class, () -> builder.build(version)); } ) ); } ``` was: `Uuid.ZERO_UUID == new Uuid(0L, 0L)` is true in scala, but in java is false. So this test run sccessfully. Is it excepted ? ``` @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( new MetadataRequestData.MetadataRequestTopic().setName(null).setTopicId(new Uuid(0L, 0L))); // if version is 10 or 11, the invalid topic metadata should return an error List<Short> invalidVersions = Arrays.asList((short) 10, (short) 11); invalidVersions.forEach(version -> topics.forEach(topic -> { MetadataRequestData metadataRequestData = new MetadataRequestData().setTopics(Collections.singletonList(topic)); MetadataRequest.Builder builder = new MetadataRequest.Builder(metadataRequestData); assertThrows(UnsupportedVersionException.class, () -> builder.build(version)); }) ); } > Using `equals` instead of `==` when Uuid compare in Java > -------------------------------------------------------- > > Key: KAFKA-13752 > URL: https://issues.apache.org/jira/browse/KAFKA-13752 > Project: Kafka > Issue Type: Improvement > Components: clients > Reporter: Xiaobing Fang > Priority: Minor > > `Uuid.ZERO_UUID == new Uuid(0L, 0L)` is true in scala, but in java is false. > > So this test run sccessfully. Is this the expected situation?? > ``` > @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( > new MetadataRequestData.MetadataRequestTopic().setName(null).setTopicId(new > Uuid(0L, 0L))); > // if version is 10 or 11, the invalid topic metadata should return an error > List<Short> invalidVersions = Arrays.asList((short) 10, (short) 11); > invalidVersions.forEach(version -> > topics.forEach(topic -> > { MetadataRequestData metadataRequestData = new > MetadataRequestData().setTopics(Collections.singletonList(topic)); > MetadataRequest.Builder builder = new > MetadataRequest.Builder(metadataRequestData); > assertThrows(UnsupportedVersionException.class, () -> > builder.build(version)); } > ) > ); > } > ``` -- This message was sent by Atlassian Jira (v8.20.1#820001)