camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bvah...@apache.org
Subject svn commit: r1237150 - in /camel/branches/camel-2.9.x/components/camel-jaxb: ./ src/test/java/org/apache/camel/jaxb/FallbackTypeConverterShouldNotThrowExceptionTest.java
Date Sat, 28 Jan 2012 19:56:05 GMT
Author: bvahdat
Date: Sat Jan 28 19:56:05 2012
New Revision: 1237150

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

Modified:
    camel/branches/camel-2.9.x/components/camel-jaxb/   (props changed)
    camel/branches/camel-2.9.x/components/camel-jaxb/src/test/java/org/apache/camel/jaxb/FallbackTypeConverterShouldNotThrowExceptionTest.java

Propchange: camel/branches/camel-2.9.x/components/camel-jaxb/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Jan 28 19:56:05 2012
@@ -1 +1 @@
-/camel/trunk/components/camel-jaxb:1235643,1236403-1236663,1236667
+/camel/trunk/components/camel-jaxb:1235643,1236403-1236663,1236667,1237148

Modified: camel/branches/camel-2.9.x/components/camel-jaxb/src/test/java/org/apache/camel/jaxb/FallbackTypeConverterShouldNotThrowExceptionTest.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/components/camel-jaxb/src/test/java/org/apache/camel/jaxb/FallbackTypeConverterShouldNotThrowExceptionTest.java?rev=1237150&r1=1237149&r2=1237150&view=diff
==============================================================================
--- camel/branches/camel-2.9.x/components/camel-jaxb/src/test/java/org/apache/camel/jaxb/FallbackTypeConverterShouldNotThrowExceptionTest.java
(original)
+++ camel/branches/camel-2.9.x/components/camel-jaxb/src/test/java/org/apache/camel/jaxb/FallbackTypeConverterShouldNotThrowExceptionTest.java
Sat Jan 28 19:56:05 2012
@@ -31,30 +31,33 @@ public class FallbackTypeConverterShould
 
     @Test
     public void testJaxbModel() throws InterruptedException {
-        getMockEndpoint("mock:a").expectedMessageCount(1);
-        getMockEndpoint("mock:b").expectedMessageCount(1);
+        Object foo = new Foo();
+        getMockEndpoint("mock:a").expectedBodiesReceived(foo);
+        getMockEndpoint("mock:b").expectedBodiesReceived(foo);
 
-        template.sendBody("direct:a", new Foo());
+        template.sendBody("direct:a", foo);
 
         assertMockEndpointsSatisfied();
     }
 
     @Test
     public void testNoneJaxbModel() throws InterruptedException {
-        getMockEndpoint("mock:a").expectedMessageCount(1);
-        getMockEndpoint("mock:b").expectedMessageCount(1);
+        Object camel = "Camel";
+        getMockEndpoint("mock:a").expectedBodiesReceived(camel);
+        getMockEndpoint("mock:b").expectedBodiesReceived(camel);
 
-        template.sendBody("direct:a", "Camel");
+        template.sendBody("direct:a", camel);
 
         assertMockEndpointsSatisfied();
     }
 
     @Test
     public void testAnotherJaxbModel() throws InterruptedException {
-        getMockEndpoint("mock:a").expectedMessageCount(1);
-        getMockEndpoint("mock:b").expectedMessageCount(1);
+        Object bar = new Bar();
+        getMockEndpoint("mock:a").expectedBodiesReceived(bar);
+        getMockEndpoint("mock:b").expectedBodiesReceived(bar);
 
-        template.sendBody("direct:a", new Bar());
+        template.sendBody("direct:a", bar);
 
         assertMockEndpointsSatisfied();
     }
@@ -62,18 +65,33 @@ public class FallbackTypeConverterShould
     @Override
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder(context) {
+
             @Override
             public void configure() throws Exception {
                 from("direct:a").process(new Processor() {
+
+                    @Override
                     public void process(Exchange exchange) throws Exception {
-                        exchange.getIn().getBody(Foo.class);
+                        // should return null and not throw any exception if the conversion
fails
+                        Foo foo = exchange.getIn().getBody(Foo.class);
+                        if (!(exchange.getIn().getBody() instanceof Foo)) {
+                            assertNull("Failed conversion didn't return null", foo);
+                        }
                     }
+
                 }).to("mock:a").process(new Processor() {
+
+                    @Override
                     public void process(Exchange exchange) throws Exception {
-                        exchange.getIn().getBody(List.class);
+                        // should return null and not throw any exception if the conversion
fails
+                        List<?> list = exchange.getIn().getBody(List.class);
+                        assertNull("Failed conversion didn't return null", list);
                     }
+
                 }).to("mock:b");
             }
+
         };
     }
+
 }
\ No newline at end of file



Mime
View raw message