Search a bit more on these user forums I think some people have
discussed this before, also they may got a workaround or it works in a
newer release. 2.17.x is EOL.

On Fri, Jun 9, 2017 at 1:53 PM, Burkard Stephan
<[email protected]> wrote:
> Hi
>
> I attached a tiny example project to show a strange effect when I use 
> Spring's @DirtiesContext in Camel route tests.
>
> *** Setup:
> - SpringBoot 1.4.2.RELEASE
> - Camel 2.17.3
> - In the project you will find two test classes with two test cases each
> - One test class uses @DirtiesContext, the other does not
> - Let's call them DirtiesContext and StandardContext for easier descriptions
> - Note: I know that these tests do not need @DirtiesContext. This is just to 
> show the problem
>
> *** Results
> - The tests of StandardContext are running fine
> - The first test of DirtiesContext runs fine
> - The second fails because the MockEndpoints receive no more messages
>
> *** Cause
> - The DirtiesContext "Context-Reboot" seems to "destroy" the MockEndpoints
> - In the project ClassMode.AFTER_EACH_TEST_METHOD is used
> - If you switch to ClassMode.BEFORE_EACH_TEST_METHOD, both test cases of that 
> test class fail
>
> *** Cause II
> - In IntelliJ, when I run all tests and StandardContext tests are running 
> after the DirtiesContext tests, they fail too
> - In Maven, this is NOT the case, but I guess this depends on using a process 
> per class or not
>
> Is this a known problem? Should I raise a Jira issue for it?
>
> Regards
> Stephan
>



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

Reply via email to