From ea77352dfc0e8adf860c0f31dc4b53bf36f95b4b Mon Sep 17 00:00:00 2001 From: Pramithas Dhakal Date: Tue, 14 Jan 2025 23:45:27 +0545 Subject: [PATCH] Rename the variable to reflect its purpose (#18525) Reviewers: Andrew Schofield --- .../clients/producer/KafkaProducerTest.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/clients/src/test/java/org/apache/kafka/clients/producer/KafkaProducerTest.java b/clients/src/test/java/org/apache/kafka/clients/producer/KafkaProducerTest.java index 2bd111da16c35..080a0fdb73f19 100644 --- a/clients/src/test/java/org/apache/kafka/clients/producer/KafkaProducerTest.java +++ b/clients/src/test/java/org/apache/kafka/clients/producer/KafkaProducerTest.java @@ -421,16 +421,16 @@ public void testInflightRequestsAndIdempotenceForIdempotentProducers() { config.getInt(ProducerConfig.MAX_IN_FLIGHT_REQUESTS_PER_CONNECTION), "max.in.flight.requests.per.connection should be overwritten"); - Properties validProps2 = new Properties() {{ + Properties invalidProps1 = new Properties() {{ putAll(baseProps); setProperty(ProducerConfig.MAX_IN_FLIGHT_REQUESTS_PER_CONNECTION, "6"); }}; - ConfigException configException = assertThrows(ConfigException.class, () -> new ProducerConfig(validProps2)); + ConfigException configException = assertThrows(ConfigException.class, () -> new ProducerConfig(invalidProps1)); assertEquals("To use the idempotent producer, " + ProducerConfig.MAX_IN_FLIGHT_REQUESTS_PER_CONNECTION + " must be set to at most 5. Current value is 6.", configException.getMessage()); - Properties invalidProps = new Properties() {{ + Properties invalidProps2 = new Properties() {{ putAll(baseProps); setProperty(ProducerConfig.MAX_IN_FLIGHT_REQUESTS_PER_CONNECTION, "5"); setProperty(ProducerConfig.ENABLE_IDEMPOTENCE_CONFIG, "false"); @@ -438,10 +438,10 @@ public void testInflightRequestsAndIdempotenceForIdempotentProducers() { }}; assertThrows( ConfigException.class, - () -> new ProducerConfig(invalidProps), + () -> new ProducerConfig(invalidProps2), "Cannot set a transactional.id without also enabling idempotence"); - Properties invalidProps2 = new Properties() {{ + Properties invalidProps3 = new Properties() {{ putAll(baseProps); setProperty(ProducerConfig.MAX_IN_FLIGHT_REQUESTS_PER_CONNECTION, "6"); // explicitly enabling idempotence should still throw exception @@ -449,17 +449,17 @@ public void testInflightRequestsAndIdempotenceForIdempotentProducers() { }}; assertThrows( ConfigException.class, - () -> new ProducerConfig(invalidProps2), + () -> new ProducerConfig(invalidProps3), "Must set max.in.flight.requests.per.connection to at most 5 when using the idempotent producer."); - Properties invalidProps3 = new Properties() {{ + Properties invalidProps4 = new Properties() {{ putAll(baseProps); setProperty(ProducerConfig.MAX_IN_FLIGHT_REQUESTS_PER_CONNECTION, "6"); setProperty(ProducerConfig.TRANSACTIONAL_ID_CONFIG, "transactionalId"); }}; assertThrows( ConfigException.class, - () -> new ProducerConfig(invalidProps3), + () -> new ProducerConfig(invalidProps4), "Must set retries to non-zero when using the idempotent producer."); }