I tryed it this way, to mock my endpoint, but get a nullpointer exception.
Do i have to set up something somewhere else or ?
public class FilterTest extends CamelTestSupport {
String header =
"<root><name>abc</name><mainRegistrationNumber>20</mainRegistrationNumber><technicalAddress></technicalAddress></root>";
@EndpointInject(uri = "mock:result")
protected MockEndpoint resultEndpoint;
@Produce(uri = "direct:start")
protected ProducerTemplate template;
@Test public void testSendMatchingMessage() throws Exception {
String expectedBody = "<matched/>";
resultEndpoint.expectedBodiesReceived(expectedBody);
template.sendBodyAndHeader(expectedBody, "foo", "bar");
resultEndpoint.assertIsSatisfied();
}
@Override protected RouteBuilder createRouteBuilder() {
return new RouteBuilder() { public void configure() {
from("direct:start").bean(AddIpBean.class).to("mock:result");
}
};
}
}
org.apache.camel.spring.GenericBeansException: Error post processing bean:
this; nested exception is java.lang.NullPointerException
at
org.apache.camel.spring.CamelBeanPostProcessor.postProcessBeforeInitialization(CamelBeanPostProcessor.java:154)
at
org.apache.camel.test.CamelTestSupport.postProcessTest(CamelTestSupport.java:221)
at
org.apache.camel.test.CamelTestSupport.setUp(CamelTestSupport.java:140)
at junit.framework.TestCase.runBare(TestCase.java:132)
at org.apache.camel.test.TestSupport.runBare(TestSupport.java:65)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:124)
at junit.framework.TestSuite.runTest(TestSuite.java:232)
at junit.framework.TestSuite.run(TestSuite.java:227)
at
org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests
--
View this message in context:
http://camel.465427.n5.nabble.com/Test-a-single-Bean-with-CamelTestSupport-tp5752563p5752566.html
Sent from the Camel - Users mailing list archive at Nabble.com.