ashmeet-kandhari commented on code in PR #20991:
URL: https://github.com/apache/flink/pull/20991#discussion_r1047582360


##########
flink-connectors/flink-connector-kafka/src/test/java/org/apache/flink/streaming/connectors/kafka/FlinkKafkaInternalProducerITCase.java:
##########
@@ -148,62 +153,78 @@ public void testResumeTransaction() throws Exception {
         deleteTestTopic(topicName);
     }
 
-    @Test(timeout = 30000L, expected = IllegalStateException.class)
-    public void testPartitionsForAfterClosed() {
+    @Test
+    @Timeout(30L)
+    void testPartitionsForAfterClosed() {
         FlinkKafkaInternalProducer<String, String> kafkaProducer =
                 new FlinkKafkaInternalProducer<>(extraProperties);
         kafkaProducer.close(Duration.ofSeconds(5));
-        kafkaProducer.partitionsFor("Topic");
+        assertThatThrownBy(() -> kafkaProducer.partitionsFor("Topic"))
+                .isInstanceOf(IllegalStateException.class);
     }
 
-    @Test(timeout = 30000L, expected = IllegalStateException.class)
-    public void testInitTransactionsAfterClosed() {
+    @Test
+    @Timeout(30L)
+    void testInitTransactionsAfterClosed() {
         FlinkKafkaInternalProducer<String, String> kafkaProducer =
                 new FlinkKafkaInternalProducer<>(extraProperties);
         kafkaProducer.close(Duration.ofSeconds(5));
-        kafkaProducer.initTransactions();
+        assertThatThrownBy(kafkaProducer::initTransactions)
+                .isInstanceOf(IllegalStateException.class);
     }
 
-    @Test(timeout = 30000L, expected = IllegalStateException.class)
-    public void testBeginTransactionAfterClosed() {
+    @Test
+    @Timeout(30L)
+    void testBeginTransactionAfterClosed() {
         FlinkKafkaInternalProducer<String, String> kafkaProducer =
                 new FlinkKafkaInternalProducer<>(extraProperties);
         kafkaProducer.initTransactions();
         kafkaProducer.close(Duration.ofSeconds(5));
-        kafkaProducer.beginTransaction();
+        assertThatThrownBy(kafkaProducer::beginTransaction)
+                .isInstanceOf(IllegalStateException.class);
     }
 
-    @Test(timeout = 30000L, expected = IllegalStateException.class)
-    public void testCommitTransactionAfterClosed() {
+    @Test
+    @Timeout(30L)

Review Comment:
   By default it takes seconds, do we still need to specify?



-- 
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: issues-unsubscr...@flink.apache.org

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

Reply via email to