You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by ch...@apache.org on 2025/03/24 17:14:07 UTC
(kafka) branch trunk updated: MINOR: Cleanup Server Common Module (#19085)
This is an automated email from the ASF dual-hosted git repository.
chia7712 pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/kafka.git
The following commit(s) were added to refs/heads/trunk by this push:
new 15474e01007 MINOR: Cleanup Server Common Module (#19085)
15474e01007 is described below
commit 15474e010077212e608cb74a7b38418b4e2ae93b
Author: Sanskar Jhajharia <sj...@confluent.io>
AuthorDate: Mon Mar 24 22:44:00 2025 +0530
MINOR: Cleanup Server Common Module (#19085)
Given that now we support Java 17 on our brokers, this PR replace the
use of the following in server-common module:
- Collections.singletonList() and Collections.emptyList() with List.of()
- Collections.singletonMap() and Collections.emptyMap() with Map.of()
- Collections.singleton() and Collections.emptySet() with Set.of()
- Arrays.asList() with List.of()
Reviewers: Chia-Ping Tsai <ch...@gmail.com>
---
.../apache/kafka/server/common/CheckpointFile.java | 5 +-
.../common/EligibleLeaderReplicasVersion.java | 3 +-
.../kafka/server/common/FinalizedFeatures.java | 3 +-
.../apache/kafka/server/common/GroupVersion.java | 5 +-
.../apache/kafka/server/common/KRaftVersion.java | 5 +-
.../kafka/server/common/TestFeatureVersion.java | 7 +-
.../kafka/server/common/TransactionVersion.java | 7 +-
.../server/common/UnitTestFeatureVersion.java | 33 ++--
.../apache/kafka/server/config/QuotaConfig.java | 5 +-
.../server/config/ServerTopicConfigSynonyms.java | 22 ++-
.../kafka/server/metrics/KafkaMetricsGroup.java | 15 +-
.../kafka/server/network/EndpointReadyFutures.java | 5 +-
.../purgatory/DelayedOperationPurgatory.java | 5 +-
.../kafka/server/record/BrokerCompressionType.java | 4 +-
.../share/persister/DefaultStatePersister.java | 3 +-
.../server/share/persister/NoOpStatePersister.java | 3 +-
.../share/persister/PersisterStateManager.java | 3 +-
.../java/org/apache/kafka/server/util/Csv.java | 6 +-
.../org/apache/kafka/common/DirectoryIdTest.java | 15 +-
.../kafka/metadata/AssignmentsHelperTest.java | 19 +--
.../apache/kafka/queue/KafkaEventQueueTest.java | 3 +-
.../apache/kafka/server/common/FeatureTest.java | 7 +-
.../kafka/server/common/FinalizedFeaturesTest.java | 6 +-
.../pcollections/PCollectionsImmutableMapTest.java | 13 +-
.../PCollectionsImmutableNavigableSetTest.java | 25 ++-
.../pcollections/PCollectionsImmutableSetTest.java | 18 +-
.../server/metrics/KafkaMetricsGroupTest.java | 4 +-
.../kafka/server/mutable/BoundedListTest.java | 23 ++-
.../server/network/EndpointReadyFuturesTest.java | 16 +-
.../server/purgatory/DelayedOperationTest.java | 26 ++-
.../apache/kafka/server/quota/QuotaUtilsTest.java | 4 +-
.../share/persister/DefaultStatePersisterTest.java | 86 +++++-----
.../share/persister/PersisterStateManagerTest.java | 182 ++++++++++-----------
.../kafka/server/util/CommandLineUtilsTest.java | 13 +-
.../java/org/apache/kafka/server/util/CsvTest.java | 10 +-
.../server/util/InterBrokerSendThreadTest.java | 12 +-
.../org/apache/kafka/server/util/JsonTest.java | 5 +-
.../kafka/timeline/SnapshotRegistryTest.java | 3 +-
.../kafka/timeline/SnapshottableHashTableTest.java | 3 +-
.../apache/kafka/timeline/TimelineHashMapTest.java | 10 +-
.../apache/kafka/timeline/TimelineHashSetTest.java | 32 ++--
.../apache/kafka/timeline/TimelineIntegerTest.java | 4 +-
.../apache/kafka/timeline/TimelineLongTest.java | 4 +-
.../apache/kafka/timeline/TimelineObjectTest.java | 4 +-
44 files changed, 323 insertions(+), 363 deletions(-)
diff --git a/server-common/src/main/java/org/apache/kafka/server/common/CheckpointFile.java b/server-common/src/main/java/org/apache/kafka/server/common/CheckpointFile.java
index bd5cced567a..1047877c9de 100644
--- a/server-common/src/main/java/org/apache/kafka/server/common/CheckpointFile.java
+++ b/server-common/src/main/java/org/apache/kafka/server/common/CheckpointFile.java
@@ -31,7 +31,6 @@ import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.Collections;
import java.util.List;
import java.util.Optional;
@@ -146,7 +145,7 @@ public class CheckpointFile<T> {
public List<T> read() throws IOException {
String line = reader.readLine();
if (line == null)
- return Collections.emptyList();
+ return List.of();
int readVersion = toInt(line);
if (readVersion != version) {
@@ -156,7 +155,7 @@ public class CheckpointFile<T> {
line = reader.readLine();
if (line == null) {
- return Collections.emptyList();
+ return List.of();
}
int expectedSize = toInt(line);
List<T> entries = new ArrayList<>(expectedSize);
diff --git a/server-common/src/main/java/org/apache/kafka/server/common/EligibleLeaderReplicasVersion.java b/server-common/src/main/java/org/apache/kafka/server/common/EligibleLeaderReplicasVersion.java
index 850cb28db5b..34c823a2682 100644
--- a/server-common/src/main/java/org/apache/kafka/server/common/EligibleLeaderReplicasVersion.java
+++ b/server-common/src/main/java/org/apache/kafka/server/common/EligibleLeaderReplicasVersion.java
@@ -16,13 +16,12 @@
*/
package org.apache.kafka.server.common;
-import java.util.Collections;
import java.util.Map;
public enum EligibleLeaderReplicasVersion implements FeatureVersion {
// Version 0 is the version disable ELR.
- ELRV_0(0, MetadataVersion.MINIMUM_VERSION, Collections.emptyMap()),
+ ELRV_0(0, MetadataVersion.MINIMUM_VERSION, Map.of()),
// Version 1 enables the ELR (KIP-966).
ELRV_1(1, MetadataVersion.IBP_4_1_IV0, Map.of(MetadataVersion.FEATURE_NAME, MetadataVersion.IBP_4_0_IV1.featureLevel()));
diff --git a/server-common/src/main/java/org/apache/kafka/server/common/FinalizedFeatures.java b/server-common/src/main/java/org/apache/kafka/server/common/FinalizedFeatures.java
index 29634c7a3bd..9133f0db798 100644
--- a/server-common/src/main/java/org/apache/kafka/server/common/FinalizedFeatures.java
+++ b/server-common/src/main/java/org/apache/kafka/server/common/FinalizedFeatures.java
@@ -16,7 +16,6 @@
*/
package org.apache.kafka.server.common;
-import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
@@ -27,7 +26,7 @@ public record FinalizedFeatures(
long finalizedFeaturesEpoch
) {
public static FinalizedFeatures fromKRaftVersion(MetadataVersion version) {
- return new FinalizedFeatures(version, Collections.emptyMap(), -1);
+ return new FinalizedFeatures(version, Map.of(), -1);
}
public FinalizedFeatures(
diff --git a/server-common/src/main/java/org/apache/kafka/server/common/GroupVersion.java b/server-common/src/main/java/org/apache/kafka/server/common/GroupVersion.java
index 92976fac77d..ba5a93b9880 100644
--- a/server-common/src/main/java/org/apache/kafka/server/common/GroupVersion.java
+++ b/server-common/src/main/java/org/apache/kafka/server/common/GroupVersion.java
@@ -16,16 +16,15 @@
*/
package org.apache.kafka.server.common;
-import java.util.Collections;
import java.util.Map;
public enum GroupVersion implements FeatureVersion {
// Version 0 is the original group coordinator prior to KIP-848.
- GV_0(0, MetadataVersion.MINIMUM_VERSION, Collections.emptyMap()),
+ GV_0(0, MetadataVersion.MINIMUM_VERSION, Map.of()),
// Version 1 enables the consumer rebalance protocol (KIP-848).
- GV_1(1, MetadataVersion.IBP_4_0_IV0, Collections.emptyMap());
+ GV_1(1, MetadataVersion.IBP_4_0_IV0, Map.of());
public static final String FEATURE_NAME = "group.version";
diff --git a/server-common/src/main/java/org/apache/kafka/server/common/KRaftVersion.java b/server-common/src/main/java/org/apache/kafka/server/common/KRaftVersion.java
index 211f6dcac44..bb68bc6911a 100644
--- a/server-common/src/main/java/org/apache/kafka/server/common/KRaftVersion.java
+++ b/server-common/src/main/java/org/apache/kafka/server/common/KRaftVersion.java
@@ -16,7 +16,6 @@
*/
package org.apache.kafka.server.common;
-import java.util.Collections;
import java.util.Map;
public enum KRaftVersion implements FeatureVersion {
@@ -74,9 +73,9 @@ public enum KRaftVersion implements FeatureVersion {
@Override
public Map<String, Short> dependencies() {
if (this.featureLevel == 0) {
- return Collections.emptyMap();
+ return Map.of();
} else {
- return Collections.singletonMap(
+ return Map.of(
MetadataVersion.FEATURE_NAME, MetadataVersion.IBP_3_9_IV0.featureLevel());
}
}
diff --git a/server-common/src/main/java/org/apache/kafka/server/common/TestFeatureVersion.java b/server-common/src/main/java/org/apache/kafka/server/common/TestFeatureVersion.java
index 032f5995f5e..0b1d39dfc7b 100644
--- a/server-common/src/main/java/org/apache/kafka/server/common/TestFeatureVersion.java
+++ b/server-common/src/main/java/org/apache/kafka/server/common/TestFeatureVersion.java
@@ -16,15 +16,14 @@
*/
package org.apache.kafka.server.common;
-import java.util.Collections;
import java.util.Map;
public enum TestFeatureVersion implements FeatureVersion {
- TEST_0(0, MetadataVersion.MINIMUM_VERSION, Collections.emptyMap()),
+ TEST_0(0, MetadataVersion.MINIMUM_VERSION, Map.of()),
// TEST_1 released right before MV 3.7-IVO was released, and it has no dependencies
- TEST_1(1, MetadataVersion.IBP_3_7_IV0, Collections.emptyMap()),
+ TEST_1(1, MetadataVersion.IBP_3_7_IV0, Map.of()),
// TEST_2 is not yet set to be the default version and maps to the latest testing version, and it depends on this metadata version
- TEST_2(2, MetadataVersion.latestTesting(), Collections.singletonMap(MetadataVersion.FEATURE_NAME, MetadataVersion.latestTesting().featureLevel()));
+ TEST_2(2, MetadataVersion.latestTesting(), Map.of(MetadataVersion.FEATURE_NAME, MetadataVersion.latestTesting().featureLevel()));
private final short featureLevel;
private final MetadataVersion metadataVersionMapping;
diff --git a/server-common/src/main/java/org/apache/kafka/server/common/TransactionVersion.java b/server-common/src/main/java/org/apache/kafka/server/common/TransactionVersion.java
index 05bbd821801..b64cbeac601 100644
--- a/server-common/src/main/java/org/apache/kafka/server/common/TransactionVersion.java
+++ b/server-common/src/main/java/org/apache/kafka/server/common/TransactionVersion.java
@@ -19,17 +19,16 @@ package org.apache.kafka.server.common;
import org.apache.kafka.common.requests.AddPartitionsToTxnRequest;
import org.apache.kafka.common.requests.EndTxnRequest;
-import java.util.Collections;
import java.util.Map;
public enum TransactionVersion implements FeatureVersion {
// Version 0 is the original transaction coordinator with no extra features enabled.
- TV_0(0, MetadataVersion.MINIMUM_VERSION, Collections.emptyMap()),
+ TV_0(0, MetadataVersion.MINIMUM_VERSION, Map.of()),
// Version 1 enables flexible transactional state records. (KIP-890)
- TV_1(1, MetadataVersion.IBP_4_0_IV2, Collections.emptyMap()),
+ TV_1(1, MetadataVersion.IBP_4_0_IV2, Map.of()),
// Version 2 enables epoch bump per transaction and optimizations. (KIP-890)
- TV_2(2, MetadataVersion.IBP_4_0_IV2, Collections.emptyMap());
+ TV_2(2, MetadataVersion.IBP_4_0_IV2, Map.of());
public static final String FEATURE_NAME = "transaction.version";
diff --git a/server-common/src/main/java/org/apache/kafka/server/common/UnitTestFeatureVersion.java b/server-common/src/main/java/org/apache/kafka/server/common/UnitTestFeatureVersion.java
index 6aaa8ae7456..ec605eeb1db 100644
--- a/server-common/src/main/java/org/apache/kafka/server/common/UnitTestFeatureVersion.java
+++ b/server-common/src/main/java/org/apache/kafka/server/common/UnitTestFeatureVersion.java
@@ -16,7 +16,6 @@
*/
package org.apache.kafka.server.common;
-import java.util.Collections;
import java.util.Map;
/**
@@ -27,8 +26,8 @@ public class UnitTestFeatureVersion {
* The feature is used for testing latest production is not one of the feature versions.
*/
public enum FV0 implements FeatureVersion {
- UT_FV0_0(0, MetadataVersion.MINIMUM_VERSION, Collections.emptyMap()),
- UT_FV0_1(1, MetadataVersion.IBP_3_7_IV0, Collections.emptyMap());
+ UT_FV0_0(0, MetadataVersion.MINIMUM_VERSION, Map.of()),
+ UT_FV0_1(1, MetadataVersion.IBP_3_7_IV0, Map.of());
private final short featureLevel;
private final MetadataVersion bootstrapMetadataVersion;
@@ -69,8 +68,8 @@ public class UnitTestFeatureVersion {
* The feature is used to test latest production lags behind the default value.
*/
public enum FV1 implements FeatureVersion {
- UT_FV1_0(0, MetadataVersion.MINIMUM_VERSION, Collections.emptyMap()),
- UT_FV1_1(1, MetadataVersion.IBP_3_7_IV0, Collections.emptyMap());
+ UT_FV1_0(0, MetadataVersion.MINIMUM_VERSION, Map.of()),
+ UT_FV1_1(1, MetadataVersion.IBP_3_7_IV0, Map.of());
private final short featureLevel;
private final MetadataVersion bootstrapMetadataVersion;
@@ -111,8 +110,8 @@ public class UnitTestFeatureVersion {
* The feature is used to test the dependency of the latest production that is not yet production ready.
*/
public enum FV2 implements FeatureVersion {
- UT_FV2_0(0, MetadataVersion.MINIMUM_VERSION, Collections.emptyMap()),
- UT_FV2_1(1, MetadataVersion.IBP_3_7_IV0, Collections.emptyMap());
+ UT_FV2_0(0, MetadataVersion.MINIMUM_VERSION, Map.of()),
+ UT_FV2_1(1, MetadataVersion.IBP_3_7_IV0, Map.of());
private final short featureLevel;
private final MetadataVersion bootstrapMetadataVersion;
@@ -153,8 +152,8 @@ public class UnitTestFeatureVersion {
* The feature is used to test the dependency of the latest production that is not yet production ready.
*/
public enum FV3 implements FeatureVersion {
- UT_FV3_0(0, MetadataVersion.MINIMUM_VERSION, Collections.emptyMap()),
- UT_FV3_1(1, MetadataVersion.IBP_3_7_IV0, Collections.singletonMap(FV2.FEATURE_NAME, (short) 1));
+ UT_FV3_0(0, MetadataVersion.MINIMUM_VERSION, Map.of()),
+ UT_FV3_1(1, MetadataVersion.IBP_3_7_IV0, Map.of(FV2.FEATURE_NAME, (short) 1));
private final short featureLevel;
private final MetadataVersion bootstrapMetadataVersion;
@@ -195,8 +194,8 @@ public class UnitTestFeatureVersion {
* The feature is used to test the dependency of the default value that is not yet default ready.
*/
public enum FV4 implements FeatureVersion {
- UT_FV4_0(0, MetadataVersion.MINIMUM_VERSION, Collections.emptyMap()),
- UT_FV4_1(1, MetadataVersion.latestTesting(), Collections.emptyMap());
+ UT_FV4_0(0, MetadataVersion.MINIMUM_VERSION, Map.of()),
+ UT_FV4_1(1, MetadataVersion.latestTesting(), Map.of());
private final short featureLevel;
private final MetadataVersion bootstrapMetadataVersion;
@@ -237,8 +236,8 @@ public class UnitTestFeatureVersion {
* The feature is used to test the dependency of the default value that is not yet default ready.
*/
public enum FV5 implements FeatureVersion {
- UT_FV5_0(0, MetadataVersion.MINIMUM_VERSION, Collections.emptyMap()),
- UT_FV5_1(1, MetadataVersion.IBP_3_7_IV0, Collections.singletonMap(FV4.FEATURE_NAME, (short) 1));
+ UT_FV5_0(0, MetadataVersion.MINIMUM_VERSION, Map.of()),
+ UT_FV5_1(1, MetadataVersion.IBP_3_7_IV0, Map.of(FV4.FEATURE_NAME, (short) 1));
private final short featureLevel;
private final MetadataVersion bootstrapMetadataVersion;
@@ -279,8 +278,8 @@ public class UnitTestFeatureVersion {
* The feature is used to test the latest production has MV dependency that is not yet production ready.
*/
public enum FV6 implements FeatureVersion {
- UT_FV6_0(0, MetadataVersion.MINIMUM_VERSION, Collections.emptyMap()),
- UT_FV6_1(1, MetadataVersion.latestTesting(), Collections.singletonMap(MetadataVersion.FEATURE_NAME, MetadataVersion.latestTesting().featureLevel()));
+ UT_FV6_0(0, MetadataVersion.MINIMUM_VERSION, Map.of()),
+ UT_FV6_1(1, MetadataVersion.latestTesting(), Map.of(MetadataVersion.FEATURE_NAME, MetadataVersion.latestTesting().featureLevel()));
private final short featureLevel;
private final MetadataVersion bootstrapMetadataVersion;
@@ -321,8 +320,8 @@ public class UnitTestFeatureVersion {
* The feature is used to test the default value has MV dependency that is behind the bootstrap MV.
*/
public enum FV7 implements FeatureVersion {
- UT_FV7_0(0, MetadataVersion.MINIMUM_VERSION, Collections.singletonMap(MetadataVersion.FEATURE_NAME, MetadataVersion.IBP_3_7_IV0.featureLevel())),
- UT_FV7_1(1, MetadataVersion.IBP_3_8_IV0, Collections.singletonMap(MetadataVersion.FEATURE_NAME, MetadataVersion.IBP_3_8_IV0.featureLevel()));
+ UT_FV7_0(0, MetadataVersion.MINIMUM_VERSION, Map.of(MetadataVersion.FEATURE_NAME, MetadataVersion.IBP_3_7_IV0.featureLevel())),
+ UT_FV7_1(1, MetadataVersion.IBP_3_8_IV0, Map.of(MetadataVersion.FEATURE_NAME, MetadataVersion.IBP_3_8_IV0.featureLevel()));
private final short featureLevel;
private final MetadataVersion bootstrapMetadataVersion;
diff --git a/server-common/src/main/java/org/apache/kafka/server/config/QuotaConfig.java b/server-common/src/main/java/org/apache/kafka/server/config/QuotaConfig.java
index cc2c3730813..317501aa239 100644
--- a/server-common/src/main/java/org/apache/kafka/server/config/QuotaConfig.java
+++ b/server-common/src/main/java/org/apache/kafka/server/config/QuotaConfig.java
@@ -20,7 +20,6 @@ import org.apache.kafka.common.config.AbstractConfig;
import org.apache.kafka.common.config.ConfigDef;
import org.apache.kafka.common.security.scram.internals.ScramMechanism;
-import java.util.Collections;
import java.util.List;
import java.util.Set;
@@ -62,14 +61,14 @@ public class QuotaConfig {
"the leader side. The list should describe a set of replicas in the form " +
"[PartitionId]:[BrokerId],[PartitionId]:[BrokerId]:... or alternatively the wildcard '*' can be used to throttle " +
"all replicas for this topic.";
- public static final List<String> LEADER_REPLICATION_THROTTLED_REPLICAS_DEFAULT = Collections.emptyList();
+ public static final List<String> LEADER_REPLICATION_THROTTLED_REPLICAS_DEFAULT = List.of();
public static final String FOLLOWER_REPLICATION_THROTTLED_REPLICAS_CONFIG = "follower.replication.throttled.replicas";
public static final String FOLLOWER_REPLICATION_THROTTLED_REPLICAS_DOC = "A list of replicas for which log replication should be throttled on " +
"the follower side. The list should describe a set of " + "replicas in the form " +
"[PartitionId]:[BrokerId],[PartitionId]:[BrokerId]:... or alternatively the wildcard '*' can be used to throttle " +
"all replicas for this topic.";
- public static final List<String> FOLLOWER_REPLICATION_THROTTLED_REPLICAS_DEFAULT = Collections.emptyList();
+ public static final List<String> FOLLOWER_REPLICATION_THROTTLED_REPLICAS_DEFAULT = List.of();
public static final String LEADER_REPLICATION_THROTTLED_RATE_CONFIG = "leader.replication.throttled.rate";
diff --git a/server-common/src/main/java/org/apache/kafka/server/config/ServerTopicConfigSynonyms.java b/server-common/src/main/java/org/apache/kafka/server/config/ServerTopicConfigSynonyms.java
index 3fc8c4435b9..5394d2d2c3a 100644
--- a/server-common/src/main/java/org/apache/kafka/server/config/ServerTopicConfigSynonyms.java
+++ b/server-common/src/main/java/org/apache/kafka/server/config/ServerTopicConfigSynonyms.java
@@ -20,14 +20,12 @@ import org.apache.kafka.common.config.TopicConfig;
import org.apache.kafka.common.utils.Utils;
import java.util.Arrays;
-import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.NoSuchElementException;
import java.util.stream.Collectors;
-import static java.util.Arrays.asList;
public final class ServerTopicConfigSynonyms {
public static final String LOG_PREFIX = "log.";
@@ -50,7 +48,7 @@ public final class ServerTopicConfigSynonyms {
* the first synonym and ignore the second.
*/
// Topic configs with no mapping to a server config can be found in `LogConfig.CONFIGS_WITH_NO_SERVER_DEFAULTS`
- public static final Map<String, List<ConfigSynonym>> ALL_TOPIC_CONFIG_SYNONYMS = Collections.unmodifiableMap(Utils.mkMap(
+ public static final Map<String, List<ConfigSynonym>> ALL_TOPIC_CONFIG_SYNONYMS = Utils.mkMap(
sameNameWithLogPrefix(TopicConfig.SEGMENT_BYTES_CONFIG),
listWithLogPrefix(TopicConfig.SEGMENT_MS_CONFIG,
new ConfigSynonym("roll.ms"),
@@ -88,17 +86,17 @@ public final class ServerTopicConfigSynonyms {
sameNameWithLogPrefix(TopicConfig.MESSAGE_TIMESTAMP_AFTER_MAX_MS_CONFIG),
sameNameWithLogPrefix(TopicConfig.LOCAL_LOG_RETENTION_MS_CONFIG),
sameNameWithLogPrefix(TopicConfig.LOCAL_LOG_RETENTION_BYTES_CONFIG)
- ));
+ );
/**
* Map topic config to the server config with the highest priority. Some of these have additional
* synonyms that can be obtained using [[kafka.server.DynamicBrokerConfig#brokerConfigSynonyms]]
* or using [[AllTopicConfigSynonyms]]
*/
- public static final Map<String, String> TOPIC_CONFIG_SYNONYMS = Collections.unmodifiableMap(
+ public static final Map<String, String> TOPIC_CONFIG_SYNONYMS =
ALL_TOPIC_CONFIG_SYNONYMS.entrySet()
.stream()
- .collect(Collectors.toMap(Entry::getKey, e -> e.getValue().get(0).name())));
+ .collect(Collectors.toMap(Entry::getKey, e -> e.getValue().get(0).name()));
/**
* Return the server config with the highest priority for `topicConfigName` if it exists. Otherwise,
@@ -112,23 +110,23 @@ public final class ServerTopicConfigSynonyms {
}
private static Entry<String, List<ConfigSynonym>> sameName(String configName) {
- return Utils.mkEntry(configName, asList(new ConfigSynonym(configName)));
+ return Utils.mkEntry(configName, List.of(new ConfigSynonym(configName)));
}
private static Entry<String, List<ConfigSynonym>> sameNameWithLogPrefix(String configName) {
- return Utils.mkEntry(configName, asList(new ConfigSynonym(LOG_PREFIX + configName)));
+ return Utils.mkEntry(configName, List.of(new ConfigSynonym(LOG_PREFIX + configName)));
}
private static Entry<String, List<ConfigSynonym>> sameNameWithLogCleanerPrefix(String configName) {
- return Utils.mkEntry(configName, asList(new ConfigSynonym(LOG_CLEANER_PREFIX + configName)));
+ return Utils.mkEntry(configName, List.of(new ConfigSynonym(LOG_CLEANER_PREFIX + configName)));
}
private static Entry<String, List<ConfigSynonym>> singleWithLogPrefix(String topicConfigName, String brokerConfigName) {
- return Utils.mkEntry(topicConfigName, asList(new ConfigSynonym(LOG_PREFIX + brokerConfigName)));
+ return Utils.mkEntry(topicConfigName, List.of(new ConfigSynonym(LOG_PREFIX + brokerConfigName)));
}
private static Entry<String, List<ConfigSynonym>> singleWithLogCleanerPrefix(String topicConfigName, String brokerConfigName) {
- return Utils.mkEntry(topicConfigName, asList(new ConfigSynonym(LOG_CLEANER_PREFIX + brokerConfigName)));
+ return Utils.mkEntry(topicConfigName, List.of(new ConfigSynonym(LOG_CLEANER_PREFIX + brokerConfigName)));
}
private static Entry<String, List<ConfigSynonym>> listWithLogPrefix(String topicConfigName, ConfigSynonym... synonyms) {
@@ -139,6 +137,6 @@ public final class ServerTopicConfigSynonyms {
}
private static Entry<String, List<ConfigSynonym>> single(String topicConfigName, String brokerConfigName) {
- return Utils.mkEntry(topicConfigName, asList(new ConfigSynonym(brokerConfigName)));
+ return Utils.mkEntry(topicConfigName, List.of(new ConfigSynonym(brokerConfigName)));
}
}
diff --git a/server-common/src/main/java/org/apache/kafka/server/metrics/KafkaMetricsGroup.java b/server-common/src/main/java/org/apache/kafka/server/metrics/KafkaMetricsGroup.java
index 9a01b2ac247..5a83c0d94ad 100644
--- a/server-common/src/main/java/org/apache/kafka/server/metrics/KafkaMetricsGroup.java
+++ b/server-common/src/main/java/org/apache/kafka/server/metrics/KafkaMetricsGroup.java
@@ -24,7 +24,6 @@ import com.yammer.metrics.core.Meter;
import com.yammer.metrics.core.MetricName;
import com.yammer.metrics.core.Timer;
-import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Optional;
@@ -85,7 +84,7 @@ public class KafkaMetricsGroup {
}
public <T> Gauge<T> newGauge(String name, Supplier<T> metric) {
- return newGauge(name, metric, Collections.emptyMap());
+ return newGauge(name, metric, Map.of());
}
public <T> Gauge<T> newGauge(MetricName name, Supplier<T> metric) {
@@ -104,7 +103,7 @@ public class KafkaMetricsGroup {
public final Meter newMeter(String name, String eventType,
TimeUnit timeUnit) {
- return newMeter(name, eventType, timeUnit, Collections.emptyMap());
+ return newMeter(name, eventType, timeUnit, Map.of());
}
public final Meter newMeter(MetricName metricName, String eventType, TimeUnit timeUnit) {
@@ -116,7 +115,7 @@ public class KafkaMetricsGroup {
}
public final Histogram newHistogram(String name) {
- return newHistogram(name, true, Collections.emptyMap());
+ return newHistogram(name, true, Map.of());
}
public final Timer newTimer(String name, TimeUnit durationUnit, TimeUnit rateUnit, Map<String, String> tags) {
@@ -124,7 +123,7 @@ public class KafkaMetricsGroup {
}
public final Timer newTimer(String name, TimeUnit durationUnit, TimeUnit rateUnit) {
- return newTimer(name, durationUnit, rateUnit, Collections.emptyMap());
+ return newTimer(name, durationUnit, rateUnit, Map.of());
}
public final Timer newTimer(MetricName metricName, TimeUnit durationUnit, TimeUnit rateUnit) {
@@ -136,7 +135,7 @@ public class KafkaMetricsGroup {
}
public final void removeMetric(String name) {
- removeMetric(name, Collections.emptyMap());
+ removeMetric(name, Map.of());
}
public final void removeMetric(MetricName metricName) {
@@ -146,7 +145,7 @@ public class KafkaMetricsGroup {
private static Optional<String> toMBeanName(Map<String, String> tags) {
List<Map.Entry<String, String>> filteredTags = tags.entrySet().stream()
.filter(entry -> !entry.getValue().isEmpty())
- .collect(Collectors.toList());
+ .toList();
if (!filteredTags.isEmpty()) {
String tagsString = filteredTags.stream()
.map(entry -> entry.getKey() + "=" + Sanitizer.jmxSanitize(entry.getValue()))
@@ -160,7 +159,7 @@ public class KafkaMetricsGroup {
private static Optional<String> toScope(Map<String, String> tags) {
List<Map.Entry<String, String>> filteredTags = tags.entrySet().stream()
.filter(entry -> !entry.getValue().isEmpty())
- .collect(Collectors.toList());
+ .toList();
if (!filteredTags.isEmpty()) {
// convert dot to _ since reporters like Graphite typically use dot to represent hierarchy
String tagsString = filteredTags.stream()
diff --git a/server-common/src/main/java/org/apache/kafka/server/network/EndpointReadyFutures.java b/server-common/src/main/java/org/apache/kafka/server/network/EndpointReadyFutures.java
index 212f2b9fbd7..0e00ccc86d5 100644
--- a/server-common/src/main/java/org/apache/kafka/server/network/EndpointReadyFutures.java
+++ b/server-common/src/main/java/org/apache/kafka/server/network/EndpointReadyFutures.java
@@ -26,7 +26,6 @@ import org.slf4j.Logger;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -92,7 +91,7 @@ public class EndpointReadyFutures {
if (authorizer.isPresent()) {
return build(authorizer.get().start(info), info);
} else {
- return build(Collections.emptyMap(), info);
+ return build(Map.of(), info);
}
}
@@ -205,7 +204,7 @@ public class EndpointReadyFutures {
}
}));
});
- this.futures = Collections.unmodifiableMap(newFutures);
+ this.futures = newFutures;
}
public Map<Endpoint, CompletableFuture<Void>> futures() {
diff --git a/server-common/src/main/java/org/apache/kafka/server/purgatory/DelayedOperationPurgatory.java b/server-common/src/main/java/org/apache/kafka/server/purgatory/DelayedOperationPurgatory.java
index 380f22c9c8e..8d97ea59911 100644
--- a/server-common/src/main/java/org/apache/kafka/server/purgatory/DelayedOperationPurgatory.java
+++ b/server-common/src/main/java/org/apache/kafka/server/purgatory/DelayedOperationPurgatory.java
@@ -27,7 +27,6 @@ import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -88,7 +87,7 @@ public class DelayedOperationPurgatory<T extends DelayedOperation> {
for (int i = 0; i < SHARDS; i++) {
watcherLists.add(new WatcherList());
}
- metricsTags = Collections.singletonMap("delayedOperation", purgatoryName);
+ metricsTags = Map.of("delayedOperation", purgatoryName);
metricsGroup.newGauge("PurgatorySize", this::watched, metricsTags);
metricsGroup.newGauge("NumDelayedOperations", this::numDelayed, metricsTags);
if (reaperEnabled) {
@@ -223,7 +222,7 @@ public class DelayedOperationPurgatory<T extends DelayedOperation> {
if (watchers != null)
return watchers.cancel();
else
- return Collections.emptyList();
+ return List.of();
} finally {
wl.watchersLock.unlock();
}
diff --git a/server-common/src/main/java/org/apache/kafka/server/record/BrokerCompressionType.java b/server-common/src/main/java/org/apache/kafka/server/record/BrokerCompressionType.java
index b351a47b3d7..1343d9fdd04 100644
--- a/server-common/src/main/java/org/apache/kafka/server/record/BrokerCompressionType.java
+++ b/server-common/src/main/java/org/apache/kafka/server/record/BrokerCompressionType.java
@@ -24,8 +24,6 @@ import java.util.Locale;
import java.util.Optional;
import java.util.stream.Collectors;
-import static java.util.Arrays.asList;
-
public enum BrokerCompressionType {
UNCOMPRESSED("uncompressed"),
ZSTD("zstd"),
@@ -34,7 +32,7 @@ public enum BrokerCompressionType {
GZIP("gzip"),
PRODUCER("producer");
- private static final List<BrokerCompressionType> VALUES = asList(values());
+ private static final List<BrokerCompressionType> VALUES = List.of(values());
public final String name;
diff --git a/server-common/src/main/java/org/apache/kafka/server/share/persister/DefaultStatePersister.java b/server-common/src/main/java/org/apache/kafka/server/share/persister/DefaultStatePersister.java
index 183521eb5f4..1b4a0756515 100644
--- a/server-common/src/main/java/org/apache/kafka/server/share/persister/DefaultStatePersister.java
+++ b/server-common/src/main/java/org/apache/kafka/server/share/persister/DefaultStatePersister.java
@@ -29,7 +29,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -345,7 +344,7 @@ public class DefaultStatePersister implements Persister {
-1,
Errors.UNKNOWN_SERVER_ERROR.code(), // No specific public error code exists for InterruptedException / ExecutionException
"Error reading state from share coordinator: " + e.getMessage(),
- Collections.emptyList())
+ List.of())
);
}
})
diff --git a/server-common/src/main/java/org/apache/kafka/server/share/persister/NoOpStatePersister.java b/server-common/src/main/java/org/apache/kafka/server/share/persister/NoOpStatePersister.java
index 30d77d3dafa..2814fc3aa82 100644
--- a/server-common/src/main/java/org/apache/kafka/server/share/persister/NoOpStatePersister.java
+++ b/server-common/src/main/java/org/apache/kafka/server/share/persister/NoOpStatePersister.java
@@ -18,7 +18,6 @@
package org.apache.kafka.server.share.persister;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.stream.Collectors;
@@ -53,7 +52,7 @@ public class NoOpStatePersister implements Persister {
for (TopicData<PartitionIdLeaderEpochData> topicData : reqData.topicsData()) {
resultArgs.add(new TopicData<>(topicData.topicId(), topicData.partitions().stream().
map(partitionIdData -> PartitionFactory.newPartitionAllData(
- partitionIdData.partition(), PartitionFactory.DEFAULT_STATE_EPOCH, PartitionFactory.UNINITIALIZED_START_OFFSET, PartitionFactory.DEFAULT_ERROR_CODE, PartitionFactory.DEFAULT_ERR_MESSAGE, Collections.emptyList()))
+ partitionIdData.partition(), PartitionFactory.DEFAULT_STATE_EPOCH, PartitionFactory.UNINITIALIZED_START_OFFSET, PartitionFactory.DEFAULT_ERROR_CODE, PartitionFactory.DEFAULT_ERR_MESSAGE, List.of()))
.collect(Collectors.toList())));
}
return CompletableFuture.completedFuture(new ReadShareGroupStateResult.Builder().setTopicsData(resultArgs).build());
diff --git a/server-common/src/main/java/org/apache/kafka/server/share/persister/PersisterStateManager.java b/server-common/src/main/java/org/apache/kafka/server/share/persister/PersisterStateManager.java
index 4e38a795242..1b2a03b0b8b 100644
--- a/server-common/src/main/java/org/apache/kafka/server/share/persister/PersisterStateManager.java
+++ b/server-common/src/main/java/org/apache/kafka/server/share/persister/PersisterStateManager.java
@@ -67,7 +67,6 @@ import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
@@ -1276,7 +1275,7 @@ public class PersisterStateManager {
// fatal failure, cannot retry or progress
// fail the RPC
handler.findCoordinatorErrorResponse(Errors.COORDINATOR_NOT_AVAILABLE, Errors.COORDINATOR_NOT_AVAILABLE.exception());
- return Collections.emptyList();
+ return List.of();
}
log.debug("Sending find coordinator RPC");
return List.of(new RequestAndCompletionHandler(
diff --git a/server-common/src/main/java/org/apache/kafka/server/util/Csv.java b/server-common/src/main/java/org/apache/kafka/server/util/Csv.java
index 61f143bdc3f..1d697e8f56f 100644
--- a/server-common/src/main/java/org/apache/kafka/server/util/Csv.java
+++ b/server-common/src/main/java/org/apache/kafka/server/util/Csv.java
@@ -16,11 +16,9 @@
*/
package org.apache.kafka.server.util;
-import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.stream.Collectors;
import java.util.stream.Stream;
public class Csv {
@@ -49,9 +47,9 @@ public class Csv {
*/
public static List<String> parseCsvList(String csvList) {
if (csvList == null || csvList.isEmpty()) {
- return Collections.emptyList();
+ return List.of();
} else {
- return Stream.of(csvList.split("\\s*,\\s*")).filter(v -> !v.isEmpty()).collect(Collectors.toList());
+ return Stream.of(csvList.split("\\s*,\\s*")).filter(v -> !v.isEmpty()).toList();
}
}
}
diff --git a/server-common/src/test/java/org/apache/kafka/common/DirectoryIdTest.java b/server-common/src/test/java/org/apache/kafka/common/DirectoryIdTest.java
index 7c909fc283a..166fd424f3a 100644
--- a/server-common/src/test/java/org/apache/kafka/common/DirectoryIdTest.java
+++ b/server-common/src/test/java/org/apache/kafka/common/DirectoryIdTest.java
@@ -18,8 +18,7 @@ package org.apache.kafka.common;
import org.junit.jupiter.api.Test;
-import java.util.Arrays;
-import java.util.Collections;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -69,13 +68,13 @@ public class DirectoryIdTest {
@Test
void testIsOnline() {
// Given
- List<Uuid> sortedDirs = Arrays.asList(
- Uuid.fromString("imQKg2cXTVe8OUFNa3R9bg"),
- Uuid.fromString("Mwy5wxTDQxmsZwGzjsaX7w"),
- Uuid.fromString("s8rHMluuSDCnxt3FmKwiyw")
- );
+ List<Uuid> sortedDirs = new ArrayList<>(List.of(
+ Uuid.fromString("imQKg2cXTVe8OUFNa3R9bg"),
+ Uuid.fromString("Mwy5wxTDQxmsZwGzjsaX7w"),
+ Uuid.fromString("s8rHMluuSDCnxt3FmKwiyw")
+ ));
sortedDirs.sort(Uuid::compareTo);
- List<Uuid> emptySortedDirs = Collections.emptyList();
+ List<Uuid> emptySortedDirs = List.of();
// When/Then
assertTrue(DirectoryId.isOnline(Uuid.fromString("imQKg2cXTVe8OUFNa3R9bg"), sortedDirs));
diff --git a/server-common/src/test/java/org/apache/kafka/metadata/AssignmentsHelperTest.java b/server-common/src/test/java/org/apache/kafka/metadata/AssignmentsHelperTest.java
index df1ea9821c4..cfc4e5dfe93 100644
--- a/server-common/src/test/java/org/apache/kafka/metadata/AssignmentsHelperTest.java
+++ b/server-common/src/test/java/org/apache/kafka/metadata/AssignmentsHelperTest.java
@@ -23,9 +23,8 @@ import org.apache.kafka.server.common.TopicIdPartition;
import org.junit.jupiter.api.Test;
-import java.util.Arrays;
-import java.util.Collections;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -51,39 +50,39 @@ public class AssignmentsHelperTest {
AssignReplicasToDirsRequestData expected = new AssignReplicasToDirsRequestData()
.setBrokerId(8)
.setBrokerEpoch(100L)
- .setDirectories(Arrays.asList(
+ .setDirectories(List.of(
new AssignReplicasToDirsRequestData.DirectoryData()
.setId(DIR_2)
- .setTopics(Arrays.asList(
+ .setTopics(List.of(
new AssignReplicasToDirsRequestData.TopicData()
.setTopicId(TOPIC_1)
- .setPartitions(Collections.singletonList(
+ .setPartitions(List.of(
new AssignReplicasToDirsRequestData.PartitionData()
.setPartitionIndex(2)
)),
new AssignReplicasToDirsRequestData.TopicData()
.setTopicId(TOPIC_2)
- .setPartitions(Collections.singletonList(
+ .setPartitions(List.of(
new AssignReplicasToDirsRequestData.PartitionData()
.setPartitionIndex(5)
))
)),
new AssignReplicasToDirsRequestData.DirectoryData()
.setId(DIR_3)
- .setTopics(Collections.singletonList(
+ .setTopics(List.of(
new AssignReplicasToDirsRequestData.TopicData()
.setTopicId(TOPIC_1)
- .setPartitions(Collections.singletonList(
+ .setPartitions(List.of(
new AssignReplicasToDirsRequestData.PartitionData()
.setPartitionIndex(3)
))
)),
new AssignReplicasToDirsRequestData.DirectoryData()
.setId(DIR_1)
- .setTopics(Collections.singletonList(
+ .setTopics(List.of(
new AssignReplicasToDirsRequestData.TopicData()
.setTopicId(TOPIC_1)
- .setPartitions(Arrays.asList(
+ .setPartitions(List.of(
new AssignReplicasToDirsRequestData.PartitionData()
.setPartitionIndex(4),
new AssignReplicasToDirsRequestData.PartitionData()
diff --git a/server-common/src/test/java/org/apache/kafka/queue/KafkaEventQueueTest.java b/server-common/src/test/java/org/apache/kafka/queue/KafkaEventQueueTest.java
index 550de557bef..54fc65a604a 100644
--- a/server-common/src/test/java/org/apache/kafka/queue/KafkaEventQueueTest.java
+++ b/server-common/src/test/java/org/apache/kafka/queue/KafkaEventQueueTest.java
@@ -29,7 +29,6 @@ import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInfo;
import org.junit.jupiter.api.Timeout;
-import java.util.Arrays;
import java.util.List;
import java.util.OptionalLong;
import java.util.concurrent.CompletableFuture;
@@ -209,7 +208,7 @@ public class KafkaEventQueueTest {
MockTime time = new MockTime(0, 100000, 1);
try (KafkaEventQueue queue = new KafkaEventQueue(time, logContext, "testDeferredIsQueuedAfterTriggering")) {
AtomicInteger count = new AtomicInteger(0);
- List<CompletableFuture<Integer>> futures = Arrays.asList(
+ List<CompletableFuture<Integer>> futures = List.of(
new CompletableFuture<>(),
new CompletableFuture<>(),
new CompletableFuture<>());
diff --git a/server-common/src/test/java/org/apache/kafka/server/common/FeatureTest.java b/server-common/src/test/java/org/apache/kafka/server/common/FeatureTest.java
index a7a9ee3d311..98f00a78887 100644
--- a/server-common/src/test/java/org/apache/kafka/server/common/FeatureTest.java
+++ b/server-common/src/test/java/org/apache/kafka/server/common/FeatureTest.java
@@ -20,7 +20,6 @@ import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.EnumSource;
-import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
@@ -105,7 +104,7 @@ public class FeatureTest {
assertThrows(IllegalArgumentException.class,
() -> Feature.validateVersion(
TestFeatureVersion.TEST_1,
- Collections.emptyMap()
+ Map.of()
)
);
@@ -113,7 +112,7 @@ public class FeatureTest {
assertThrows(IllegalArgumentException.class,
() -> Feature.validateVersion(
TestFeatureVersion.TEST_1,
- Collections.singletonMap(MetadataVersion.FEATURE_NAME, MetadataVersionTestUtils.IBP_3_0_IV1_FEATURE_LEVEL)
+ Map.of(MetadataVersion.FEATURE_NAME, MetadataVersionTestUtils.IBP_3_0_IV1_FEATURE_LEVEL)
)
);
@@ -121,7 +120,7 @@ public class FeatureTest {
assertThrows(IllegalArgumentException.class,
() -> Feature.validateVersion(
TestFeatureVersion.TEST_2,
- Collections.singletonMap(MetadataVersion.FEATURE_NAME, MetadataVersion.IBP_3_7_IV0.featureLevel())
+ Map.of(MetadataVersion.FEATURE_NAME, MetadataVersion.IBP_3_7_IV0.featureLevel())
)
);
}
diff --git a/server-common/src/test/java/org/apache/kafka/server/common/FinalizedFeaturesTest.java b/server-common/src/test/java/org/apache/kafka/server/common/FinalizedFeaturesTest.java
index 9a82cc33d03..1c4c9547cf0 100644
--- a/server-common/src/test/java/org/apache/kafka/server/common/FinalizedFeaturesTest.java
+++ b/server-common/src/test/java/org/apache/kafka/server/common/FinalizedFeaturesTest.java
@@ -19,7 +19,7 @@ package org.apache.kafka.server.common;
import org.junit.jupiter.api.Test;
-import java.util.Collections;
+import java.util.Map;
import static org.apache.kafka.server.common.MetadataVersion.FEATURE_NAME;
import static org.apache.kafka.server.common.MetadataVersion.MINIMUM_VERSION;
@@ -30,7 +30,7 @@ class FinalizedFeaturesTest {
@Test
public void testKRaftModeFeatures() {
FinalizedFeatures finalizedFeatures = new FinalizedFeatures(MINIMUM_VERSION,
- Collections.singletonMap("foo", (short) 2), 123);
+ Map.of("foo", (short) 2), 123);
assertEquals(MINIMUM_VERSION.featureLevel(),
finalizedFeatures.finalizedFeatures().get(FEATURE_NAME));
assertEquals((short) 2,
@@ -42,7 +42,7 @@ class FinalizedFeaturesTest {
public void testSetFinalizedLevel() {
FinalizedFeatures finalizedFeatures = new FinalizedFeatures(
MINIMUM_VERSION,
- Collections.singletonMap("foo", (short) 2),
+ Map.of("foo", (short) 2),
123
);
diff --git a/server-common/src/test/java/org/apache/kafka/server/immutable/pcollections/PCollectionsImmutableMapTest.java b/server-common/src/test/java/org/apache/kafka/server/immutable/pcollections/PCollectionsImmutableMapTest.java
index 58d305d5421..5932026aed7 100644
--- a/server-common/src/test/java/org/apache/kafka/server/immutable/pcollections/PCollectionsImmutableMapTest.java
+++ b/server-common/src/test/java/org/apache/kafka/server/immutable/pcollections/PCollectionsImmutableMapTest.java
@@ -27,7 +27,8 @@ import org.junit.jupiter.params.provider.ValueSource;
import org.pcollections.HashPMap;
import org.pcollections.HashTreePMap;
-import java.util.Collections;
+import java.util.Map;
+import java.util.Set;
import java.util.function.BiConsumer;
import java.util.function.BiFunction;
import java.util.function.Function;
@@ -149,8 +150,8 @@ public class PCollectionsImmutableMapTest {
@Test
public void testDelegationOfUnsupportedFunctionPutAll() {
new PCollectionsHashMapWrapperDelegationChecker<>()
- .defineMockConfigurationForVoidMethodInvocation(mock -> mock.putAll(eq(Collections.emptyMap())))
- .defineWrapperVoidMethodInvocation(wrapper -> wrapper.putAll(Collections.emptyMap()))
+ .defineMockConfigurationForVoidMethodInvocation(mock -> mock.putAll(eq(Map.of())))
+ .defineWrapperVoidMethodInvocation(wrapper -> wrapper.putAll(Map.of()))
.doUnsupportedVoidFunctionDelegationCheck();
}
@@ -166,7 +167,7 @@ public class PCollectionsImmutableMapTest {
@Test
public void testDelegationOfKeySet() {
new PCollectionsHashMapWrapperDelegationChecker<>()
- .defineMockConfigurationForFunctionInvocation(HashPMap::keySet, Collections.emptySet())
+ .defineMockConfigurationForFunctionInvocation(HashPMap::keySet, Set.of())
.defineWrapperFunctionInvocationAndMockReturnValueTransformation(PCollectionsImmutableMap::keySet, identity())
.doFunctionDelegationCheck();
}
@@ -174,7 +175,7 @@ public class PCollectionsImmutableMapTest {
@Test
public void testDelegationOfValues() {
new PCollectionsHashMapWrapperDelegationChecker<>()
- .defineMockConfigurationForFunctionInvocation(HashPMap::values, Collections.emptySet())
+ .defineMockConfigurationForFunctionInvocation(HashPMap::values, Set.of())
.defineWrapperFunctionInvocationAndMockReturnValueTransformation(PCollectionsImmutableMap::values, identity())
.doFunctionDelegationCheck();
}
@@ -182,7 +183,7 @@ public class PCollectionsImmutableMapTest {
@Test
public void testDelegationOfEntrySet() {
new PCollectionsHashMapWrapperDelegationChecker<>()
- .defineMockConfigurationForFunctionInvocation(HashPMap::entrySet, Collections.emptySet())
+ .defineMockConfigurationForFunctionInvocation(HashPMap::entrySet, Set.of())
.defineWrapperFunctionInvocationAndMockReturnValueTransformation(PCollectionsImmutableMap::entrySet, identity())
.doFunctionDelegationCheck();
}
diff --git a/server-common/src/test/java/org/apache/kafka/server/immutable/pcollections/PCollectionsImmutableNavigableSetTest.java b/server-common/src/test/java/org/apache/kafka/server/immutable/pcollections/PCollectionsImmutableNavigableSetTest.java
index 525040a474a..88c5df46d1c 100644
--- a/server-common/src/test/java/org/apache/kafka/server/immutable/pcollections/PCollectionsImmutableNavigableSetTest.java
+++ b/server-common/src/test/java/org/apache/kafka/server/immutable/pcollections/PCollectionsImmutableNavigableSetTest.java
@@ -27,9 +27,8 @@ import org.junit.jupiter.params.provider.ValueSource;
import org.pcollections.HashTreePSet;
import org.pcollections.TreePSet;
-import java.util.Arrays;
-import java.util.Collections;
import java.util.Iterator;
+import java.util.List;
import java.util.Random;
import java.util.Spliterator;
import java.util.function.Consumer;
@@ -145,7 +144,7 @@ public class PCollectionsImmutableNavigableSetTest {
@Test
public void testDelegationOfDescendingSet() {
- TreePSet<Integer> testSet = TreePSet.from(Arrays.asList(2, 3, 4));
+ TreePSet<Integer> testSet = TreePSet.from(List.of(2, 3, 4));
new PCollectionsTreeSetWrapperDelegationChecker<>()
.defineMockConfigurationForFunctionInvocation(TreePSet::descendingSet, testSet.descendingSet())
.defineWrapperFunctionInvocationAndMockReturnValueTransformation(PCollectionsImmutableNavigableSet::descendingSet, identity())
@@ -155,7 +154,7 @@ public class PCollectionsImmutableNavigableSetTest {
@Test
public void testDelegationOfDescendingIterator() {
- TreePSet<Integer> testSet = TreePSet.from(Arrays.asList(2, 3, 4));
+ TreePSet<Integer> testSet = TreePSet.from(List.of(2, 3, 4));
new PCollectionsTreeSetWrapperDelegationChecker<>()
.defineMockConfigurationForFunctionInvocation(TreePSet::descendingIterator, testSet.descendingIterator())
.defineWrapperFunctionInvocationAndMockReturnValueTransformation(PCollectionsImmutableNavigableSet::descendingIterator, identity())
@@ -191,7 +190,7 @@ public class PCollectionsImmutableNavigableSetTest {
@Test
public void testDelegationOfComparator() {
- TreePSet<Integer> testSet = TreePSet.from(Arrays.asList(3, 4, 5));
+ TreePSet<Integer> testSet = TreePSet.from(List.of(3, 4, 5));
new PCollectionsTreeSetWrapperDelegationChecker<>()
.defineMockConfigurationForFunctionInvocation(TreePSet::comparator, testSet.comparator())
.defineWrapperFunctionInvocationAndMockReturnValueTransformation(PCollectionsImmutableNavigableSet::comparator, identity())
@@ -324,32 +323,32 @@ public class PCollectionsImmutableNavigableSetTest {
@ValueSource(booleans = {true, false})
public void testDelegationOfContainsAll(boolean mockFunctionReturnValue) {
new PCollectionsTreeSetWrapperDelegationChecker<>()
- .defineMockConfigurationForFunctionInvocation(mock -> mock.containsAll(eq(Collections.emptyList())), mockFunctionReturnValue)
- .defineWrapperFunctionInvocationAndMockReturnValueTransformation(wrapper -> wrapper.containsAll(Collections.emptyList()), identity())
+ .defineMockConfigurationForFunctionInvocation(mock -> mock.containsAll(eq(List.of())), mockFunctionReturnValue)
+ .defineWrapperFunctionInvocationAndMockReturnValueTransformation(wrapper -> wrapper.containsAll(List.of()), identity())
.doFunctionDelegationCheck();
}
@Test
public void testDelegationOfUnsupportedFunctionAddAll() {
new PCollectionsTreeSetWrapperDelegationChecker<>()
- .defineMockConfigurationForUnsupportedFunction(mock -> mock.addAll(eq(Collections.emptyList())))
- .defineWrapperUnsupportedFunctionInvocation(wrapper -> wrapper.addAll(Collections.emptyList()))
+ .defineMockConfigurationForUnsupportedFunction(mock -> mock.addAll(eq(List.of())))
+ .defineWrapperUnsupportedFunctionInvocation(wrapper -> wrapper.addAll(List.of()))
.doUnsupportedFunctionDelegationCheck();
}
@Test
public void testDelegationOfUnsupportedFunctionRetainAll() {
new PCollectionsTreeSetWrapperDelegationChecker<>()
- .defineMockConfigurationForUnsupportedFunction(mock -> mock.retainAll(eq(Collections.emptyList())))
- .defineWrapperUnsupportedFunctionInvocation(wrapper -> wrapper.retainAll(Collections.emptyList()))
+ .defineMockConfigurationForUnsupportedFunction(mock -> mock.retainAll(eq(List.of())))
+ .defineWrapperUnsupportedFunctionInvocation(wrapper -> wrapper.retainAll(List.of()))
.doUnsupportedFunctionDelegationCheck();
}
@Test
public void testDelegationOfUnsupportedFunctionRemoveAll() {
new PCollectionsTreeSetWrapperDelegationChecker<>()
- .defineMockConfigurationForUnsupportedFunction(mock -> mock.removeAll(eq(Collections.emptyList())))
- .defineWrapperUnsupportedFunctionInvocation(wrapper -> wrapper.removeAll(Collections.emptyList()))
+ .defineMockConfigurationForUnsupportedFunction(mock -> mock.removeAll(eq(List.of())))
+ .defineWrapperUnsupportedFunctionInvocation(wrapper -> wrapper.removeAll(List.of()))
.doUnsupportedFunctionDelegationCheck();
}
diff --git a/server-common/src/test/java/org/apache/kafka/server/immutable/pcollections/PCollectionsImmutableSetTest.java b/server-common/src/test/java/org/apache/kafka/server/immutable/pcollections/PCollectionsImmutableSetTest.java
index ca76b051799..fea9a103c73 100644
--- a/server-common/src/test/java/org/apache/kafka/server/immutable/pcollections/PCollectionsImmutableSetTest.java
+++ b/server-common/src/test/java/org/apache/kafka/server/immutable/pcollections/PCollectionsImmutableSetTest.java
@@ -27,8 +27,8 @@ import org.junit.jupiter.params.provider.ValueSource;
import org.pcollections.HashTreePSet;
import org.pcollections.MapPSet;
-import java.util.Collections;
import java.util.Iterator;
+import java.util.List;
import java.util.Spliterator;
import java.util.function.Consumer;
import java.util.function.Predicate;
@@ -170,32 +170,32 @@ public class PCollectionsImmutableSetTest {
@ValueSource(booleans = {true, false})
public void testDelegationOfContainsAll(boolean mockFunctionReturnValue) {
new PCollectionsHashSetWrapperDelegationChecker<>()
- .defineMockConfigurationForFunctionInvocation(mock -> mock.containsAll(eq(Collections.emptyList())), mockFunctionReturnValue)
- .defineWrapperFunctionInvocationAndMockReturnValueTransformation(wrapper -> wrapper.containsAll(Collections.emptyList()), identity())
+ .defineMockConfigurationForFunctionInvocation(mock -> mock.containsAll(eq(List.of())), mockFunctionReturnValue)
+ .defineWrapperFunctionInvocationAndMockReturnValueTransformation(wrapper -> wrapper.containsAll(List.of()), identity())
.doFunctionDelegationCheck();
}
@Test
public void testDelegationOfUnsupportedFunctionAddAll() {
new PCollectionsHashSetWrapperDelegationChecker<>()
- .defineMockConfigurationForUnsupportedFunction(mock -> mock.addAll(eq(Collections.emptyList())))
- .defineWrapperUnsupportedFunctionInvocation(wrapper -> wrapper.addAll(Collections.emptyList()))
+ .defineMockConfigurationForUnsupportedFunction(mock -> mock.addAll(eq(List.of())))
+ .defineWrapperUnsupportedFunctionInvocation(wrapper -> wrapper.addAll(List.of()))
.doUnsupportedFunctionDelegationCheck();
}
@Test
public void testDelegationOfUnsupportedFunctionRetainAll() {
new PCollectionsHashSetWrapperDelegationChecker<>()
- .defineMockConfigurationForUnsupportedFunction(mock -> mock.retainAll(eq(Collections.emptyList())))
- .defineWrapperUnsupportedFunctionInvocation(wrapper -> wrapper.retainAll(Collections.emptyList()))
+ .defineMockConfigurationForUnsupportedFunction(mock -> mock.retainAll(eq(List.of())))
+ .defineWrapperUnsupportedFunctionInvocation(wrapper -> wrapper.retainAll(List.of()))
.doUnsupportedFunctionDelegationCheck();
}
@Test
public void testDelegationOfUnsupportedFunctionRemoveAll() {
new PCollectionsHashSetWrapperDelegationChecker<>()
- .defineMockConfigurationForUnsupportedFunction(mock -> mock.removeAll(eq(Collections.emptyList())))
- .defineWrapperUnsupportedFunctionInvocation(wrapper -> wrapper.removeAll(Collections.emptyList()))
+ .defineMockConfigurationForUnsupportedFunction(mock -> mock.removeAll(eq(List.of())))
+ .defineWrapperUnsupportedFunctionInvocation(wrapper -> wrapper.removeAll(List.of()))
.doUnsupportedFunctionDelegationCheck();
}
diff --git a/server-common/src/test/java/org/apache/kafka/server/metrics/KafkaMetricsGroupTest.java b/server-common/src/test/java/org/apache/kafka/server/metrics/KafkaMetricsGroupTest.java
index 08b5b00fb26..f3d55c18469 100644
--- a/server-common/src/test/java/org/apache/kafka/server/metrics/KafkaMetricsGroupTest.java
+++ b/server-common/src/test/java/org/apache/kafka/server/metrics/KafkaMetricsGroupTest.java
@@ -20,7 +20,7 @@ import com.yammer.metrics.core.MetricName;
import org.junit.jupiter.api.Test;
-import java.util.Collections;
+import java.util.Map;
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -30,7 +30,7 @@ public class KafkaMetricsGroupTest {
String packageName = "testPackage";
String simpleName = "testSimple";
KafkaMetricsGroup group = new KafkaMetricsGroup(packageName, simpleName);
- MetricName metricName = group.metricName("metric-name", Collections.emptyMap());
+ MetricName metricName = group.metricName("metric-name", Map.of());
assertEquals(packageName, metricName.getGroup());
assertEquals(simpleName, metricName.getType());
}
diff --git a/server-common/src/test/java/org/apache/kafka/server/mutable/BoundedListTest.java b/server-common/src/test/java/org/apache/kafka/server/mutable/BoundedListTest.java
index df2608430f4..9bed4e7d901 100644
--- a/server-common/src/test/java/org/apache/kafka/server/mutable/BoundedListTest.java
+++ b/server-common/src/test/java/org/apache/kafka/server/mutable/BoundedListTest.java
@@ -20,7 +20,6 @@ package org.apache.kafka.server.mutable;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Timeout;
-import java.util.Arrays;
import java.util.List;
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
@@ -91,7 +90,7 @@ public class BoundedListTest {
@Test
public void testHashCodeAndEqualsForNonEmptyList() {
BoundedList<Integer> boundedList = BoundedList.newArrayBacked(7);
- List<Integer> otherList = Arrays.asList(1, 2, 3, 4, 5, 6, 7);
+ List<Integer> otherList = List.of(1, 2, 3, 4, 5, 6, 7);
boundedList.addAll(otherList);
assertEquals(otherList, boundedList);
@@ -104,11 +103,11 @@ public class BoundedListTest {
list.add(1);
list.add(200);
list.add(3);
- assertEquals(Arrays.asList(1, 200, 3), list);
+ assertEquals(List.of(1, 200, 3), list);
list.set(0, 100);
list.set(1, 200);
list.set(2, 300);
- assertEquals(Arrays.asList(100, 200, 300), list);
+ assertEquals(List.of(100, 200, 300), list);
}
@Test
@@ -120,9 +119,9 @@ public class BoundedListTest {
assertEquals(0, list.indexOf("a"));
assertEquals(1, list.lastIndexOf("a"));
list.remove("a");
- assertEquals(Arrays.asList("a", "c"), list);
+ assertEquals(List.of("a", "c"), list);
list.remove(0);
- assertEquals(Arrays.asList("c"), list);
+ assertEquals(List.of("c"), list);
}
@Test
@@ -132,7 +131,7 @@ public class BoundedListTest {
list.add("a");
list.add("c");
list.clear();
- assertEquals(Arrays.asList(), list);
+ assertEquals(List.of(), list);
assertTrue(list.isEmpty());
}
@@ -166,13 +165,13 @@ public class BoundedListTest {
assertEquals("Cannot add another 3 element(s) to the list because it would exceed the " +
"maximum length of 5",
assertThrows(BoundedListTooLongException.class,
- () -> list.addAll(Arrays.asList("d", "e", "f"))).getMessage());
+ () -> list.addAll(List.of("d", "e", "f"))).getMessage());
assertEquals("Cannot add another 3 element(s) to the list because it would exceed the " +
"maximum length of 5",
assertThrows(BoundedListTooLongException.class,
- () -> list.addAll(0, Arrays.asList("d", "e", "f"))).getMessage());
- list.addAll(Arrays.asList("d", "e"));
- assertEquals(Arrays.asList("a", "b", "c", "d", "e"), list);
+ () -> list.addAll(0, List.of("d", "e", "f"))).getMessage());
+ list.addAll(List.of("d", "e"));
+ assertEquals(List.of("a", "b", "c", "d", "e"), list);
}
@Test
@@ -205,7 +204,7 @@ public class BoundedListTest {
list.add(1);
list.add(2);
list.add(3);
- assertEquals(Arrays.asList(2), list.subList(1, 2));
+ assertEquals(List.of(2), list.subList(1, 2));
assertThrows(UnsupportedOperationException.class,
() -> list.subList(1, 2).remove(2));
}
diff --git a/server-common/src/test/java/org/apache/kafka/server/network/EndpointReadyFuturesTest.java b/server-common/src/test/java/org/apache/kafka/server/network/EndpointReadyFuturesTest.java
index 20edb7ce757..649fa9cd64b 100644
--- a/server-common/src/test/java/org/apache/kafka/server/network/EndpointReadyFuturesTest.java
+++ b/server-common/src/test/java/org/apache/kafka/server/network/EndpointReadyFuturesTest.java
@@ -23,9 +23,9 @@ import org.apache.kafka.common.security.auth.SecurityProtocol;
import org.junit.jupiter.api.Test;
-import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
+import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
@@ -47,9 +47,9 @@ public final class EndpointReadyFuturesTest {
private static final KafkaAuthorizerServerInfo INFO = new KafkaAuthorizerServerInfo(
new ClusterResource("S6-01LPiQOCBhhFIunQUcQ"),
1,
- Arrays.asList(EXTERNAL, INTERNAL),
+ List.of(EXTERNAL, INTERNAL),
INTERNAL,
- Arrays.asList("INTERNAL"));
+ List.of("INTERNAL"));
static void assertComplete(
EndpointReadyFutures readyFutures,
@@ -98,7 +98,7 @@ public final class EndpointReadyFuturesTest {
public void testImmediateCompletion() {
EndpointReadyFutures readyFutures = new EndpointReadyFutures.Builder().
build(Optional.empty(), INFO);
- assertEquals(new HashSet<>(Arrays.asList(EXTERNAL, INTERNAL)),
+ assertEquals(new HashSet<>(List.of(EXTERNAL, INTERNAL)),
readyFutures.futures().keySet());
assertComplete(readyFutures, EXTERNAL, INTERNAL);
}
@@ -109,7 +109,7 @@ public final class EndpointReadyFuturesTest {
EndpointReadyFutures readyFutures = new EndpointReadyFutures.Builder().
addReadinessFuture("foo", foo).
build(Optional.empty(), INFO);
- assertEquals(new HashSet<>(Arrays.asList(EXTERNAL, INTERNAL)),
+ assertEquals(new HashSet<>(List.of(EXTERNAL, INTERNAL)),
readyFutures.futures().keySet());
assertIncomplete(readyFutures, EXTERNAL, INTERNAL);
foo.complete(null);
@@ -124,7 +124,7 @@ public final class EndpointReadyFuturesTest {
addReadinessFuture("foo", foo).
addReadinessFuture("bar", bar).
build(Optional.empty(), INFO);
- assertEquals(new HashSet<>(Arrays.asList(EXTERNAL, INTERNAL)),
+ assertEquals(new HashSet<>(List.of(EXTERNAL, INTERNAL)),
readyFutures.futures().keySet());
assertIncomplete(readyFutures, EXTERNAL, INTERNAL);
foo.complete(null);
@@ -141,7 +141,7 @@ public final class EndpointReadyFuturesTest {
EndpointReadyFutures readyFutures = new EndpointReadyFutures.Builder().
addReadinessFutures("baz", bazFutures).
build(Optional.empty(), INFO);
- assertEquals(new HashSet<>(Arrays.asList(EXTERNAL, INTERNAL)),
+ assertEquals(new HashSet<>(List.of(EXTERNAL, INTERNAL)),
readyFutures.futures().keySet());
assertIncomplete(readyFutures, EXTERNAL, INTERNAL);
bazFutures.get(EXTERNAL).complete(null);
@@ -159,7 +159,7 @@ public final class EndpointReadyFuturesTest {
addReadinessFuture("foo", foo).
addReadinessFuture("bar", bar).
build(Optional.empty(), INFO);
- assertEquals(new HashSet<>(Arrays.asList(EXTERNAL, INTERNAL)),
+ assertEquals(new HashSet<>(List.of(EXTERNAL, INTERNAL)),
readyFutures.futures().keySet());
assertIncomplete(readyFutures, EXTERNAL, INTERNAL);
foo.complete(null);
diff --git a/server-common/src/test/java/org/apache/kafka/server/purgatory/DelayedOperationTest.java b/server-common/src/test/java/org/apache/kafka/server/purgatory/DelayedOperationTest.java
index 47f268a1d2b..e7fb9a0e2c8 100644
--- a/server-common/src/test/java/org/apache/kafka/server/purgatory/DelayedOperationTest.java
+++ b/server-common/src/test/java/org/apache/kafka/server/purgatory/DelayedOperationTest.java
@@ -23,8 +23,6 @@ import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
@@ -109,7 +107,7 @@ public class DelayedOperationTest {
return super.safeTryComplete();
}
};
- purgatory.tryCompleteElseWatch(op, Collections.singletonList(new MockKey("key")));
+ purgatory.tryCompleteElseWatch(op, List.of(new MockKey("key")));
}
private DelayedOperation op(boolean shouldComplete) {
@@ -141,9 +139,9 @@ public class DelayedOperationTest {
MockDelayedOperation r1 = new MockDelayedOperation(100000L);
MockDelayedOperation r2 = new MockDelayedOperation(100000L);
assertEquals(0, purgatory.checkAndComplete(test1), "With no waiting requests, nothing should be satisfied");
- assertFalse(purgatory.tryCompleteElseWatch(r1, Collections.singletonList(new MockKey("test1"))), "r1 not satisfied and hence watched");
+ assertFalse(purgatory.tryCompleteElseWatch(r1, List.of(new MockKey("test1"))), "r1 not satisfied and hence watched");
assertEquals(0, purgatory.checkAndComplete(test1), "Still nothing satisfied");
- assertFalse(purgatory.tryCompleteElseWatch(r2, Collections.singletonList(new MockKey("test2"))), "r2 not satisfied and hence watched");
+ assertFalse(purgatory.tryCompleteElseWatch(r2, List.of(new MockKey("test2"))), "r2 not satisfied and hence watched");
assertEquals(0, purgatory.checkAndComplete(test2), "Still nothing satisfied");
r1.completable = true;
assertEquals(1, purgatory.checkAndComplete(test1), "r1 satisfied");
@@ -159,8 +157,8 @@ public class DelayedOperationTest {
long start = Time.SYSTEM.hiResClockMs();
MockDelayedOperation r1 = new MockDelayedOperation(expiration);
MockDelayedOperation r2 = new MockDelayedOperation(200000L);
- assertFalse(purgatory.tryCompleteElseWatch(r1, Collections.singletonList(test1)), "r1 not satisfied and hence watched");
- assertFalse(purgatory.tryCompleteElseWatch(r2, Collections.singletonList(test2)), "r2 not satisfied and hence watched");
+ assertFalse(purgatory.tryCompleteElseWatch(r1, List.of(test1)), "r1 not satisfied and hence watched");
+ assertFalse(purgatory.tryCompleteElseWatch(r2, List.of(test2)), "r2 not satisfied and hence watched");
r1.awaitExpiration();
long elapsed = Time.SYSTEM.hiResClockMs() - start;
assertTrue(r1.isCompleted(), "r1 completed due to expiration");
@@ -173,9 +171,9 @@ public class DelayedOperationTest {
MockDelayedOperation r1 = new MockDelayedOperation(100000L);
MockDelayedOperation r2 = new MockDelayedOperation(100000L);
MockDelayedOperation r3 = new MockDelayedOperation(100000L);
- purgatory.tryCompleteElseWatch(r1, Collections.singletonList(test1));
- purgatory.tryCompleteElseWatch(r2, Arrays.asList(test1, test2));
- purgatory.tryCompleteElseWatch(r3, Arrays.asList(test1, test2, test3));
+ purgatory.tryCompleteElseWatch(r1, List.of(test1));
+ purgatory.tryCompleteElseWatch(r2, List.of(test1, test2));
+ purgatory.tryCompleteElseWatch(r3, List.of(test1, test2, test3));
assertEquals(3, purgatory.numDelayed(), "Purgatory should have 3 total delayed operations");
assertEquals(6, purgatory.watched(), "Purgatory should have 6 watched elements");
@@ -202,9 +200,9 @@ public class DelayedOperationTest {
@Test
public void shouldCancelForKeyReturningCancelledOperations() {
- purgatory.tryCompleteElseWatch(new MockDelayedOperation(10000L), Collections.singletonList(test1));
- purgatory.tryCompleteElseWatch(new MockDelayedOperation(10000L), Collections.singletonList(test1));
- purgatory.tryCompleteElseWatch(new MockDelayedOperation(10000L), Collections.singletonList(test2));
+ purgatory.tryCompleteElseWatch(new MockDelayedOperation(10000L), List.of(test1));
+ purgatory.tryCompleteElseWatch(new MockDelayedOperation(10000L), List.of(test1));
+ purgatory.tryCompleteElseWatch(new MockDelayedOperation(10000L), List.of(test2));
List<DelayedOperation> cancelledOperations = purgatory.cancelForKey(test1);
assertEquals(2, cancelledOperations.size());
@@ -232,7 +230,7 @@ public class DelayedOperationTest {
List<TestDelayOperation> ops = new ArrayList<>();
for (int i = 0; i < 100; i++) {
TestDelayOperation op = new TestDelayOperation(i, completionAttempts, maxDelayMs);
- purgatory.tryCompleteElseWatch(op, Collections.singletonList(op.key));
+ purgatory.tryCompleteElseWatch(op, List.of(op.key));
ops.add(op);
}
diff --git a/server-common/src/test/java/org/apache/kafka/server/quota/QuotaUtilsTest.java b/server-common/src/test/java/org/apache/kafka/server/quota/QuotaUtilsTest.java
index d0c1c699cbe..33e07c2ec24 100644
--- a/server-common/src/test/java/org/apache/kafka/server/quota/QuotaUtilsTest.java
+++ b/server-common/src/test/java/org/apache/kafka/server/quota/QuotaUtilsTest.java
@@ -28,7 +28,7 @@ import org.apache.kafka.common.utils.Time;
import org.junit.jupiter.api.Test;
-import java.util.Collections;
+import java.util.Map;
import java.util.concurrent.TimeUnit;
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -40,7 +40,7 @@ public class QuotaUtilsTest {
private final Time time = new MockTime();
private final int numSamples = 10;
private final int maxThrottleTimeMs = 500;
- private final MetricName metricName = new MetricName("test-metric", "groupA", "testA", Collections.emptyMap());
+ private final MetricName metricName = new MetricName("test-metric", "groupA", "testA", Map.of());
@Test
public void testThrottleTimeObservedRateEqualsQuota() {
diff --git a/server-common/src/test/java/org/apache/kafka/server/share/persister/DefaultStatePersisterTest.java b/server-common/src/test/java/org/apache/kafka/server/share/persister/DefaultStatePersisterTest.java
index e9ba8e90613..1a668b5dc32 100644
--- a/server-common/src/test/java/org/apache/kafka/server/share/persister/DefaultStatePersisterTest.java
+++ b/server-common/src/test/java/org/apache/kafka/server/share/persister/DefaultStatePersisterTest.java
@@ -50,8 +50,6 @@ import org.apache.kafka.server.util.timer.Timer;
import org.junit.jupiter.api.Test;
-import java.util.Arrays;
-import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
@@ -127,7 +125,7 @@ class DefaultStatePersisterTest {
@Override
public List<Node> getClusterNodes() {
- return Collections.singletonList(suppliedNode);
+ return List.of(suppliedNode);
}
};
}
@@ -168,7 +166,7 @@ class DefaultStatePersisterTest {
result = defaultStatePersister.writeState(new WriteShareGroupStateParameters.Builder()
.setGroupTopicPartitionData(new GroupTopicPartitionData.Builder<PartitionStateBatchData>()
.setGroupId(groupId)
- .setTopicsData(Collections.emptyList()).build()).build());
+ .setTopicsData(List.of()).build()).build());
assertTrue(result.isDone());
assertTrue(result.isCompletedExceptionally());
assertFutureThrows(IllegalArgumentException.class, result);
@@ -178,8 +176,8 @@ class DefaultStatePersisterTest {
result = defaultStatePersister.writeState(new WriteShareGroupStateParameters.Builder()
.setGroupTopicPartitionData(new GroupTopicPartitionData.Builder<PartitionStateBatchData>()
.setGroupId(groupId)
- .setTopicsData(Collections.singletonList(new TopicData<>(null,
- Collections.singletonList(PartitionFactory.newPartitionStateBatchData(
+ .setTopicsData(List.of(new TopicData<>(null,
+ List.of(PartitionFactory.newPartitionStateBatchData(
partition, 1, 0, 0, null))))).build()).build());
assertTrue(result.isDone());
assertTrue(result.isCompletedExceptionally());
@@ -190,7 +188,7 @@ class DefaultStatePersisterTest {
result = defaultStatePersister.writeState(new WriteShareGroupStateParameters.Builder()
.setGroupTopicPartitionData(new GroupTopicPartitionData.Builder<PartitionStateBatchData>()
.setGroupId(groupId)
- .setTopicsData(Collections.singletonList(new TopicData<>(topicId, Collections.emptyList()))).build()).build());
+ .setTopicsData(List.of(new TopicData<>(topicId, List.of()))).build()).build());
assertTrue(result.isDone());
assertTrue(result.isCompletedExceptionally());
assertFutureThrows(IllegalArgumentException.class, result);
@@ -200,8 +198,8 @@ class DefaultStatePersisterTest {
result = defaultStatePersister.writeState(new WriteShareGroupStateParameters.Builder()
.setGroupTopicPartitionData(new GroupTopicPartitionData.Builder<PartitionStateBatchData>()
.setGroupId(groupId)
- .setTopicsData(Collections.singletonList(new TopicData<>(topicId,
- Collections.singletonList(PartitionFactory.newPartitionStateBatchData(
+ .setTopicsData(List.of(new TopicData<>(topicId,
+ List.of(PartitionFactory.newPartitionStateBatchData(
incorrectPartition, 1, 0, 0, null))))).build()).build());
assertTrue(result.isDone());
assertTrue(result.isCompletedExceptionally());
@@ -244,7 +242,7 @@ class DefaultStatePersisterTest {
result = defaultStatePersister.readState(new ReadShareGroupStateParameters.Builder()
.setGroupTopicPartitionData(new GroupTopicPartitionData.Builder<PartitionIdLeaderEpochData>()
.setGroupId(groupId)
- .setTopicsData(Collections.emptyList()).build()).build());
+ .setTopicsData(List.of()).build()).build());
assertTrue(result.isDone());
assertTrue(result.isCompletedExceptionally());
assertFutureThrows(IllegalArgumentException.class, result);
@@ -254,8 +252,8 @@ class DefaultStatePersisterTest {
result = defaultStatePersister.readState(new ReadShareGroupStateParameters.Builder()
.setGroupTopicPartitionData(new GroupTopicPartitionData.Builder<PartitionIdLeaderEpochData>()
.setGroupId(groupId)
- .setTopicsData(Collections.singletonList(new TopicData<>(null,
- Collections.singletonList(PartitionFactory.newPartitionIdLeaderEpochData(partition, 1))))
+ .setTopicsData(List.of(new TopicData<>(null,
+ List.of(PartitionFactory.newPartitionIdLeaderEpochData(partition, 1))))
).build()).build());
assertTrue(result.isDone());
assertTrue(result.isCompletedExceptionally());
@@ -266,7 +264,7 @@ class DefaultStatePersisterTest {
result = defaultStatePersister.readState(new ReadShareGroupStateParameters.Builder()
.setGroupTopicPartitionData(new GroupTopicPartitionData.Builder<PartitionIdLeaderEpochData>()
.setGroupId(groupId)
- .setTopicsData(Collections.singletonList(new TopicData<>(topicId, Collections.emptyList()))).build()).build());
+ .setTopicsData(List.of(new TopicData<>(topicId, List.of()))).build()).build());
assertTrue(result.isDone());
assertTrue(result.isCompletedExceptionally());
assertFutureThrows(IllegalArgumentException.class, result);
@@ -276,8 +274,8 @@ class DefaultStatePersisterTest {
result = defaultStatePersister.readState(new ReadShareGroupStateParameters.Builder()
.setGroupTopicPartitionData(new GroupTopicPartitionData.Builder<PartitionIdLeaderEpochData>()
.setGroupId(groupId)
- .setTopicsData(Collections.singletonList(new TopicData<>(topicId,
- Collections.singletonList(PartitionFactory.newPartitionIdLeaderEpochData(incorrectPartition, 1))))).build()).build());
+ .setTopicsData(List.of(new TopicData<>(topicId,
+ List.of(PartitionFactory.newPartitionIdLeaderEpochData(incorrectPartition, 1))))).build()).build());
assertTrue(result.isDone());
assertTrue(result.isCompletedExceptionally());
assertFutureThrows(IllegalArgumentException.class, result);
@@ -319,7 +317,7 @@ class DefaultStatePersisterTest {
result = defaultStatePersister.readSummary(new ReadShareGroupStateSummaryParameters.Builder()
.setGroupTopicPartitionData(new GroupTopicPartitionData.Builder<PartitionIdLeaderEpochData>()
.setGroupId(groupId)
- .setTopicsData(Collections.emptyList()).build()).build());
+ .setTopicsData(List.of()).build()).build());
assertTrue(result.isDone());
assertTrue(result.isCompletedExceptionally());
assertFutureThrows(IllegalArgumentException.class, result);
@@ -341,7 +339,7 @@ class DefaultStatePersisterTest {
result = defaultStatePersister.readSummary(new ReadShareGroupStateSummaryParameters.Builder()
.setGroupTopicPartitionData(new GroupTopicPartitionData.Builder<PartitionIdLeaderEpochData>()
.setGroupId(groupId)
- .setTopicsData(List.of(new TopicData<>(topicId, Collections.emptyList()))).build()).build());
+ .setTopicsData(List.of(new TopicData<>(topicId, List.of()))).build()).build());
assertTrue(result.isDone());
assertTrue(result.isCompletedExceptionally());
assertFutureThrows(IllegalArgumentException.class, result);
@@ -532,7 +530,7 @@ class DefaultStatePersisterTest {
&& ((FindCoordinatorRequest) body).data().coordinatorKeys().get(0).equals(coordinatorKey1),
new FindCoordinatorResponse(
new FindCoordinatorResponseData()
- .setCoordinators(Collections.singletonList(
+ .setCoordinators(List.of(
new FindCoordinatorResponseData.Coordinator()
.setNodeId(5)
.setHost(HOST)
@@ -548,7 +546,7 @@ class DefaultStatePersisterTest {
&& ((FindCoordinatorRequest) body).data().coordinatorKeys().get(0).equals(coordinatorKey2),
new FindCoordinatorResponse(
new FindCoordinatorResponseData()
- .setCoordinators(Collections.singletonList(
+ .setCoordinators(List.of(
new FindCoordinatorResponseData.Coordinator()
.setNodeId(6)
.setHost(HOST)
@@ -593,16 +591,16 @@ class DefaultStatePersisterTest {
WriteShareGroupStateParameters request = WriteShareGroupStateParameters.from(
new WriteShareGroupStateRequestData()
.setGroupId(groupId)
- .setTopics(Arrays.asList(
+ .setTopics(List.of(
new WriteShareGroupStateRequestData.WriteStateData()
.setTopicId(topicId1)
- .setPartitions(Collections.singletonList(
+ .setPartitions(List.of(
new WriteShareGroupStateRequestData.PartitionData()
.setPartition(partition1)
.setStateEpoch(0)
.setLeaderEpoch(1)
.setStartOffset(0)
- .setStateBatches(Collections.singletonList(new WriteShareGroupStateRequestData.StateBatch()
+ .setStateBatches(List.of(new WriteShareGroupStateRequestData.StateBatch()
.setFirstOffset(0)
.setLastOffset(10)
.setDeliveryCount((short) 1)
@@ -610,13 +608,13 @@ class DefaultStatePersisterTest {
)),
new WriteShareGroupStateRequestData.WriteStateData()
.setTopicId(topicId2)
- .setPartitions(Collections.singletonList(
+ .setPartitions(List.of(
new WriteShareGroupStateRequestData.PartitionData()
.setPartition(partition2)
.setStateEpoch(0)
.setLeaderEpoch(1)
.setStartOffset(0)
- .setStateBatches(Arrays.asList(
+ .setStateBatches(List.of(
new WriteShareGroupStateRequestData.StateBatch()
.setFirstOffset(0)
.setLastOffset(10)
@@ -682,7 +680,7 @@ class DefaultStatePersisterTest {
&& ((FindCoordinatorRequest) body).data().coordinatorKeys().get(0).equals(coordinatorKey1),
new FindCoordinatorResponse(
new FindCoordinatorResponseData()
- .setCoordinators(Collections.singletonList(
+ .setCoordinators(List.of(
new FindCoordinatorResponseData.Coordinator()
.setNodeId(5)
.setHost(HOST)
@@ -698,7 +696,7 @@ class DefaultStatePersisterTest {
&& ((FindCoordinatorRequest) body).data().coordinatorKeys().get(0).equals(coordinatorKey2),
new FindCoordinatorResponse(
new FindCoordinatorResponseData()
- .setCoordinators(Collections.singletonList(
+ .setCoordinators(List.of(
new FindCoordinatorResponseData.Coordinator()
.setNodeId(6)
.setHost(HOST)
@@ -719,7 +717,7 @@ class DefaultStatePersisterTest {
return requestGroupId.equals(groupId) && requestTopicId == topicId1 && requestPartition == partition1;
},
new ReadShareGroupStateResponse(ReadShareGroupStateResponse.toResponseData(topicId1, partition1, 0, 1,
- Collections.singletonList(new ReadShareGroupStateResponseData.StateBatch()
+ List.of(new ReadShareGroupStateResponseData.StateBatch()
.setFirstOffset(0)
.setLastOffset(10)
.setDeliveryCount((short) 1)
@@ -736,7 +734,7 @@ class DefaultStatePersisterTest {
return requestGroupId.equals(groupId) && requestTopicId == topicId2 && requestPartition == partition2;
},
new ReadShareGroupStateResponse(ReadShareGroupStateResponse.toResponseData(topicId2, partition2, 0, 1,
- Arrays.asList(new ReadShareGroupStateResponseData.StateBatch()
+ List.of(new ReadShareGroupStateResponseData.StateBatch()
.setFirstOffset(0)
.setLastOffset(10)
.setDeliveryCount((short) 1)
@@ -758,17 +756,17 @@ class DefaultStatePersisterTest {
ReadShareGroupStateParameters request = ReadShareGroupStateParameters.from(
new ReadShareGroupStateRequestData()
.setGroupId(groupId)
- .setTopics(Arrays.asList(
+ .setTopics(List.of(
new ReadShareGroupStateRequestData.ReadStateData()
.setTopicId(topicId1)
- .setPartitions(Collections.singletonList(
+ .setPartitions(List.of(
new ReadShareGroupStateRequestData.PartitionData()
.setPartition(partition1)
.setLeaderEpoch(1)
)),
new ReadShareGroupStateRequestData.ReadStateData()
.setTopicId(topicId2)
- .setPartitions(Collections.singletonList(
+ .setPartitions(List.of(
new ReadShareGroupStateRequestData.PartitionData()
.setPartition(partition2)
.setLeaderEpoch(1)
@@ -796,12 +794,12 @@ class DefaultStatePersisterTest {
HashSet<PartitionData> expectedResultMap = new HashSet<>();
expectedResultMap.add(
(PartitionData) PartitionFactory.newPartitionAllData(partition1, 1, 0, Errors.NONE.code(),
- null, Collections.singletonList(new PersisterStateBatch(0, 10, (byte) 0, (short) 1)
+ null, List.of(new PersisterStateBatch(0, 10, (byte) 0, (short) 1)
)));
expectedResultMap.add(
(PartitionData) PartitionFactory.newPartitionAllData(partition2, 1, 0, Errors.NONE.code(),
- null, Arrays.asList(
+ null, List.of(
new PersisterStateBatch(0, 10, (byte) 0, (short) 1),
new PersisterStateBatch(11, 20, (byte) 0, (short) 1)
)));
@@ -895,7 +893,7 @@ class DefaultStatePersisterTest {
ReadShareGroupStateSummaryParameters request = ReadShareGroupStateSummaryParameters.from(
new ReadShareGroupStateSummaryRequestData()
.setGroupId(groupId)
- .setTopics(Arrays.asList(
+ .setTopics(List.of(
new ReadShareGroupStateSummaryRequestData.ReadStateSummaryData()
.setTopicId(topicId1)
.setPartitions(List.of(
@@ -1254,7 +1252,7 @@ class DefaultStatePersisterTest {
results.topicsData().contains(
new TopicData<>(
tp1.topicId(),
- Collections.singletonList(PartitionFactory.newPartitionErrorData(tp1.partition(), Errors.NONE.code(), null))
+ List.of(PartitionFactory.newPartitionErrorData(tp1.partition(), Errors.NONE.code(), null))
)
)
);
@@ -1262,7 +1260,7 @@ class DefaultStatePersisterTest {
results.topicsData().contains(
new TopicData<>(
tp2.topicId(),
- Collections.singletonList(PartitionFactory.newPartitionErrorData(tp2.partition(), Errors.UNKNOWN_TOPIC_OR_PARTITION.code(), "unknown tp"))
+ List.of(PartitionFactory.newPartitionErrorData(tp2.partition(), Errors.UNKNOWN_TOPIC_OR_PARTITION.code(), "unknown tp"))
)
)
);
@@ -1301,7 +1299,7 @@ class DefaultStatePersisterTest {
results.topicsData().contains(
new TopicData<>(
tp1.topicId(),
- Collections.singletonList(PartitionFactory.newPartitionErrorData(tp1.partition(), Errors.NONE.code(), null))
+ List.of(PartitionFactory.newPartitionErrorData(tp1.partition(), Errors.NONE.code(), null))
)
)
);
@@ -1309,7 +1307,7 @@ class DefaultStatePersisterTest {
results.topicsData().contains(
new TopicData<>(
tp2.topicId(),
- Collections.singletonList(PartitionFactory.newPartitionErrorData(tp2.partition(), Errors.UNKNOWN_SERVER_ERROR.code(), "Error writing state to share coordinator: java.lang.Exception: scary stuff"))
+ List.of(PartitionFactory.newPartitionErrorData(tp2.partition(), Errors.UNKNOWN_SERVER_ERROR.code(), "Error writing state to share coordinator: java.lang.Exception: scary stuff"))
)
)
);
@@ -1330,7 +1328,7 @@ class DefaultStatePersisterTest {
tp1.partition(),
1L,
2,
- Collections.emptyList()
+ List.of()
)
)
)
@@ -1361,7 +1359,7 @@ class DefaultStatePersisterTest {
results.topicsData().contains(
new TopicData<>(
tp1.topicId(),
- Collections.singletonList(PartitionFactory.newPartitionAllData(tp1.partition(), 2, 1L, Errors.NONE.code(), null, Collections.emptyList()))
+ List.of(PartitionFactory.newPartitionAllData(tp1.partition(), 2, 1L, Errors.NONE.code(), null, List.of()))
)
)
);
@@ -1369,7 +1367,7 @@ class DefaultStatePersisterTest {
results.topicsData().contains(
new TopicData<>(
tp2.topicId(),
- Collections.singletonList(PartitionFactory.newPartitionAllData(tp2.partition(), 0, 0, Errors.UNKNOWN_TOPIC_OR_PARTITION.code(), "unknown tp", Collections.emptyList()))
+ List.of(PartitionFactory.newPartitionAllData(tp2.partition(), 0, 0, Errors.UNKNOWN_TOPIC_OR_PARTITION.code(), "unknown tp", List.of()))
)
)
);
@@ -1390,7 +1388,7 @@ class DefaultStatePersisterTest {
tp1.partition(),
1L,
2,
- Collections.emptyList()
+ List.of()
)
)
)
@@ -1411,7 +1409,7 @@ class DefaultStatePersisterTest {
results.topicsData().contains(
new TopicData<>(
tp1.topicId(),
- Collections.singletonList(PartitionFactory.newPartitionAllData(tp1.partition(), 2, 1L, Errors.NONE.code(), null, Collections.emptyList()))
+ List.of(PartitionFactory.newPartitionAllData(tp1.partition(), 2, 1L, Errors.NONE.code(), null, List.of()))
)
)
);
@@ -1419,7 +1417,7 @@ class DefaultStatePersisterTest {
results.topicsData().contains(
new TopicData<>(
tp2.topicId(),
- Collections.singletonList(PartitionFactory.newPartitionAllData(tp2.partition(), -1, -1L, Errors.UNKNOWN_SERVER_ERROR.code(), "Error reading state from share coordinator: java.lang.Exception: scary stuff", Collections.emptyList()))
+ List.of(PartitionFactory.newPartitionAllData(tp2.partition(), -1, -1L, Errors.UNKNOWN_SERVER_ERROR.code(), "Error reading state from share coordinator: java.lang.Exception: scary stuff", List.of()))
)
)
);
diff --git a/server-common/src/test/java/org/apache/kafka/server/share/persister/PersisterStateManagerTest.java b/server-common/src/test/java/org/apache/kafka/server/share/persister/PersisterStateManagerTest.java
index 60b4b48d44f..6de002e518a 100644
--- a/server-common/src/test/java/org/apache/kafka/server/share/persister/PersisterStateManagerTest.java
+++ b/server-common/src/test/java/org/apache/kafka/server/share/persister/PersisterStateManagerTest.java
@@ -60,8 +60,6 @@ import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;
import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Optional;
@@ -157,8 +155,8 @@ class PersisterStateManagerTest {
@Override
protected void handleRequestResponse(ClientResponse response) {
this.result.complete(new TestHandlerResponse(new TestHandlerResponseData()
- .setResults(Collections.singletonList(new WriteShareGroupStateResponseData.WriteStateResult()
- .setPartitions(Collections.singletonList(new WriteShareGroupStateResponseData.PartitionResult()
+ .setResults(List.of(new WriteShareGroupStateResponseData.WriteStateResult()
+ .setPartitions(List.of(new WriteShareGroupStateResponseData.PartitionResult()
.setPartition(partitionKey().partition())
.setErrorMessage(Errors.NONE.message())
.setErrorCode(Errors.NONE.code()))
@@ -175,9 +173,9 @@ class PersisterStateManagerTest {
@Override
protected void findCoordinatorErrorResponse(Errors error, Exception exception) {
this.result.complete(new TestHandlerResponse(new TestHandlerResponseData()
- .setResults(Collections.singletonList(new WriteShareGroupStateResponseData.WriteStateResult()
+ .setResults(List.of(new WriteShareGroupStateResponseData.WriteStateResult()
.setTopicId(partitionKey().topicId())
- .setPartitions(Collections.singletonList(new WriteShareGroupStateResponseData.PartitionResult()
+ .setPartitions(List.of(new WriteShareGroupStateResponseData.PartitionResult()
.setPartition(partitionKey().partition())
.setErrorMessage(exception == null ? error.message() : exception.getMessage())
.setErrorCode(error.code()))
@@ -189,9 +187,9 @@ class PersisterStateManagerTest {
@Override
protected void requestErrorResponse(Errors error, Exception exception) {
this.result.complete(new TestHandlerResponse(new TestHandlerResponseData()
- .setResults(Collections.singletonList(new WriteShareGroupStateResponseData.WriteStateResult()
+ .setResults(List.of(new WriteShareGroupStateResponseData.WriteStateResult()
.setTopicId(partitionKey().topicId())
- .setPartitions(Collections.singletonList(new WriteShareGroupStateResponseData.PartitionResult()
+ .setPartitions(List.of(new WriteShareGroupStateResponseData.PartitionResult()
.setPartition(partitionKey().partition())
.setErrorMessage(exception == null ? error.message() : exception.getMessage())
.setErrorCode(error.code()))
@@ -235,7 +233,7 @@ class PersisterStateManagerTest {
@Override
public List<Node> getClusterNodes() {
- return Collections.singletonList(suppliedNode);
+ return List.of(suppliedNode);
}
};
}
@@ -254,7 +252,7 @@ class PersisterStateManagerTest {
@Override
public List<Node> getClusterNodes() {
- return Collections.emptyList();
+ return List.of();
}
};
}
@@ -289,7 +287,7 @@ class PersisterStateManagerTest {
&& ((FindCoordinatorRequest) body).data().coordinatorKeys().get(0).equals(coordinatorKey),
new FindCoordinatorResponse(
new FindCoordinatorResponseData()
- .setCoordinators(Collections.singletonList(
+ .setCoordinators(List.of(
new FindCoordinatorResponseData.Coordinator()
.setKey(coordinatorKey)
.setErrorCode(Errors.UNKNOWN_SERVER_ERROR.code())
@@ -493,7 +491,7 @@ class PersisterStateManagerTest {
&& ((FindCoordinatorRequest) body).data().coordinatorKeys().get(0).equals(coordinatorKey),
new FindCoordinatorResponse(
new FindCoordinatorResponseData()
- .setCoordinators(Collections.singletonList(
+ .setCoordinators(List.of(
new FindCoordinatorResponseData.Coordinator()
.setKey(coordinatorKey)
.setErrorCode(Errors.COORDINATOR_NOT_AVAILABLE.code())
@@ -510,7 +508,7 @@ class PersisterStateManagerTest {
&& ((FindCoordinatorRequest) body).data().coordinatorKeys().get(0).equals(coordinatorKey),
new FindCoordinatorResponse(
new FindCoordinatorResponseData()
- .setCoordinators(Collections.singletonList(
+ .setCoordinators(List.of(
new FindCoordinatorResponseData.Coordinator()
.setKey(coordinatorKey)
.setErrorCode(Errors.COORDINATOR_NOT_AVAILABLE.code())
@@ -590,7 +588,7 @@ class PersisterStateManagerTest {
&& ((FindCoordinatorRequest) body).data().coordinatorKeys().get(0).equals(coordinatorKey),
new FindCoordinatorResponse(
new FindCoordinatorResponseData()
- .setCoordinators(Collections.singletonList(
+ .setCoordinators(List.of(
new FindCoordinatorResponseData.Coordinator()
.setNodeId(1)
.setHost(HOST)
@@ -610,17 +608,17 @@ class PersisterStateManagerTest {
return requestGroupId.equals(groupId) && requestTopicId == topicId && requestPartition == partition;
}, new ReadShareGroupStateResponse(
new ReadShareGroupStateResponseData()
- .setResults(Collections.singletonList(
+ .setResults(List.of(
new ReadShareGroupStateResponseData.ReadStateResult()
.setTopicId(topicId)
- .setPartitions(Collections.singletonList(
+ .setPartitions(List.of(
new ReadShareGroupStateResponseData.PartitionResult()
.setPartition(partition)
.setErrorCode(Errors.NONE.code())
.setErrorMessage("")
.setStateEpoch(1)
.setStartOffset(0)
- .setStateBatches(Collections.emptyList())
+ .setStateBatches(List.of())
))
))
), coordinatorNode);
@@ -677,7 +675,7 @@ class PersisterStateManagerTest {
String groupId = "group1";
Uuid topicId = Uuid.randomUuid();
int partition = 10;
- List<PersisterStateBatch> stateBatches = Arrays.asList(
+ List<PersisterStateBatch> stateBatches = List.of(
new PersisterStateBatch(0, 9, (byte) 0, (short) 1),
new PersisterStateBatch(10, 19, (byte) 1, (short) 1)
);
@@ -692,7 +690,7 @@ class PersisterStateManagerTest {
&& ((FindCoordinatorRequest) body).data().coordinatorKeys().get(0).equals(coordinatorKey),
new FindCoordinatorResponse(
new FindCoordinatorResponseData()
- .setCoordinators(Collections.singletonList(
+ .setCoordinators(List.of(
new FindCoordinatorResponseData.Coordinator()
.setNodeId(1)
.setHost(HOST)
@@ -712,10 +710,10 @@ class PersisterStateManagerTest {
return requestGroupId.equals(groupId) && requestTopicId == topicId && requestPartition == partition;
}, new WriteShareGroupStateResponse(
new WriteShareGroupStateResponseData()
- .setResults(Collections.singletonList(
+ .setResults(List.of(
new WriteShareGroupStateResponseData.WriteStateResult()
.setTopicId(topicId)
- .setPartitions(Collections.singletonList(
+ .setPartitions(List.of(
new WriteShareGroupStateResponseData.PartitionResult()
.setPartition(partition)
.setErrorCode(Errors.NONE.code())
@@ -788,7 +786,7 @@ class PersisterStateManagerTest {
String groupId = "group1";
Uuid topicId = Uuid.randomUuid();
int partition = 10;
- List<PersisterStateBatch> stateBatches = Arrays.asList(
+ List<PersisterStateBatch> stateBatches = List.of(
new PersisterStateBatch(0, 9, (byte) 0, (short) 1),
new PersisterStateBatch(10, 19, (byte) 1, (short) 1)
);
@@ -803,7 +801,7 @@ class PersisterStateManagerTest {
&& ((FindCoordinatorRequest) body).data().coordinatorKeys().get(0).equals(coordinatorKey),
new FindCoordinatorResponse(
new FindCoordinatorResponseData()
- .setCoordinators(Collections.singletonList(
+ .setCoordinators(List.of(
new FindCoordinatorResponseData.Coordinator()
.setErrorCode(Errors.NOT_COORDINATOR.code())
))
@@ -816,7 +814,7 @@ class PersisterStateManagerTest {
&& ((FindCoordinatorRequest) body).data().coordinatorKeys().get(0).equals(coordinatorKey),
new FindCoordinatorResponse(
new FindCoordinatorResponseData()
- .setCoordinators(Collections.singletonList(
+ .setCoordinators(List.of(
new FindCoordinatorResponseData.Coordinator()
.setNodeId(1)
.setHost(HOST)
@@ -836,10 +834,10 @@ class PersisterStateManagerTest {
return requestGroupId.equals(groupId) && requestTopicId == topicId && requestPartition == partition;
}, new WriteShareGroupStateResponse(
new WriteShareGroupStateResponseData()
- .setResults(Collections.singletonList(
+ .setResults(List.of(
new WriteShareGroupStateResponseData.WriteStateResult()
.setTopicId(topicId)
- .setPartitions(Collections.singletonList(
+ .setPartitions(List.of(
new WriteShareGroupStateResponseData.PartitionResult()
.setPartition(partition)
.setErrorCode(Errors.NONE.code())
@@ -908,7 +906,7 @@ class PersisterStateManagerTest {
String groupId = "group1";
Uuid topicId = Uuid.randomUuid();
int partition = 10;
- List<PersisterStateBatch> stateBatches = Arrays.asList(
+ List<PersisterStateBatch> stateBatches = List.of(
new PersisterStateBatch(0, 9, (byte) 0, (short) 1),
new PersisterStateBatch(10, 19, (byte) 1, (short) 1)
);
@@ -923,7 +921,7 @@ class PersisterStateManagerTest {
&& ((FindCoordinatorRequest) body).data().coordinatorKeys().get(0).equals(coordinatorKey),
new FindCoordinatorResponse(
new FindCoordinatorResponseData()
- .setCoordinators(Collections.singletonList(
+ .setCoordinators(List.of(
new FindCoordinatorResponseData.Coordinator()
.setErrorCode(Errors.COORDINATOR_NOT_AVAILABLE.code())
))
@@ -936,7 +934,7 @@ class PersisterStateManagerTest {
&& ((FindCoordinatorRequest) body).data().coordinatorKeys().get(0).equals(coordinatorKey),
new FindCoordinatorResponse(
new FindCoordinatorResponseData()
- .setCoordinators(Collections.singletonList(
+ .setCoordinators(List.of(
new FindCoordinatorResponseData.Coordinator()
.setNodeId(1)
.setHost(HOST)
@@ -956,10 +954,10 @@ class PersisterStateManagerTest {
return requestGroupId.equals(groupId) && requestTopicId == topicId && requestPartition == partition;
}, new WriteShareGroupStateResponse(
new WriteShareGroupStateResponseData()
- .setResults(Collections.singletonList(
+ .setResults(List.of(
new WriteShareGroupStateResponseData.WriteStateResult()
.setTopicId(topicId)
- .setPartitions(Collections.singletonList(
+ .setPartitions(List.of(
new WriteShareGroupStateResponseData.PartitionResult()
.setPartition(partition)
.setErrorCode(Errors.NONE.code())
@@ -1032,7 +1030,7 @@ class PersisterStateManagerTest {
String groupId = "group1";
Uuid topicId = Uuid.randomUuid();
int partition = 10;
- List<PersisterStateBatch> stateBatches = Arrays.asList(
+ List<PersisterStateBatch> stateBatches = List.of(
new PersisterStateBatch(0, 9, (byte) 0, (short) 1),
new PersisterStateBatch(10, 19, (byte) 1, (short) 1)
);
@@ -1048,10 +1046,10 @@ class PersisterStateManagerTest {
return requestGroupId.equals(groupId) && requestTopicId == topicId && requestPartition == partition;
}, new WriteShareGroupStateResponse(
new WriteShareGroupStateResponseData()
- .setResults(Collections.singletonList(
+ .setResults(List.of(
new WriteShareGroupStateResponseData.WriteStateResult()
.setTopicId(topicId)
- .setPartitions(Collections.singletonList(
+ .setPartitions(List.of(
new WriteShareGroupStateResponseData.PartitionResult()
.setPartition(partition)
.setErrorCode(Errors.NONE.code())
@@ -1125,7 +1123,7 @@ class PersisterStateManagerTest {
String groupId = "group1";
Uuid topicId = Uuid.randomUuid();
int partition = 10;
- List<PersisterStateBatch> stateBatches = Arrays.asList(
+ List<PersisterStateBatch> stateBatches = List.of(
new PersisterStateBatch(0, 9, (byte) 0, (short) 1),
new PersisterStateBatch(10, 19, (byte) 1, (short) 1)
);
@@ -1141,10 +1139,10 @@ class PersisterStateManagerTest {
return requestGroupId.equals(groupId) && requestTopicId == topicId && requestPartition == partition;
}, new WriteShareGroupStateResponse(
new WriteShareGroupStateResponseData()
- .setResults(Collections.singletonList(
+ .setResults(List.of(
new WriteShareGroupStateResponseData.WriteStateResult()
.setTopicId(topicId)
- .setPartitions(Collections.singletonList(
+ .setPartitions(List.of(
new WriteShareGroupStateResponseData.PartitionResult()
.setPartition(partition)
.setErrorCode(Errors.COORDINATOR_LOAD_IN_PROGRESS.code())
@@ -1162,10 +1160,10 @@ class PersisterStateManagerTest {
return requestGroupId.equals(groupId) && requestTopicId == topicId && requestPartition == partition;
}, new WriteShareGroupStateResponse(
new WriteShareGroupStateResponseData()
- .setResults(Collections.singletonList(
+ .setResults(List.of(
new WriteShareGroupStateResponseData.WriteStateResult()
.setTopicId(topicId)
- .setPartitions(Collections.singletonList(
+ .setPartitions(List.of(
new WriteShareGroupStateResponseData.PartitionResult()
.setPartition(partition)
.setErrorCode(Errors.NONE.code())
@@ -1239,7 +1237,7 @@ class PersisterStateManagerTest {
String groupId = "group1";
Uuid topicId = Uuid.randomUuid();
int partition = 10;
- List<PersisterStateBatch> stateBatches = Arrays.asList(
+ List<PersisterStateBatch> stateBatches = List.of(
new PersisterStateBatch(0, 9, (byte) 0, (short) 1),
new PersisterStateBatch(10, 19, (byte) 1, (short) 1)
);
@@ -1255,10 +1253,10 @@ class PersisterStateManagerTest {
return requestGroupId.equals(groupId) && requestTopicId == topicId && requestPartition == partition;
}, new WriteShareGroupStateResponse(
new WriteShareGroupStateResponseData()
- .setResults(Collections.singletonList(
+ .setResults(List.of(
new WriteShareGroupStateResponseData.WriteStateResult()
.setTopicId(topicId)
- .setPartitions(Collections.singletonList(
+ .setPartitions(List.of(
new WriteShareGroupStateResponseData.PartitionResult()
.setPartition(partition)
.setErrorCode(Errors.COORDINATOR_LOAD_IN_PROGRESS.code())
@@ -1276,10 +1274,10 @@ class PersisterStateManagerTest {
return requestGroupId.equals(groupId) && requestTopicId == topicId && requestPartition == partition;
}, new WriteShareGroupStateResponse(
new WriteShareGroupStateResponseData()
- .setResults(Collections.singletonList(
+ .setResults(List.of(
new WriteShareGroupStateResponseData.WriteStateResult()
.setTopicId(topicId)
- .setPartitions(Collections.singletonList(
+ .setPartitions(List.of(
new WriteShareGroupStateResponseData.PartitionResult()
.setPartition(partition)
.setErrorCode(Errors.COORDINATOR_LOAD_IN_PROGRESS.code())
@@ -1297,10 +1295,10 @@ class PersisterStateManagerTest {
return requestGroupId.equals(groupId) && requestTopicId == topicId && requestPartition == partition;
}, new WriteShareGroupStateResponse(
new WriteShareGroupStateResponseData()
- .setResults(Collections.singletonList(
+ .setResults(List.of(
new WriteShareGroupStateResponseData.WriteStateResult()
.setTopicId(topicId)
- .setPartitions(Collections.singletonList(
+ .setPartitions(List.of(
new WriteShareGroupStateResponseData.PartitionResult()
.setPartition(partition)
.setErrorCode(Errors.NONE.code())
@@ -1374,7 +1372,7 @@ class PersisterStateManagerTest {
String groupId = "group1";
Uuid topicId = Uuid.randomUuid();
int partition = 10;
- List<PersisterStateBatch> stateBatches = Arrays.asList(
+ List<PersisterStateBatch> stateBatches = List.of(
new PersisterStateBatch(0, 9, (byte) 0, (short) 1),
new PersisterStateBatch(10, 19, (byte) 1, (short) 1)
);
@@ -1390,10 +1388,10 @@ class PersisterStateManagerTest {
return requestGroupId.equals(groupId) && requestTopicId == topicId && requestPartition == partition;
}, new WriteShareGroupStateResponse(
new WriteShareGroupStateResponseData()
- .setResults(Collections.singletonList(
+ .setResults(List.of(
new WriteShareGroupStateResponseData.WriteStateResult()
.setTopicId(topicId)
- .setPartitions(Collections.singletonList(
+ .setPartitions(List.of(
new WriteShareGroupStateResponseData.PartitionResult()
.setPartition(partition)
.setErrorCode(Errors.NONE.code())
@@ -1466,7 +1464,7 @@ class PersisterStateManagerTest {
&& ((FindCoordinatorRequest) body).data().coordinatorKeys().get(0).equals(coordinatorKey),
new FindCoordinatorResponse(
new FindCoordinatorResponseData()
- .setCoordinators(Collections.singletonList(
+ .setCoordinators(List.of(
new FindCoordinatorResponseData.Coordinator()
.setNodeId(1)
.setHost(HOST)
@@ -1486,17 +1484,17 @@ class PersisterStateManagerTest {
return requestGroupId.equals(groupId) && requestTopicId == topicId && requestPartition == partition;
}, new ReadShareGroupStateResponse(
new ReadShareGroupStateResponseData()
- .setResults(Collections.singletonList(
+ .setResults(List.of(
new ReadShareGroupStateResponseData.ReadStateResult()
.setTopicId(topicId)
- .setPartitions(Collections.singletonList(
+ .setPartitions(List.of(
new ReadShareGroupStateResponseData.PartitionResult()
.setPartition(partition)
.setErrorCode(Errors.NONE.code())
.setErrorMessage("")
.setStateEpoch(1)
.setStartOffset(0)
- .setStateBatches(Collections.emptyList())
+ .setStateBatches(List.of())
))
))
), coordinatorNode);
@@ -1576,7 +1574,7 @@ class PersisterStateManagerTest {
&& ((FindCoordinatorRequest) body).data().coordinatorKeys().get(0).equals(coordinatorKey),
new FindCoordinatorResponse(
new FindCoordinatorResponseData()
- .setCoordinators(Collections.singletonList(
+ .setCoordinators(List.of(
new FindCoordinatorResponseData.Coordinator()
.setNodeId(1)
.setHost(HOST)
@@ -1596,17 +1594,17 @@ class PersisterStateManagerTest {
return requestGroupId.equals(groupId) && requestTopicId == topicId && requestPartition == partition;
}, new ReadShareGroupStateResponse(
new ReadShareGroupStateResponseData()
- .setResults(Collections.singletonList(
+ .setResults(List.of(
new ReadShareGroupStateResponseData.ReadStateResult()
.setTopicId(Uuid.randomUuid())
- .setPartitions(Collections.singletonList(
+ .setPartitions(List.of(
new ReadShareGroupStateResponseData.PartitionResult()
.setPartition(500)
.setErrorCode(Errors.NONE.code())
.setErrorMessage("")
.setStateEpoch(1)
.setStartOffset(0)
- .setStateBatches(Collections.emptyList())
+ .setStateBatches(List.of())
))
))
), coordinatorNode);
@@ -1683,7 +1681,7 @@ class PersisterStateManagerTest {
&& ((FindCoordinatorRequest) body).data().coordinatorKeys().get(0).equals(coordinatorKey),
new FindCoordinatorResponse(
new FindCoordinatorResponseData()
- .setCoordinators(Collections.singletonList(
+ .setCoordinators(List.of(
new FindCoordinatorResponseData.Coordinator()
.setErrorCode(Errors.NOT_COORDINATOR.code())
))
@@ -1696,7 +1694,7 @@ class PersisterStateManagerTest {
&& ((FindCoordinatorRequest) body).data().coordinatorKeys().get(0).equals(coordinatorKey),
new FindCoordinatorResponse(
new FindCoordinatorResponseData()
- .setCoordinators(Collections.singletonList(
+ .setCoordinators(List.of(
new FindCoordinatorResponseData.Coordinator()
.setNodeId(1)
.setHost(HOST)
@@ -1716,17 +1714,17 @@ class PersisterStateManagerTest {
return requestGroupId.equals(groupId) && requestTopicId == topicId && requestPartition == partition;
}, new ReadShareGroupStateResponse(
new ReadShareGroupStateResponseData()
- .setResults(Collections.singletonList(
+ .setResults(List.of(
new ReadShareGroupStateResponseData.ReadStateResult()
.setTopicId(topicId)
- .setPartitions(Collections.singletonList(
+ .setPartitions(List.of(
new ReadShareGroupStateResponseData.PartitionResult()
.setPartition(partition)
.setErrorCode(Errors.NONE.code())
.setErrorMessage("")
.setStateEpoch(1)
.setStartOffset(0)
- .setStateBatches(Collections.emptyList())
+ .setStateBatches(List.of())
))
))
), coordinatorNode);
@@ -1800,7 +1798,7 @@ class PersisterStateManagerTest {
&& ((FindCoordinatorRequest) body).data().coordinatorKeys().get(0).equals(coordinatorKey),
new FindCoordinatorResponse(
new FindCoordinatorResponseData()
- .setCoordinators(Collections.singletonList(
+ .setCoordinators(List.of(
new FindCoordinatorResponseData.Coordinator()
.setErrorCode(Errors.NOT_COORDINATOR.code())
))
@@ -1813,7 +1811,7 @@ class PersisterStateManagerTest {
&& ((FindCoordinatorRequest) body).data().coordinatorKeys().get(0).equals(coordinatorKey),
new FindCoordinatorResponse(
new FindCoordinatorResponseData()
- .setCoordinators(Collections.singletonList(
+ .setCoordinators(List.of(
new FindCoordinatorResponseData.Coordinator()
.setNodeId(1)
.setHost(HOST)
@@ -1833,17 +1831,17 @@ class PersisterStateManagerTest {
return requestGroupId.equals(groupId) && requestTopicId == topicId && requestPartition == partition;
}, new ReadShareGroupStateResponse(
new ReadShareGroupStateResponseData()
- .setResults(Collections.singletonList(
+ .setResults(List.of(
new ReadShareGroupStateResponseData.ReadStateResult()
.setTopicId(topicId)
- .setPartitions(Collections.singletonList(
+ .setPartitions(List.of(
new ReadShareGroupStateResponseData.PartitionResult()
.setPartition(partition)
.setErrorCode(Errors.NONE.code())
.setErrorMessage("")
.setStateEpoch(1)
.setStartOffset(0)
- .setStateBatches(Collections.emptyList())
+ .setStateBatches(List.of())
))
))
), coordinatorNode);
@@ -1924,17 +1922,17 @@ class PersisterStateManagerTest {
return requestGroupId.equals(groupId) && requestTopicId == topicId && requestPartition == partition;
}, new ReadShareGroupStateResponse(
new ReadShareGroupStateResponseData()
- .setResults(Collections.singletonList(
+ .setResults(List.of(
new ReadShareGroupStateResponseData.ReadStateResult()
.setTopicId(topicId)
- .setPartitions(Collections.singletonList(
+ .setPartitions(List.of(
new ReadShareGroupStateResponseData.PartitionResult()
.setPartition(partition)
.setErrorCode(Errors.NONE.code())
.setErrorMessage("")
.setStateEpoch(1)
.setStartOffset(0)
- .setStateBatches(Collections.emptyList())
+ .setStateBatches(List.of())
))
))
), coordinatorNode);
@@ -2016,17 +2014,17 @@ class PersisterStateManagerTest {
return requestGroupId.equals(groupId) && requestTopicId == topicId && requestPartition == partition;
}, new ReadShareGroupStateResponse(
new ReadShareGroupStateResponseData()
- .setResults(Collections.singletonList(
+ .setResults(List.of(
new ReadShareGroupStateResponseData.ReadStateResult()
.setTopicId(topicId)
- .setPartitions(Collections.singletonList(
+ .setPartitions(List.of(
new ReadShareGroupStateResponseData.PartitionResult()
.setPartition(partition)
.setErrorCode(Errors.COORDINATOR_NOT_AVAILABLE.code())
.setErrorMessage("")
.setStateEpoch(1)
.setStartOffset(0)
- .setStateBatches(Collections.emptyList())
+ .setStateBatches(List.of())
))
))
), coordinatorNode);
@@ -2040,17 +2038,17 @@ class PersisterStateManagerTest {
return requestGroupId.equals(groupId) && requestTopicId == topicId && requestPartition == partition;
}, new ReadShareGroupStateResponse(
new ReadShareGroupStateResponseData()
- .setResults(Collections.singletonList(
+ .setResults(List.of(
new ReadShareGroupStateResponseData.ReadStateResult()
.setTopicId(topicId)
- .setPartitions(Collections.singletonList(
+ .setPartitions(List.of(
new ReadShareGroupStateResponseData.PartitionResult()
.setPartition(partition)
.setErrorCode(Errors.NONE.code())
.setErrorMessage("")
.setStateEpoch(1)
.setStartOffset(0)
- .setStateBatches(Collections.emptyList())
+ .setStateBatches(List.of())
))
))
), coordinatorNode);
@@ -2132,17 +2130,17 @@ class PersisterStateManagerTest {
return requestGroupId.equals(groupId) && requestTopicId == topicId && requestPartition == partition;
}, new ReadShareGroupStateResponse(
new ReadShareGroupStateResponseData()
- .setResults(Collections.singletonList(
+ .setResults(List.of(
new ReadShareGroupStateResponseData.ReadStateResult()
.setTopicId(topicId)
- .setPartitions(Collections.singletonList(
+ .setPartitions(List.of(
new ReadShareGroupStateResponseData.PartitionResult()
.setPartition(partition)
.setErrorCode(Errors.COORDINATOR_NOT_AVAILABLE.code())
.setErrorMessage("")
.setStateEpoch(1)
.setStartOffset(0)
- .setStateBatches(Collections.emptyList())
+ .setStateBatches(List.of())
))
))
), coordinatorNode);
@@ -2156,17 +2154,17 @@ class PersisterStateManagerTest {
return requestGroupId.equals(groupId) && requestTopicId == topicId && requestPartition == partition;
}, new ReadShareGroupStateResponse(
new ReadShareGroupStateResponseData()
- .setResults(Collections.singletonList(
+ .setResults(List.of(
new ReadShareGroupStateResponseData.ReadStateResult()
.setTopicId(topicId)
- .setPartitions(Collections.singletonList(
+ .setPartitions(List.of(
new ReadShareGroupStateResponseData.PartitionResult()
.setPartition(partition)
.setErrorCode(Errors.COORDINATOR_LOAD_IN_PROGRESS.code())
.setErrorMessage("")
.setStateEpoch(1)
.setStartOffset(0)
- .setStateBatches(Collections.emptyList())
+ .setStateBatches(List.of())
))
))
), coordinatorNode);
@@ -3015,7 +3013,7 @@ class PersisterStateManagerTest {
&& ((FindCoordinatorRequest) body).data().coordinatorKeys().get(0).equals(coordinatorKey),
new FindCoordinatorResponse(
new FindCoordinatorResponseData()
- .setCoordinators(Collections.singletonList(
+ .setCoordinators(List.of(
new FindCoordinatorResponseData.Coordinator()
.setNodeId(1)
.setHost(HOST)
@@ -3118,7 +3116,7 @@ class PersisterStateManagerTest {
&& ((FindCoordinatorRequest) body).data().coordinatorKeys().get(0).equals(coordinatorKey),
new FindCoordinatorResponse(
new FindCoordinatorResponseData()
- .setCoordinators(Collections.singletonList(
+ .setCoordinators(List.of(
new FindCoordinatorResponseData.Coordinator()
.setErrorCode(Errors.NOT_COORDINATOR.code())
))
@@ -3131,7 +3129,7 @@ class PersisterStateManagerTest {
&& ((FindCoordinatorRequest) body).data().coordinatorKeys().get(0).equals(coordinatorKey),
new FindCoordinatorResponse(
new FindCoordinatorResponseData()
- .setCoordinators(Collections.singletonList(
+ .setCoordinators(List.of(
new FindCoordinatorResponseData.Coordinator()
.setNodeId(1)
.setHost(HOST)
@@ -3230,7 +3228,7 @@ class PersisterStateManagerTest {
&& ((FindCoordinatorRequest) body).data().coordinatorKeys().get(0).equals(coordinatorKey),
new FindCoordinatorResponse(
new FindCoordinatorResponseData()
- .setCoordinators(Collections.singletonList(
+ .setCoordinators(List.of(
new FindCoordinatorResponseData.Coordinator()
.setErrorCode(Errors.COORDINATOR_NOT_AVAILABLE.code())
))
@@ -3243,7 +3241,7 @@ class PersisterStateManagerTest {
&& ((FindCoordinatorRequest) body).data().coordinatorKeys().get(0).equals(coordinatorKey),
new FindCoordinatorResponse(
new FindCoordinatorResponseData()
- .setCoordinators(Collections.singletonList(
+ .setCoordinators(List.of(
new FindCoordinatorResponseData.Coordinator()
.setNodeId(1)
.setHost(HOST)
@@ -3739,7 +3737,7 @@ class PersisterStateManagerTest {
&& ((FindCoordinatorRequest) body).data().coordinatorKeys().get(0).equals(coordinatorKey),
new FindCoordinatorResponse(
new FindCoordinatorResponseData()
- .setCoordinators(Collections.singletonList(
+ .setCoordinators(List.of(
new FindCoordinatorResponseData.Coordinator()
.setNodeId(1)
.setHost(HOST)
@@ -3846,7 +3844,7 @@ class PersisterStateManagerTest {
&& ((FindCoordinatorRequest) body).data().coordinatorKeys().get(0).equals(coordinatorKey),
new FindCoordinatorResponse(
new FindCoordinatorResponseData()
- .setCoordinators(Collections.singletonList(
+ .setCoordinators(List.of(
new FindCoordinatorResponseData.Coordinator()
.setErrorCode(Errors.NOT_COORDINATOR.code())
))
@@ -3859,7 +3857,7 @@ class PersisterStateManagerTest {
&& ((FindCoordinatorRequest) body).data().coordinatorKeys().get(0).equals(coordinatorKey),
new FindCoordinatorResponse(
new FindCoordinatorResponseData()
- .setCoordinators(Collections.singletonList(
+ .setCoordinators(List.of(
new FindCoordinatorResponseData.Coordinator()
.setNodeId(1)
.setHost(HOST)
@@ -3962,7 +3960,7 @@ class PersisterStateManagerTest {
&& ((FindCoordinatorRequest) body).data().coordinatorKeys().get(0).equals(coordinatorKey),
new FindCoordinatorResponse(
new FindCoordinatorResponseData()
- .setCoordinators(Collections.singletonList(
+ .setCoordinators(List.of(
new FindCoordinatorResponseData.Coordinator()
.setErrorCode(Errors.COORDINATOR_NOT_AVAILABLE.code())
))
@@ -3975,7 +3973,7 @@ class PersisterStateManagerTest {
&& ((FindCoordinatorRequest) body).data().coordinatorKeys().get(0).equals(coordinatorKey),
new FindCoordinatorResponse(
new FindCoordinatorResponseData()
- .setCoordinators(Collections.singletonList(
+ .setCoordinators(List.of(
new FindCoordinatorResponseData.Coordinator()
.setNodeId(1)
.setHost(HOST)
diff --git a/server-common/src/test/java/org/apache/kafka/server/util/CommandLineUtilsTest.java b/server-common/src/test/java/org/apache/kafka/server/util/CommandLineUtilsTest.java
index db3326a4a4f..8fdc6c89d06 100644
--- a/server-common/src/test/java/org/apache/kafka/server/util/CommandLineUtilsTest.java
+++ b/server-common/src/test/java/org/apache/kafka/server/util/CommandLineUtilsTest.java
@@ -18,7 +18,6 @@ package org.apache.kafka.server.util;
import org.junit.jupiter.api.Test;
-import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import java.util.Properties;
@@ -34,21 +33,21 @@ import static org.junit.jupiter.api.Assertions.assertThrows;
public class CommandLineUtilsTest {
@Test
public void testParseEmptyArg() {
- List<String> argArray = Arrays.asList("my.empty.property=");
+ List<String> argArray = List.of("my.empty.property=");
assertThrows(IllegalArgumentException.class, () -> CommandLineUtils.parseKeyValueArgs(argArray, false));
}
@Test
public void testParseEmptyArgWithNoDelimiter() {
- List<String> argArray = Arrays.asList("my.empty.property");
+ List<String> argArray = List.of("my.empty.property");
assertThrows(IllegalArgumentException.class, () -> CommandLineUtils.parseKeyValueArgs(argArray, false));
}
@Test
public void testParseEmptyArgAsValid() {
- List<String> argArray = Arrays.asList("my.empty.property=", "my.empty.property1");
+ List<String> argArray = List.of("my.empty.property=", "my.empty.property1");
Properties props = CommandLineUtils.parseKeyValueArgs(argArray);
assertEquals(props.getProperty("my.empty.property"), "", "Value of a key with missing value should be an empty string");
@@ -57,7 +56,7 @@ public class CommandLineUtilsTest {
@Test
public void testParseSingleArg() {
- List<String> argArray = Arrays.asList("my.property=value");
+ List<String> argArray = List.of("my.property=value");
Properties props = CommandLineUtils.parseKeyValueArgs(argArray);
assertEquals(props.getProperty("my.property"), "value", "Value of a single property should be 'value'");
@@ -65,7 +64,7 @@ public class CommandLineUtilsTest {
@Test
public void testParseArgs() {
- List<String> argArray = Arrays.asList("first.property=first", "second.property=second");
+ List<String> argArray = List.of("first.property=first", "second.property=second");
Properties props = CommandLineUtils.parseKeyValueArgs(argArray);
assertEquals(props.getProperty("first.property"), "first", "Value of first property should be 'first'");
@@ -74,7 +73,7 @@ public class CommandLineUtilsTest {
@Test
public void testParseArgsWithMultipleDelimiters() {
- List<String> argArray = Arrays.asList("first.property==first", "second.property=second=", "third.property=thi=rd");
+ List<String> argArray = List.of("first.property==first", "second.property=second=", "third.property=thi=rd");
Properties props = CommandLineUtils.parseKeyValueArgs(argArray);
assertEquals(props.getProperty("first.property"), "=first", "Value of first property should be '=first'");
diff --git a/server-common/src/test/java/org/apache/kafka/server/util/CsvTest.java b/server-common/src/test/java/org/apache/kafka/server/util/CsvTest.java
index 65334a607b2..303a2f327cf 100644
--- a/server-common/src/test/java/org/apache/kafka/server/util/CsvTest.java
+++ b/server-common/src/test/java/org/apache/kafka/server/util/CsvTest.java
@@ -18,8 +18,6 @@ package org.apache.kafka.server.util;
import org.junit.jupiter.api.Test;
-import java.util.Arrays;
-import java.util.Collections;
import java.util.List;
import java.util.Map;
@@ -30,7 +28,7 @@ public class CsvTest {
@Test
public void testCsvMap() {
Map<String, String> emptyMap = Csv.parseCsvMap("");
- assertEquals(Collections.emptyMap(), emptyMap);
+ assertEquals(Map.of(), emptyMap);
String kvPairsIpV6 = "a:b:c:v,a:b:c:v";
Map<String, String> ipv6Map = Csv.parseCsvMap(kvPairsIpV6);
@@ -62,12 +60,12 @@ public class CsvTest {
@Test
public void testCsvList() {
List<String> emptyList = Csv.parseCsvList("");
- assertEquals(Collections.emptyList(), emptyList);
+ assertEquals(List.of(), emptyList);
List<String> emptyListFromNullString = Csv.parseCsvList(null);
- assertEquals(Collections.emptyList(), emptyListFromNullString);
+ assertEquals(List.of(), emptyListFromNullString);
List<String> csvList = Csv.parseCsvList("a,b ,c, d,,e,");
- assertEquals(Arrays.asList("a", "b", "c", "d", "e"), csvList);
+ assertEquals(List.of("a", "b", "c", "d", "e"), csvList);
}
}
diff --git a/server-common/src/test/java/org/apache/kafka/server/util/InterBrokerSendThreadTest.java b/server-common/src/test/java/org/apache/kafka/server/util/InterBrokerSendThreadTest.java
index 1e89a2297eb..7aaa4c01d93 100644
--- a/server-common/src/test/java/org/apache/kafka/server/util/InterBrokerSendThreadTest.java
+++ b/server-common/src/test/java/org/apache/kafka/server/util/InterBrokerSendThreadTest.java
@@ -36,7 +36,7 @@ import org.mockito.ArgumentMatchers;
import java.io.IOException;
import java.util.ArrayDeque;
import java.util.Collection;
-import java.util.Collections;
+import java.util.List;
import java.util.Queue;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Consumer;
@@ -87,7 +87,7 @@ public class InterBrokerSendThreadTest {
@Override
public Collection<RequestAndCompletionHandler> generateRequests() {
- return queue.isEmpty() ? Collections.emptyList() : Collections.singletonList(queue.poll());
+ return queue.isEmpty() ? List.of() : List.of(queue.poll());
}
@Override
@@ -147,7 +147,7 @@ public class InterBrokerSendThreadTest {
final InterBrokerSendThread sendThread = new TestInterBrokerSendThread();
// poll is always called but there should be no further invocations on NetworkClient
- when(networkClient.poll(anyLong(), anyLong())).thenReturn(Collections.emptyList());
+ when(networkClient.poll(anyLong(), anyLong())).thenReturn(List.of());
sendThread.doWork();
@@ -179,7 +179,7 @@ public class InterBrokerSendThreadTest {
when(networkClient.ready(node, time.milliseconds())).thenReturn(true);
- when(networkClient.poll(anyLong(), anyLong())).thenReturn(Collections.emptyList());
+ when(networkClient.poll(anyLong(), anyLong())).thenReturn(List.of());
sendThread.enqueue(handler);
sendThread.doWork();
@@ -224,7 +224,7 @@ public class InterBrokerSendThreadTest {
when(networkClient.connectionDelay(any(), anyLong())).thenReturn(0L);
- when(networkClient.poll(anyLong(), anyLong())).thenReturn(Collections.emptyList());
+ when(networkClient.poll(anyLong(), anyLong())).thenReturn(List.of());
when(networkClient.connectionFailed(node)).thenReturn(true);
@@ -278,7 +278,7 @@ public class InterBrokerSendThreadTest {
when(networkClient.connectionDelay(any(), anyLong())).thenReturn(0L);
- when(networkClient.poll(anyLong(), anyLong())).thenReturn(Collections.emptyList());
+ when(networkClient.poll(anyLong(), anyLong())).thenReturn(List.of());
// rule out disconnects so the request stays for the expiry check
when(networkClient.connectionFailed(node)).thenReturn(false);
diff --git a/server-common/src/test/java/org/apache/kafka/server/util/JsonTest.java b/server-common/src/test/java/org/apache/kafka/server/util/JsonTest.java
index c8b2dc787f4..aa17fed9472 100644
--- a/server-common/src/test/java/org/apache/kafka/server/util/JsonTest.java
+++ b/server-common/src/test/java/org/apache/kafka/server/util/JsonTest.java
@@ -29,7 +29,6 @@ import org.junit.jupiter.api.Test;
import java.util.AbstractMap;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -114,7 +113,7 @@ public class JsonTest {
Map.Entry<String, JsonValue> entryA = new AbstractMap.SimpleEntry<>("a", parse("true"));
AbstractMap.SimpleEntry<String, JsonValue> entryB = new AbstractMap.SimpleEntry<>("b", parse("false"));
- List<Map.Entry<String, JsonValue>> expectedResult = Arrays.asList(entryA, entryB);
+ List<Map.Entry<String, JsonValue>> expectedResult = List.of(entryA, entryB);
assertEquals(expectedResult, results);
}
@@ -197,7 +196,7 @@ public class JsonTest {
@Test
public void testDecodeSeq() throws JsonMappingException {
DecodeJson<List<Double>> decodeJson = DecodeJson.decodeList(new DecodeJson.DecodeDouble());
- assertTo(Arrays.asList(4.0, 11.1, 44.5), decodeJson, jsonObject -> jsonObject.get("array").get());
+ assertTo(List.of(4.0, 11.1, 44.5), decodeJson, jsonObject -> jsonObject.get("array").get());
assertToFails(decodeJson, jsonObject -> jsonObject.get("string").get());
assertToFails(decodeJson, jsonObject -> jsonObject.get("object").get());
assertToFails(DecodeJson.decodeList(new DecodeJson.DecodeString()), jsonObject -> jsonObject.get("array").get());
diff --git a/server-common/src/test/java/org/apache/kafka/timeline/SnapshotRegistryTest.java b/server-common/src/test/java/org/apache/kafka/timeline/SnapshotRegistryTest.java
index dacc91fa931..3813511139a 100644
--- a/server-common/src/test/java/org/apache/kafka/timeline/SnapshotRegistryTest.java
+++ b/server-common/src/test/java/org/apache/kafka/timeline/SnapshotRegistryTest.java
@@ -23,7 +23,6 @@ import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Timeout;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
@@ -42,7 +41,7 @@ public class SnapshotRegistryTest {
private static void assertIteratorContains(Iterator<Snapshot> iter,
Snapshot... snapshots) {
- List<Snapshot> expected = Arrays.asList(snapshots);
+ List<Snapshot> expected = List.of(snapshots);
List<Snapshot> actual = new ArrayList<>();
while (iter.hasNext()) {
Snapshot snapshot = iter.next();
diff --git a/server-common/src/test/java/org/apache/kafka/timeline/SnapshottableHashTableTest.java b/server-common/src/test/java/org/apache/kafka/timeline/SnapshottableHashTableTest.java
index e731960d985..85e77c9d690 100644
--- a/server-common/src/test/java/org/apache/kafka/timeline/SnapshottableHashTableTest.java
+++ b/server-common/src/test/java/org/apache/kafka/timeline/SnapshottableHashTableTest.java
@@ -23,7 +23,6 @@ import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Timeout;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.IdentityHashMap;
import java.util.Iterator;
import java.util.List;
@@ -270,7 +269,7 @@ public class SnapshottableHashTableTest {
registry.reset();
- assertEquals(Collections.emptyList(), registry.epochsList());
+ assertEquals(List.of(), registry.epochsList());
// Check that the table is empty
assertIteratorYields(table.snapshottableIterator(Long.MAX_VALUE));
}
diff --git a/server-common/src/test/java/org/apache/kafka/timeline/TimelineHashMapTest.java b/server-common/src/test/java/org/apache/kafka/timeline/TimelineHashMapTest.java
index ca907eb22aa..77b4007e8d1 100644
--- a/server-common/src/test/java/org/apache/kafka/timeline/TimelineHashMapTest.java
+++ b/server-common/src/test/java/org/apache/kafka/timeline/TimelineHashMapTest.java
@@ -23,8 +23,6 @@ import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Timeout;
import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -64,8 +62,8 @@ public class TimelineHashMapTest {
TimelineHashMap<Integer, String> map = new TimelineHashMap<>(registry, 1);
map.put(123, "abc");
map.put(456, "def");
- assertTrue(iteratorToList(map.keySet().iterator()).containsAll(Arrays.asList(123, 456)));
- assertTrue(iteratorToList(map.values().iterator()).containsAll(Arrays.asList("abc", "def")));
+ assertTrue(iteratorToList(map.keySet().iterator()).containsAll(List.of(123, 456)));
+ assertTrue(iteratorToList(map.values().iterator()).containsAll(List.of("abc", "def")));
assertTrue(map.containsValue("abc"));
assertTrue(map.containsKey(456));
assertFalse(map.isEmpty());
@@ -76,7 +74,7 @@ public class TimelineHashMapTest {
snapshotValues.add(iter.next().getValue());
snapshotValues.add(iter.next().getValue());
assertFalse(iter.hasNext());
- assertTrue(snapshotValues.containsAll(Arrays.asList("abc", "def")));
+ assertTrue(snapshotValues.containsAll(List.of("abc", "def")));
assertFalse(map.isEmpty(2));
assertTrue(map.isEmpty());
}
@@ -96,7 +94,7 @@ public class TimelineHashMapTest {
assertNull(map.putIfAbsent(1, "xyz"));
assertEquals("xyz", map.putIfAbsent(1, "123"));
assertEquals("xyz", map.putIfAbsent(1, "ghi"));
- map.putAll(Collections.singletonMap(2, "b"));
+ map.putAll(Map.of(2, "b"));
assertTrue(map.containsKey(2));
assertEquals("xyz", map.remove(1));
assertEquals("b", map.remove(2));
diff --git a/server-common/src/test/java/org/apache/kafka/timeline/TimelineHashSetTest.java b/server-common/src/test/java/org/apache/kafka/timeline/TimelineHashSetTest.java
index 172462bef62..45a19e97074 100644
--- a/server-common/src/test/java/org/apache/kafka/timeline/TimelineHashSetTest.java
+++ b/server-common/src/test/java/org/apache/kafka/timeline/TimelineHashSetTest.java
@@ -22,7 +22,7 @@ import org.apache.kafka.common.utils.LogContext;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Timeout;
-import java.util.Arrays;
+import java.util.List;
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -58,13 +58,13 @@ public class TimelineHashSetTest {
set.add("b");
set.add("c");
set.add("d");
- assertTrue(set.retainAll(Arrays.asList("a", "b", "c")));
- assertFalse(set.retainAll(Arrays.asList("a", "b", "c")));
- assertFalse(set.removeAll(Arrays.asList("d")));
+ assertTrue(set.retainAll(List.of("a", "b", "c")));
+ assertFalse(set.retainAll(List.of("a", "b", "c")));
+ assertFalse(set.removeAll(List.of("d")));
registry.getOrCreateSnapshot(2);
- assertTrue(set.removeAll(Arrays.asList("c")));
- assertTrue(TimelineHashMapTest.iteratorToList(set.iterator(2)).containsAll(Arrays.asList("a", "b", "c")));
- assertTrue(TimelineHashMapTest.iteratorToList(set.iterator()).containsAll(Arrays.asList("a", "b")));
+ assertTrue(set.removeAll(List.of("c")));
+ assertTrue(TimelineHashMapTest.iteratorToList(set.iterator(2)).containsAll(List.of("a", "b", "c")));
+ assertTrue(TimelineHashMapTest.iteratorToList(set.iterator()).containsAll(List.of("a", "b")));
assertEquals(2, set.size());
assertEquals(3, set.size(2));
set.clear();
@@ -90,17 +90,17 @@ public class TimelineHashSetTest {
assertFalse(set.add("xyz"));
assertTrue(set.remove("xyz"));
assertFalse(set.remove("xyz"));
- assertTrue(set.addAll(Arrays.asList("abc", "def", "ghi")));
- assertFalse(set.addAll(Arrays.asList("abc", "def", "ghi")));
- assertTrue(set.addAll(Arrays.asList("abc", "def", "ghi", "jkl")));
- assertTrue(set.containsAll(Arrays.asList("def", "jkl")));
- assertFalse(set.containsAll(Arrays.asList("abc", "def", "xyz")));
- assertTrue(set.removeAll(Arrays.asList("def", "ghi", "xyz")));
+ assertTrue(set.addAll(List.of("abc", "def", "ghi")));
+ assertFalse(set.addAll(List.of("abc", "def", "ghi")));
+ assertTrue(set.addAll(List.of("abc", "def", "ghi", "jkl")));
+ assertTrue(set.containsAll(List.of("def", "jkl")));
+ assertFalse(set.containsAll(List.of("abc", "def", "xyz")));
+ assertTrue(set.removeAll(List.of("def", "ghi", "xyz")));
registry.getOrCreateSnapshot(5);
- assertTrue(TimelineHashMapTest.iteratorToList(set.iterator(5)).containsAll(Arrays.asList("abc", "jkl")));
- assertTrue(TimelineHashMapTest.iteratorToList(set.iterator()).containsAll(Arrays.asList("abc", "jkl")));
+ assertTrue(TimelineHashMapTest.iteratorToList(set.iterator(5)).containsAll(List.of("abc", "jkl")));
+ assertTrue(TimelineHashMapTest.iteratorToList(set.iterator()).containsAll(List.of("abc", "jkl")));
set.removeIf(e -> e.startsWith("a"));
assertTrue(TimelineHashMapTest.iteratorToList(set.iterator()).contains("jkl"));
- assertTrue(TimelineHashMapTest.iteratorToList(set.iterator(5)).containsAll(Arrays.asList("abc", "jkl")));
+ assertTrue(TimelineHashMapTest.iteratorToList(set.iterator(5)).containsAll(List.of("abc", "jkl")));
}
}
diff --git a/server-common/src/test/java/org/apache/kafka/timeline/TimelineIntegerTest.java b/server-common/src/test/java/org/apache/kafka/timeline/TimelineIntegerTest.java
index 1a61b7dd359..1fbae1f6873 100644
--- a/server-common/src/test/java/org/apache/kafka/timeline/TimelineIntegerTest.java
+++ b/server-common/src/test/java/org/apache/kafka/timeline/TimelineIntegerTest.java
@@ -22,7 +22,7 @@ import org.apache.kafka.common.utils.LogContext;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Timeout;
-import java.util.Collections;
+import java.util.List;
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -85,7 +85,7 @@ public class TimelineIntegerTest {
registry.reset();
- assertEquals(Collections.emptyList(), registry.epochsList());
+ assertEquals(List.of(), registry.epochsList());
assertEquals(TimelineInteger.INIT, value.get());
}
}
diff --git a/server-common/src/test/java/org/apache/kafka/timeline/TimelineLongTest.java b/server-common/src/test/java/org/apache/kafka/timeline/TimelineLongTest.java
index c52bb5474cf..ed0a802cdd2 100644
--- a/server-common/src/test/java/org/apache/kafka/timeline/TimelineLongTest.java
+++ b/server-common/src/test/java/org/apache/kafka/timeline/TimelineLongTest.java
@@ -22,7 +22,7 @@ import org.apache.kafka.common.utils.LogContext;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Timeout;
-import java.util.Collections;
+import java.util.List;
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -85,7 +85,7 @@ public class TimelineLongTest {
registry.reset();
- assertEquals(Collections.emptyList(), registry.epochsList());
+ assertEquals(List.of(), registry.epochsList());
assertEquals(TimelineLong.INIT, value.get());
}
}
diff --git a/server-common/src/test/java/org/apache/kafka/timeline/TimelineObjectTest.java b/server-common/src/test/java/org/apache/kafka/timeline/TimelineObjectTest.java
index b17f5f056b0..cef72942c8a 100644
--- a/server-common/src/test/java/org/apache/kafka/timeline/TimelineObjectTest.java
+++ b/server-common/src/test/java/org/apache/kafka/timeline/TimelineObjectTest.java
@@ -22,7 +22,7 @@ import org.apache.kafka.common.utils.LogContext;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Timeout;
-import java.util.Collections;
+import java.util.List;
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -84,7 +84,7 @@ public class TimelineObjectTest {
registry.reset();
- assertEquals(Collections.emptyList(), registry.epochsList());
+ assertEquals(List.of(), registry.epochsList());
assertEquals("<default>", value.get());
}
}