camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bvah...@apache.org
Subject svn commit: r1436487 - in /camel/trunk/camel-core/src/test/java/org/apache/camel: issues/CacheInputStreamInDeadLetterIssue520Test.java processor/ValidationTest.java
Date Mon, 21 Jan 2013 17:02:22 GMT
Author: bvahdat
Date: Mon Jan 21 17:02:22 2013
New Revision: 1436487

URL: http://svn.apache.org/viewvc?rev=1436487&view=rev
Log:
CAMEL-5983: Avoid the negative-tests to behave as false-positive. Work still in progress.

Modified:
    camel/trunk/camel-core/src/test/java/org/apache/camel/issues/CacheInputStreamInDeadLetterIssue520Test.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ValidationTest.java

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/issues/CacheInputStreamInDeadLetterIssue520Test.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/issues/CacheInputStreamInDeadLetterIssue520Test.java?rev=1436487&r1=1436486&r2=1436487&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/issues/CacheInputStreamInDeadLetterIssue520Test.java
(original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/issues/CacheInputStreamInDeadLetterIssue520Test.java
Mon Jan 21 17:02:22 2013
@@ -25,7 +25,6 @@ import javax.xml.transform.stream.Stream
 import org.apache.camel.ContextTestSupport;
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
-import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
 
@@ -52,13 +51,10 @@ public class CacheInputStreamInDeadLette
         MockEndpoint mock = getMockEndpoint("mock:error");
         mock.expectedMessageCount(1);
 
-        try {
-            template.sendBody("direct:start", message);
-        } catch (RuntimeCamelException e) {
-            assertTrue(e.getCause() instanceof Exception);
-            assertEquals("Forced exception by unit test", e.getCause().getMessage());
-        }
-        
+        // having dead letter channel as the errorHandler in place makes exchanges to appear
as completed from
+        // the client point of view so that we don't count with any thrown exception here
(the client side)
+        template.sendBody("direct:start", message);
+
         assertEquals("The message should be delivered 4 times", count, 4);
         mock.assertIsSatisfied();
     }

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ValidationTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ValidationTest.java?rev=1436487&r1=1436486&r2=1436487&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ValidationTest.java (original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ValidationTest.java Mon
Jan 21 17:02:22 2013
@@ -38,19 +38,22 @@ public class ValidationTest extends Cont
         invalidEndpoint.expectedMessageCount(0);
 
         Object result = template.requestBodyAndHeader("direct:start", "<valid/>", "foo",
"bar");
+        assertEquals("validResult", result);
 
         assertMockEndpointsSatisfied();
-        assertEquals("validResult", result);
     }
 
     public void testInvalidMessage() throws Exception {
-        invalidEndpoint.expectedMessageCount(1);
         validEndpoint.expectedMessageCount(0);
+        invalidEndpoint.expectedMessageCount(1);
 
         try {
             template.sendBodyAndHeader("direct:start", "<invalid/>", "foo", "notMatchedHeaderValue");
         } catch (RuntimeCamelException e) {
-            // expected
+            // the expected empty catch block here is not intended for this class itself
but the drived
+            // ones e.g. ValidationWithErrorInHandleAndFinallyBlockTest where noErrorHandler()
is being
+            // installed. this's also why there's no fail("Should have thrown an exception")
call here
+            // right after template.sendBodyAndHeader()
         }
 
         assertMockEndpointsSatisfied();
@@ -63,7 +66,7 @@ public class ValidationTest extends Cont
         try {
             template.sendBodyAndHeader("direct:start", "<invalid/>", "foo",  "notMatchedHeaderValue");
         } catch (RuntimeCamelException e) {
-            // expected
+            // the same as above
         }
 
         Object result = template.requestBodyAndHeader("direct:start", "<valid/>", "foo",
  "bar");



Mime
View raw message