camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r1190362 - /camel/trunk/camel-core/src/test/java/org/apache/camel/processor/onexception/OnExceptionMisconfiguredTest.java
Date Fri, 28 Oct 2011 14:36:32 GMT
Author: davsclaus
Date: Fri Oct 28 14:36:31 2011
New Revision: 1190362

URL: http://svn.apache.org/viewvc?rev=1190362&view=rev
Log:
Added test

Modified:
    camel/trunk/camel-core/src/test/java/org/apache/camel/processor/onexception/OnExceptionMisconfiguredTest.java

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/onexception/OnExceptionMisconfiguredTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/onexception/OnExceptionMisconfiguredTest.java?rev=1190362&r1=1190361&r2=1190362&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/processor/onexception/OnExceptionMisconfiguredTest.java
(original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/processor/onexception/OnExceptionMisconfiguredTest.java
Fri Oct 28 14:36:31 2011
@@ -16,6 +16,9 @@
  */
 package org.apache.camel.processor.onexception;
 
+import java.io.IOException;
+import javax.xml.soap.SOAPException;
+
 import org.apache.camel.ContextTestSupport;
 import org.apache.camel.FailedToCreateRouteException;
 import org.apache.camel.builder.RouteBuilder;
@@ -102,6 +105,25 @@ public class OnExceptionMisconfiguredTes
         }
     }
 
+    public void testOnExceptionMisconfigured5() throws Exception {
+        context.addRoutes(new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+
+                from("direct:start")
+                    .onException().end()
+                    .to("mock:result");
+            }
+        });
+        try {
+            context.start();
+            fail("Should have thrown exception");
+        } catch (FailedToCreateRouteException e) {
+            IllegalArgumentException iae = assertIsInstanceOf(IllegalArgumentException.class,
e.getCause());
+            assertTrue(iae.getMessage().startsWith("At least one exception must be configured"));
+        }
+    }
+
     public void testOnExceptionNotMisconfigured() throws Exception {
         context.addRoutes(new RouteBuilder() {
             @Override
@@ -154,4 +176,20 @@ public class OnExceptionMisconfiguredTes
         // okay
     }
 
+    public void testOnExceptionNotMisconfigured5() throws Exception {
+        context.addRoutes(new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("direct:start")
+                    .onException(SOAPException.class)
+                    .onException(IOException.class)
+                        .to("mock:error")
+                    .end()
+                    .to("mock:result");
+            }
+        });
+        context.start();
+        // okay
+    }
+
 }



Mime
View raw message