@Override
  protected void setUp() throws Exception {
    super.setUp();

    validEndpoint = resolveMandatoryEndpoint("mock:valid", MockEndpoint.class);
    invalidEndpoint = resolveMandatoryEndpoint("mock:invalid", MockEndpoint.class);

    validEndpoint.whenAnyExchangeReceived(
        ProcessorBuilder.setBody(Builder.constant("validResult")));
    invalidEndpoint.whenAnyExchangeReceived(
        ProcessorBuilder.setBody(Builder.constant("invalidResult")));
  }
 @DirtiesContext
 @Test
 public void helloRouteMustHaveBeenCalled() throws InterruptedException {
   JsonObject model = Json.createObjectBuilder().add("helloMessage", "toto").build();
   Map headers = new HashMap();
   headers.put("httpRequestType", Builder.constant("POST"));
   helloEntryPoint.sendBodyAndHeaders(model.toString(), headers);
   verify(helloService).persistHello((HelloEntity) anyObject());
   helloRouteMock.expectedMessageCount(1);
   helloRouteMock.assertIsSatisfied();
 }
 public ProcessorDefinition<?> apply(RouteDefinition rd) {
   return rd.onException(Exception.class)
       .handled(true)
       .transform(Builder.exceptionMessage())
       .end();
 }