I'm not sure if it's a bug or misuse, but expectedBodyReceived().body().isEqualTo("expected") 
doesn't work as expected. expectedBodiesReceived("expected") or 
expectedBodyReceived().constant("expected") works fine.
https://github.com/igarashitm/issues/blob/master/camel/misc/src/test/java/ExpectedBodyReceivedTest.java
only testBodyIsEqualTo() fails.

No idea yet for your second issue, but it sounds like the all endpoints are 
intercepted regardless of the RouteDefinition you invoked adviceWith().

Thanks,
Tomo

On 10/15/2016 02:06 AM, catequil wrote:
Ok, so it appears that I understand and have a working copy.  There are
however a few remaining questions.  If you feel they are no longer relevant
in this thread let me know and I will create a new thread.

In the code below I expected it to grab the "myRouteMiddle" route and find
the endpoint(direct:end) intercept it and mock the direct:end as
mock:direct:end.

In the assertions I expected it to to have a body of "peace world!", but the
test passed with a body of "hello world!".

Am I misunderstanding how the intercepts and/or getRouteDefinition work?

On a second issue I intercepted "log:input" and the test failed saying there
were 3 messages.  I expected it to only have one based on the following
criteria:
1. the "skipSendToOriginalEndpoint" should have stopped the last "log:input"
from being activated.
2. the getRouteDefinition was set to get "myMiddleRoute" which in my mind
should have gotten just the middle route and not the start route making the
total messages just 1.

Do you know why this works this way?  Is this a bug?  Or am I miss
understanding how it works?

Thanks





--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-Spring-Unit-Testing-with-Mocks-tp5788635p5788814.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to