You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2008/09/15 08:49:52 UTC

svn commit: r695355 - /activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/ExceptionHandlerTest.scala

Author: ningjiang
Date: Sun Sep 14 23:49:50 2008
New Revision: 695355

URL: http://svn.apache.org/viewvc?rev=695355&view=rev
Log:
CAMEL-885 add a try catch in the ExceptionHandlerTest because the exception will be thrown from the ProducerTemplate

Modified:
    activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/ExceptionHandlerTest.scala

Modified: activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/ExceptionHandlerTest.scala
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/ExceptionHandlerTest.scala?rev=695355&r1=695354&r2=695355&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/ExceptionHandlerTest.scala (original)
+++ activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/ExceptionHandlerTest.scala Sun Sep 14 23:49:50 2008
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 package org.apache.camel.scala.dsl;
- 
+
 import org.w3c.dom.Document
 import scala.dsl.builder.RouteBuilder
 import junit.framework.Assert._
@@ -24,18 +24,20 @@
  * Test case for exception handler
  */
 class ExceptionHandlerTest extends ScalaTestSupport {
-  
+
   var handled = false;
-  
+
   def testTryCatchFinally = {
     "mock:a" expect { _.count = 1 }
     "mock:b" expect { _.count = 1 }
     "mock:c" expect { _.count = 1 }
-    test {
-       "direct:a" ! ("any given message", 'Symbol, 256) 
-    }
+    try {
+      test {
+       "direct:a" ! ("any given message", 'Symbol, 256)
+      }
+    }catch { case _ => System.out.println("get the exception here")}
   }
-    
+
   val builder =
     new RouteBuilder {
        def failingProcessor(exchange: Exchange) = {
@@ -45,27 +47,27 @@
            case _ => throw new RuntimeException("Strings are good, the rest is bad")
          }
        }
-       
+
        def catchProcessor(exchange: Exchange) = {
           // we shouldn't get any Strings here
           assertFalse(exchange.getIn().getBody().getClass().equals(classOf[String]))
           // the exchange shouldn't have been marked failed
           assertFalse(exchange.isFailed)
        }
-       
+
        //START SNIPPET: simple
        handle[UnsupportedOperationException] { to ("mock:c") }
        //END SNIPPET: simple
-       
+
        //START SNIPPET: block
        handle[RuntimeException] {
            process(catchProcessor)
            to ("mock:b")
        }
        //END SNIPPET: block
-       
+
        "direct:a" process(failingProcessor) to ("mock:a")
-       
+
     }
 
 }