Skip to content

Commit 8eb8439

Browse files
MINOR: rackId is Optional#empty if input string is empty (apache#19906)
Add test case `testRackIdIsEmptyIfValueIsEmptyString`. Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
1 parent 7cd99ea commit 8eb8439

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

clients/src/test/java/org/apache/kafka/clients/GroupRebalanceConfigTest.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,20 @@ void testRackIdIsEmptyIfNoDefined(GroupRebalanceConfig.ProtocolType protocolType
4040
);
4141
assertTrue(groupRebalanceConfig.rackId.isEmpty());
4242
}
43+
44+
@ParameterizedTest
45+
@EnumSource(value = GroupRebalanceConfig.ProtocolType.class, names = {"CONSUMER", "SHARE"})
46+
void testRackIdIsEmptyIfValueIsEmptyString(GroupRebalanceConfig.ProtocolType protocolType) {
47+
GroupRebalanceConfig groupRebalanceConfig = new GroupRebalanceConfig(
48+
new ConsumerConfig(Map.of(
49+
ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, "org.apache.kafka.common.serialization.StringDeserializer",
50+
ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, "org.apache.kafka.common.serialization.StringDeserializer",
51+
ConsumerConfig.CLIENT_RACK_CONFIG, ""
52+
)),
53+
protocolType
54+
);
55+
assertTrue(groupRebalanceConfig.rackId.isEmpty());
56+
}
4357

4458
@ParameterizedTest
4559
@EnumSource(value = GroupRebalanceConfig.ProtocolType.class, names = {"CONSUMER", "SHARE"})

0 commit comments

Comments
 (0)