see-quick commented on code in PR #14211:
URL: https://github.com/apache/kafka/pull/14211#discussion_r1301064046


##########
clients/src/test/java/org/apache/kafka/clients/producer/KafkaProducerTest.java:
##########
@@ -2399,4 +2400,39 @@ public KafkaProducer<T, T> newKafkaProducer() {
         }
     }
 
+    @Test
+    void testSerializerMustNoBeANull() {
+        final Map<String, Object> configs = new HashMap<>();
+        configs.put(ProducerConfig.CLIENT_ID_CONFIG, 
"testSerializerMustNoBeANull");
+        configs.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, "localhost:9999");
+
+        // Invalid value null for configuration key.serializer: must be 
non-null.
+        assertThrows(ConfigException.class, () -> new KafkaProducer<String, 
String>(configs));
+    }
+
+    @Test
+    void testDeliveryTimeoutAndLingerMsConfig() {
+        final Map<String, Object> configs = new HashMap<>();
+        configs.put(ProducerConfig.CLIENT_ID_CONFIG, 
"testDeliveryTimeoutAndLingerMsConfig");
+        configs.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, "localhost:9999");
+        configs.put(ProducerConfig.DELIVERY_TIMEOUT_MS_CONFIG, 1000);
+        configs.put(ProducerConfig.LINGER_MS_CONFIG, 1000);
+        configs.put(ProducerConfig.REQUEST_TIMEOUT_MS_CONFIG, 1);
+
+        // delivery.timeout.ms should be equal to or larger than linger.ms + 
request.timeout.ms
+        assertThrows(KafkaException.class, () -> new KafkaProducer<>(configs, 
new StringSerializer(), new StringSerializer()));
+
+        configs.put(ProducerConfig.DELIVERY_TIMEOUT_MS_CONFIG, 1000);
+        configs.put(ProducerConfig.LINGER_MS_CONFIG, 999);
+        configs.put(ProducerConfig.REQUEST_TIMEOUT_MS_CONFIG, 1);
+
+        assertDoesNotThrow(() -> new KafkaProducer<>(configs, new 
StringSerializer(), new StringSerializer()));
+
+        configs.put(ProducerConfig.DELIVERY_TIMEOUT_MS_CONFIG, 3000);

Review Comment:
   This is some leftover...I just wanted to cover two scenarios:
   1. \> sign, which throws expectation
   ```java
   configs.put(ProducerConfig.DELIVERY_TIMEOUT_MS_CONFIG, 1000);
   configs.put(ProducerConfig.LINGER_MS_CONFIG, 1000);
   configs.put(ProducerConfig.REQUEST_TIMEOUT_MS_CONFIG, 1);
   ```
   2. and equality sign 
   ```java
   configs.put(ProducerConfig.DELIVERY_TIMEOUT_MS_CONFIG, 1000);
   configs.put(ProducerConfig.LINGER_MS_CONFIG, 999);
   configs.put(ProducerConfig.REQUEST_TIMEOUT_MS_CONFIG, 1);
   ```
   I have modified the code, now it should be correct.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to