camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Henryk Konsek <>
Subject Re: Unit Testing Question
Date Wed, 15 Jan 2014 15:08:38 GMT

> I am curious how it would be possible to setup the necessary aspects for a
> unit test of this method?  How do you setup an entire exchange in a unit
> test, or is there capabilities built in somewhere I am unaware of?

You can set up exchange fixtures with the appropriate ProducerTemplate
methods. For example:

producerTemplate.sendBodyAndHeader("direct:test", "testMessage",
"headerKey", "headerValue");

I would also suggest you to split your processor into smaller units of
processing. You could for example try to call Camel components (like
JDBC) via routes instead of fetching them and calling explicitly in
the processor. You might also consider extracting
getUpdateProcessStatus() method into dedicated bean and wiring it into
your route via bean component [1]. To more fine-grained is you
processing flow, the easier will it be to test it.



Henryk Konsek

View raw message