Skip to content

Instantly share code, notes, and snippets.

@alexandre-touret
Last active April 10, 2018 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexandre-touret/391305e01510e65703a26c46c2e233f5 to your computer and use it in GitHub Desktop.
Save alexandre-touret/391305e01510e65703a26c46c2e233f5 to your computer and use it in GitHub Desktop.
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