camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Henryk Konsek <hekon...@gmail.com>
Subject Re: Question about using message headers/Exchange properties and route testing
Date Fri, 03 Jan 2014 12:40:36 GMT
> There is also an ExchangeBuilder AFAIR that you may use as well. Then
> you can use that to create an exchange, to send with the produce
> template.

ExchangeBuilder is cool indeed, I forgot about it. :)

BTW Probably having bean mocking API similar to the one presented
below would be a nice addition to our testing API. However creating
such API is not as trivial as it might look like, because of the rich
bean binding capabilities that it should support.

@Bean // Spring Java config Example
MyBean myBean() {
  return MockBean.createMockBean(MyBean.class).
    removeHeader("foo"). // this mock will remove given header from exchange
    addProperty("prop"). // add property that couldn't be added before
    assertHeader("bar").isEqualTo("baz"); // and make some assertions
}

from(...).bean("myBean", "myMethod").to(...);

-- 
Henryk Konsek
http://henryk-konsek.blogspot.com

Mime
View raw message