Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
public class DbRouterBuilderTest extends CamelSpringTestSupport {
@Override
@Before
public void setUp() throws Exception {
super.setUp();
Class.forName("org.hsqldb.jdbcDriver");
context().getRouteDefinitions().get(0).adviceWith(context(), new AdviceWithRouteBuilder() {
@Override
public void configure() throws Exception {
mockEndpoints("file*");
}
});
}
@Override
protected AbstractApplicationContext createApplicationContext() {
AnnotationConfigApplicationContext annotationConfigApplicationContext = new AnnotationConfigApplicationContext();
annotationConfigApplicationContext.register(ApplicationConfig.class);
return annotationConfigApplicationContext;
}
@Test
public void it_should_receive_an_address() throws Exception {
Address address = new Address("John Doe", "john@doe.com");
MockEndpoint mockEndpoint = getMockEndpoint("mock:file:target/test");
mockEndpoint.setExpectedCount(1);
mockEndpoint.allMessages().body().convertToString().contains("john@doe.com");
template.sendBody("jpa://samples.camel.model.Address?consumeDelete=false", address);
assertMockEndpointsSatisfied();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment