You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by bv...@apache.org on 2013/01/21 16:34:56 UTC
svn commit: r1436420 - in
/camel/trunk/camel-core/src/test/java/org/apache/camel:
issues/ExceptionTest.java language/BeanTest.java
Author: bvahdat
Date: Mon Jan 21 15:34:56 2013
New Revision: 1436420
URL: http://svn.apache.org/viewvc?rev=1436420&view=rev
Log:
CAMEL-5983: Avoid the negative-tests to behave as false-positive.
Modified:
camel/trunk/camel-core/src/test/java/org/apache/camel/issues/ExceptionTest.java
camel/trunk/camel-core/src/test/java/org/apache/camel/language/BeanTest.java
Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/issues/ExceptionTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/issues/ExceptionTest.java?rev=1436420&r1=1436419&r2=1436420&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/issues/ExceptionTest.java (original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/issues/ExceptionTest.java Mon Jan 21 15:34:56 2013
@@ -32,14 +32,14 @@ public class ExceptionTest extends Conte
MockEndpoint resultEndpoint = getMockEndpoint("mock:result");
MockEndpoint exceptionEndpoint = getMockEndpoint("mock:exception");
- errorEndpoint.expectedMessageCount(1);
- resultEndpoint.expectedMessageCount(0);
+ errorEndpoint.expectedBodiesReceived("<exception/>");
exceptionEndpoint.expectedMessageCount(0);
+ resultEndpoint.expectedMessageCount(0);
// we don't expect any thrown exception here as there's no onException clause defined for this test
- // so that the general purpose dead letter channel will come into the play here and then when all
- // the attempts of redelivery fail the exchange will be moved to "mock:error" and then from the client
- // point of view the exchange is completed.
+ // so that the general purpose dead letter channel will come into the play and then when all the attempts
+ // to redelivery fails the exchange will be moved to "mock:error" and then from the client point of
+ // view the exchange is completed.
template.sendBody("direct:start", "<body/>");
assertMockEndpointsSatisfied();
@@ -51,7 +51,7 @@ public class ExceptionTest extends Conte
MockEndpoint exceptionEndpoint = getMockEndpoint("mock:exception");
errorEndpoint.expectedMessageCount(0);
- exceptionEndpoint.expectedMessageCount(1);
+ exceptionEndpoint.expectedBodiesReceived("<exception/>");
resultEndpoint.expectedMessageCount(0);
try {
@@ -70,7 +70,7 @@ public class ExceptionTest extends Conte
MockEndpoint exceptionEndpoint = getMockEndpoint("mock:exception");
errorEndpoint.expectedMessageCount(0);
- exceptionEndpoint.expectedBodiesReceived("<handled/>");
+ exceptionEndpoint.expectedBodiesReceived("<not-handled/>");
resultEndpoint.expectedMessageCount(0);
try {
@@ -89,7 +89,7 @@ public class ExceptionTest extends Conte
MockEndpoint exceptionEndpoint = getMockEndpoint("mock:exception");
errorEndpoint.expectedMessageCount(0);
- exceptionEndpoint.expectedMessageCount(1);
+ exceptionEndpoint.expectedBodiesReceived("<exception/>");
resultEndpoint.expectedMessageCount(0);
try {
@@ -117,7 +117,7 @@ public class ExceptionTest extends Conte
if (getName().endsWith("WithLongHandler")) {
log.debug("Using long exception handler");
- onException(IllegalArgumentException.class).setBody(constant("<handled/>")).
+ onException(IllegalArgumentException.class).setBody(constant("<not-handled/>")).
to("mock:exception");
} else if (getName().endsWith("WithHandler")) {
log.debug("Using exception handler");
Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/language/BeanTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/language/BeanTest.java?rev=1436420&r1=1436419&r2=1436420&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/language/BeanTest.java (original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/language/BeanTest.java Mon Jan 21 15:34:56 2013
@@ -71,7 +71,8 @@ public class BeanTest extends LanguageTe
Expression exp = BeanLanguage.bean(user, "unknown");
Exchange exchange = createExchangeWithBody("Claus");
- exp.evaluate(exchange, Object.class);
+ Object result = exp.evaluate(exchange, Object.class);
+ assertNull(result);
MethodNotFoundException e = assertIsInstanceOf(MethodNotFoundException.class, exchange.getException());
assertSame(user, e.getBean());
assertEquals("unknown", e.getMethodName());
@@ -81,7 +82,8 @@ public class BeanTest extends LanguageTe
Expression exp = BeanLanguage.bean("foo.cake");
Exchange exchange = createExchangeWithBody("Claus");
- exp.evaluate(exchange, Object.class);
+ Object result = exp.evaluate(exchange, Object.class);
+ assertNull(result);
MethodNotFoundException e = assertIsInstanceOf(MethodNotFoundException.class, exchange.getException());
assertSame(context.getRegistry().lookup("foo"), e.getBean());
assertEquals("cake", e.getMethodName());