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 17:07:50 UTC
svn commit: r1436440 - in /camel/branches/camel-2.10.x: ./
camel-core/src/test/java/org/apache/camel/language/BeanTest.java
camel-core/src/test/java/org/apache/camel/processor/BeanWithExceptionTest.java
Author: bvahdat
Date: Mon Jan 21 16:07:50 2013
New Revision: 1436440
URL: http://svn.apache.org/viewvc?rev=1436440&view=rev
Log:
Merged revisions 1436438 via svnmerge from
https://svn.apache.org/repos/asf/camel/trunk
........
r1436438 | bvahdat | 2013-01-21 17:05:43 +0100 (Mo, 21 Jan 2013) | 1 line
CAMEL-5983: Avoid the negative-tests to behave as false-positive.
........
Modified:
camel/branches/camel-2.10.x/ (props changed)
camel/branches/camel-2.10.x/camel-core/src/test/java/org/apache/camel/language/BeanTest.java
camel/branches/camel-2.10.x/camel-core/src/test/java/org/apache/camel/processor/BeanWithExceptionTest.java
Propchange: camel/branches/camel-2.10.x/
------------------------------------------------------------------------------
Merged /camel/trunk:r1436438
Propchange: camel/branches/camel-2.10.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified: camel/branches/camel-2.10.x/camel-core/src/test/java/org/apache/camel/language/BeanTest.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/camel-core/src/test/java/org/apache/camel/language/BeanTest.java?rev=1436440&r1=1436439&r2=1436440&view=diff
==============================================================================
--- camel/branches/camel-2.10.x/camel-core/src/test/java/org/apache/camel/language/BeanTest.java (original)
+++ camel/branches/camel-2.10.x/camel-core/src/test/java/org/apache/camel/language/BeanTest.java Mon Jan 21 16:07:50 2013
@@ -73,6 +73,7 @@ public class BeanTest extends LanguageTe
Object result = exp.evaluate(exchange, Object.class);
assertNull(result);
+ assertNotNull(exchange.getException());
MethodNotFoundException e = assertIsInstanceOf(MethodNotFoundException.class, exchange.getException());
assertSame(user, e.getBean());
assertEquals("unknown", e.getMethodName());
@@ -84,6 +85,7 @@ public class BeanTest extends LanguageTe
Object result = exp.evaluate(exchange, Object.class);
assertNull(result);
+ assertNotNull(exchange.getException());
MethodNotFoundException e = assertIsInstanceOf(MethodNotFoundException.class, exchange.getException());
assertSame(context.getRegistry().lookup("foo"), e.getBean());
assertEquals("cake", e.getMethodName());
Modified: camel/branches/camel-2.10.x/camel-core/src/test/java/org/apache/camel/processor/BeanWithExceptionTest.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/camel-core/src/test/java/org/apache/camel/processor/BeanWithExceptionTest.java?rev=1436440&r1=1436439&r2=1436440&view=diff
==============================================================================
--- camel/branches/camel-2.10.x/camel-core/src/test/java/org/apache/camel/processor/BeanWithExceptionTest.java (original)
+++ camel/branches/camel-2.10.x/camel-core/src/test/java/org/apache/camel/processor/BeanWithExceptionTest.java Mon Jan 21 16:07:50 2013
@@ -34,12 +34,12 @@ import org.slf4j.LoggerFactory;
* @version
*/
public class BeanWithExceptionTest extends ContextTestSupport {
- protected Processor validator = new MyValidator();
protected MockEndpoint validEndpoint;
protected MockEndpoint invalidEndpoint;
public void testValidMessage() throws Exception {
validEndpoint.expectedMessageCount(1);
+ invalidEndpoint.expectedMessageCount(0);
template.send("direct:start", new Processor() {
public void process(Exchange exchange) throws Exception {
@@ -53,19 +53,20 @@ public class BeanWithExceptionTest exten
}
public void testInvalidMessage() throws Exception {
+ validEndpoint.expectedMessageCount(0);
invalidEndpoint.expectedMessageCount(1);
- try {
- template.send("direct:start", new Processor() {
- public void process(Exchange exchange) throws Exception {
- exchange.getIn().setBody("<invalid/>");
- exchange.getIn().setHeader("foo", "notMatchedHeaderValue");
- exchange.setProperty("cheese", "old");
- }
- });
- } catch (Exception e) {
- // expected
- }
+ Exchange exchange = template.send("direct:start", new Processor() {
+ public void process(Exchange exchange) throws Exception {
+ exchange.getIn().setBody("<invalid/>");
+ exchange.getIn().setHeader("foo", "notMatchedHeaderValue");
+ exchange.setProperty("cheese", "old");
+ }
+ });
+
+ assertNotNull(exchange.getException());
+ ValidationException exception = assertIsInstanceOf(ValidationException.class, exchange.getException());
+ assertEquals("Invalid header foo: notMatchedHeaderValue", exception.getMessage());
assertMockEndpointsSatisfied();
}