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

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


The following commit(s) were added to refs/heads/master by this push:
     new 44756ad  CAMEL-12389: Lets throw an exception as the WARN log is maybe 
not noticed by the developer so easily, and it really dont work that well for 
Spring Boot testing.
44756ad is described below

commit 44756adda45911227fdd043696cf25d465eae256
Author: Claus Ibsen <claus.ib...@gmail.com>
AuthorDate: Wed Mar 21 17:05:10 2018 +0100

    CAMEL-12389: Lets throw an exception as the WARN log is maybe not noticed 
by the developer so easily, and it really dont work that well for Spring Boot 
testing.
---
 components/camel-test-spring/pom.xml                           |  2 +-
 .../java/org/apache/camel/test/junit4/CamelTestSupport.java    | 10 +++++-----
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/components/camel-test-spring/pom.xml 
b/components/camel-test-spring/pom.xml
index 415bce6..3b6ad14 100644
--- a/components/camel-test-spring/pom.xml
+++ b/components/camel-test-spring/pom.xml
@@ -29,7 +29,7 @@
 
   <artifactId>camel-test-spring</artifactId>
   <packaging>jar</packaging>
-  <name>Camel :: Test :: Spring 4.1+</name>
+  <name>Camel :: Test :: Spring</name>
   <description>Camel unit testing with Spring</description>
 
   <properties>
diff --git 
a/components/camel-test/src/main/java/org/apache/camel/test/junit4/CamelTestSupport.java
 
b/components/camel-test/src/main/java/org/apache/camel/test/junit4/CamelTestSupport.java
index 85e9a92..3b5b53b 100644
--- 
a/components/camel-test/src/main/java/org/apache/camel/test/junit4/CamelTestSupport.java
+++ 
b/components/camel-test/src/main/java/org/apache/camel/test/junit4/CamelTestSupport.java
@@ -256,7 +256,7 @@ public abstract class CamelTestSupport extends TestSupport {
             // test is per class, so only setup once (the first time)
             boolean first = INIT.get() == null;
             if (first) {
-                doSpringBootWarning();
+                doSpringBootCheck();
                 doPreSetup();
                 doSetUp();
                 doPostSetup();
@@ -267,7 +267,7 @@ public abstract class CamelTestSupport extends TestSupport {
             }
         } else {
             // test is per test so always setup
-            doSpringBootWarning();
+            doSpringBootCheck();
             doPreSetup();
             doSetUp();
             doPostSetup();
@@ -292,13 +292,13 @@ public abstract class CamelTestSupport extends 
TestSupport {
     }
 
     /**
-     * Detects if this is a Spring-Boot test and reports a warning as these 
base classes is not intended
+     * Detects if this is a Spring-Boot test and throws an exception, as these 
base classes is not intended
      * for testing Camel on Spring Boot.
      */
-    protected void doSpringBootWarning() {
+    protected void doSpringBootCheck() {
         boolean springBoot = 
hasClassAnnotation("org.springframework.boot.test.context.SpringBootTest");
         if (springBoot) {
-            log.warn("Spring Boot detected: The 
CamelTestSupport/CamelSpringTestSupport class is not intended for Camel testing 
with Spring Boot."
+            throw new RuntimeException("Spring Boot detected: The 
CamelTestSupport/CamelSpringTestSupport class is not intended for Camel testing 
with Spring Boot."
                 + " Prefer to not extend this class, but use 
@RunWith(CamelSpringBootRunner.class) instead.");
         }
     }

-- 
To stop receiving notification emails like this one, please contact
davscl...@apache.org.

Reply via email to