This is an automated email from the ASF dual-hosted git repository.

nfilotto pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-spring-boot.git


The following commit(s) were added to refs/heads/main by this push:
     new 3d4a0ebbb68 camel-kafka - Properly define the after all method (#858)
3d4a0ebbb68 is described below

commit 3d4a0ebbb68792aa71c121a73a86e412f1a654c3
Author: Nicolas Filotto <[email protected]>
AuthorDate: Mon Jun 19 09:08:18 2023 +0200

    camel-kafka - Properly define the after all method (#858)
    
    ## Motivation
    
    The build fails due to some tests that must be fixed
    
    ## Modifications:
    
    * Makes the method annotated with `@AfterAll` static as expected by JUnit 
to prevent runtime error
    * Resets the mock endpoint after each test to better match with the context
---
 .../camel/component/kafka/integration/KafkaProducerFullIT.java     | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git 
a/components-starter/camel-kafka-starter/src/test/java/org/apache/camel/component/kafka/integration/KafkaProducerFullIT.java
 
b/components-starter/camel-kafka-starter/src/test/java/org/apache/camel/component/kafka/integration/KafkaProducerFullIT.java
index 43803d9a723..04a884de53e 100644
--- 
a/components-starter/camel-kafka-starter/src/test/java/org/apache/camel/component/kafka/integration/KafkaProducerFullIT.java
+++ 
b/components-starter/camel-kafka-starter/src/test/java/org/apache/camel/component/kafka/integration/KafkaProducerFullIT.java
@@ -47,6 +47,7 @@ import org.apache.kafka.clients.producer.RecordMetadata;
 import org.apache.kafka.common.header.Header;
 import org.apache.kafka.common.header.Headers;
 import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.BeforeAll;
 import org.junit.jupiter.api.Test;
@@ -128,7 +129,7 @@ public class KafkaProducerFullIT extends 
BaseEmbeddedKafkaTestSupport {
     }
 
     @AfterAll
-    public void after() {
+    public static void after() {
         // clean all test topics
         final List<String> topics = new ArrayList<>();
         topics.add(TOPIC_BYTES);
@@ -137,6 +138,10 @@ public class KafkaProducerFullIT extends 
BaseEmbeddedKafkaTestSupport {
         topics.add(TOPIC_STRINGS);
 
         kafkaAdminClient.deleteTopics(topics);
+    }
+
+    @AfterEach
+    public void reset() {
         mockEndpoint.reset();
     }
 

Reply via email to