You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Steve973 <st...@gmail.com> on 2017/11/01 12:21:54 UTC

Camel with Spock and Spring Boot: Zero interactions with detached mock

Hello, everyone.  I am having some issues with testing my camel context
with spring boot.

I am using spring boot 1.5.6, spock 1.1-groovy-2.4, camel 2.19.2, and
camel-spring-boot-starter 2.19.2.

I am using a spock mock, and I'm using the DetachedMockFactory in a
@TestConfigurationclass. All of my beans use constructor injection. I am
injecting a mocked @Repository into one of the processor @Components, and I
am also injecting it into my test class to define interactions.

I have my test annotated with @SpringBootTest with the classes list
including all Processorimplementations, and all RouteBuilder extensions. I
also have an '@Import' with my TestConfiguration class. I am even using
constructor injection for this repository bean in my test!

But it seems that the mock that is injected into the test class is not the
one that is in use. Does anyone have an idea what could be wrong? I have
tried @DirtiesContext to reload the context both before and after each
test, but that did not help.


Thanks in advance,

Steve