You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by or...@apache.org on 2024/04/16 12:59:57 UTC

(camel) 04/05: (chores) camel-core: separate setup from test execution

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

orpiske pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 672316de1c0a9502d6799fa85d86da41b4333e78
Author: Otavio Rodolfo Piske <an...@gmail.com>
AuthorDate: Mon Apr 15 17:50:01 2024 +0200

    (chores) camel-core: separate setup from test execution
---
 ...ListUseOriginalMessageEndpointExceptionIssueTest.java | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/core/camel-core/src/test/java/org/apache/camel/issues/RecipientListUseOriginalMessageEndpointExceptionIssueTest.java b/core/camel-core/src/test/java/org/apache/camel/issues/RecipientListUseOriginalMessageEndpointExceptionIssueTest.java
index 74f06eacff6..f1d2caa98c5 100644
--- a/core/camel-core/src/test/java/org/apache/camel/issues/RecipientListUseOriginalMessageEndpointExceptionIssueTest.java
+++ b/core/camel-core/src/test/java/org/apache/camel/issues/RecipientListUseOriginalMessageEndpointExceptionIssueTest.java
@@ -20,8 +20,8 @@ import java.util.concurrent.TimeUnit;
 
 import org.apache.camel.ContextTestSupport;
 import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
+import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 
 /**
@@ -29,18 +29,18 @@ import org.junit.jupiter.api.Test;
  */
 public class RecipientListUseOriginalMessageEndpointExceptionIssueTest extends ContextTestSupport {
 
-    @Test
-    public void testRecipientListUseOriginalMessageIssue() throws Exception {
-        getMockEndpoint("mock:throwException").whenAnyExchangeReceived(new Processor() {
-            @Override
-            public void process(Exchange exchange) throws Exception {
-                throw new Exception("Exception raised");
-            }
+    @BeforeEach
+    void setupMocks() {
+        getMockEndpoint("mock:throwException").whenAnyExchangeReceived(exchange -> {
+            throw new Exception("Exception raised");
         });
         getMockEndpoint("mock:error").expectedMinimumMessageCount(1);
         getMockEndpoint("mock:error").expectedFileExists(
                 testFile("outbox/hello.txt"), "A");
+    }
 
+    @Test
+    public void testRecipientListUseOriginalMessageIssue() throws Exception {
         template.sendBodyAndHeader(fileUri("inbox"), "A",
                 Exchange.FILE_NAME, "hello.txt");