You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Chi Kim (JIRA)" <ji...@apache.org> on 2017/01/09 23:35:58 UTC

[jira] [Commented] (CAMEL-9332) Support @MockEndpoint and @MockEndpointAndSkip in Spring Boot

    [ https://issues.apache.org/jira/browse/CAMEL-9332?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15813214#comment-15813214 ] 

Chi Kim commented on CAMEL-9332:
--------------------------------

Above example doesn't work with SpringBoot 1.4.x

For Spring-Boot 1.4.x
Use Camel 2.18.x with
{code}
@RunWith(CamelSpringBootRunner.class)
@MockEndpoints
@SpringBootTest(classes = {TestConfig.class})
public class SomeTest {
...
}
{code}

> Support @MockEndpoint and @MockEndpointAndSkip in Spring Boot
> -------------------------------------------------------------
>
>                 Key: CAMEL-9332
>                 URL: https://issues.apache.org/jira/browse/CAMEL-9332
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-spring-boot, camel-test
>    Affects Versions: 2.16.0
>         Environment: mac, jdk7
>            Reporter: Minh Tran
>            Assignee: Claus Ibsen
>             Fix For: 2.17.1, 2.18.0
>
>
> My route looks like
> from(“direct:start”).to(“direct:end”)
> My unit test looks like
> {noformat}
> @RunWith(SpringJUnit4ClassRunner.class)
> @SpringApplicationConfiguration(classes = Config.class)
> @MockEndpoints
> public class MyUnitTest {
>  @Produce(uri=“direct:start”)
>  private ProducerTemplate producer;
>  @EndpointInject(uri=“mock:direct:end”)
>  private MockEndpoint end;
> 	@Test
> 	public void testMock() throws InterruptedException {
> 		end.expectedBodiesReceived("blah");
> 		producerTemplate.sendBody("blah");
> 		end.assertIsSatisfied();
> 	}
> }
> {noformat}
> It looks like the direct:end bit is never mocked so the assertion fails. It’s like @MockEndpoints is completely ignored. 
> There are workarounds described here http://camel.465427.n5.nabble.com/spring-boot-test-mocks-td5773902.html
> There are disadvantages to these workarounds as listed in that thread. Thanks



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)