From 4be2fb0378fff8fc60f138195488c8d9803ead60 Mon Sep 17 00:00:00 2001 From: Cy Date: Thu, 6 Jun 2024 08:46:49 -0700 Subject: [PATCH] MINOR: Added test for ClusterConfig#displayTags (#16110) Reviewers: Chia-Ping Tsai --- .../test/java/kafka/test/ClusterConfigTest.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/core/src/test/java/kafka/test/ClusterConfigTest.java b/core/src/test/java/kafka/test/ClusterConfigTest.java index 228c01cf02566..9d5ac4957b7f1 100644 --- a/core/src/test/java/kafka/test/ClusterConfigTest.java +++ b/core/src/test/java/kafka/test/ClusterConfigTest.java @@ -29,6 +29,8 @@ import java.lang.reflect.Field; import java.util.Arrays; import java.util.Collections; +import java.util.List; +import java.util.Set; import java.util.Map; import java.util.stream.Collectors; @@ -96,4 +98,18 @@ public void testDisksPerBrokerIsZero() { .setDisksPerBroker(0) .build()); } + + @Test + public void testDisplayTags() { + List tags = Arrays.asList("tag 1", "tag 2", "tag 3"); + ClusterConfig clusterConfig = ClusterConfig.defaultBuilder().setTags(tags).build(); + + Set expectedDisplayTags = clusterConfig.displayTags(); + + Assertions.assertTrue(expectedDisplayTags.contains("tag 1")); + Assertions.assertTrue(expectedDisplayTags.contains("tag 2")); + Assertions.assertTrue(expectedDisplayTags.contains("tag 3")); + Assertions.assertTrue(expectedDisplayTags.contains("MetadataVersion=" + MetadataVersion.latestTesting())); + Assertions.assertTrue(expectedDisplayTags.contains("Security=" + SecurityProtocol.PLAINTEXT)); + } }