You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Kamil (JIRA)" <ji...@apache.org> on 2019/05/22 09:49:00 UTC

[jira] [Comment Edited] (CAMEL-13549) expectedHeaderReceived should failed when no message is received

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

Kamil edited comment on CAMEL-13549 at 5/22/19 9:48 AM:
--------------------------------------------------------

[~davsclaus] - I know about `expected message count`, but don't you think that `expectedHeaderReceived` should work without it?

I see that you changed that for 3.x. Is there any possibility to backport it to 2.x?


was (Author: eximius):
[~davsclaus] - I know about `expected message count`, but don't you think that `expectedHeaderReceived` should work without it? You know.. "Principle of least surprise" or something?

> expectedHeaderReceived should failed when no message is received
> ----------------------------------------------------------------
>
>                 Key: CAMEL-13549
>                 URL: https://issues.apache.org/jira/browse/CAMEL-13549
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-test
>    Affects Versions: 2.24.0
>            Reporter: Kamil
>            Assignee: Claus Ibsen
>            Priority: Minor
>             Fix For: 3.0.0, 3.0.0-M3
>
>
> This test should fail:
> {code:java}
> import org.apache.camel.RoutesBuilder;
> import org.apache.camel.builder.RouteBuilder;
> import org.apache.camel.component.mock.MockEndpoint;
> import org.apache.camel.test.junit4.CamelTestSupport;
> import org.assertj.core.api.Assertions;
> import org.junit.Test;
> public class MyRouteTest extends CamelTestSupport {
>   private static final String ROUTE_ID = "mytest";
>   @Override
>   public RoutesBuilder createRouteBuilder() throws Exception {
>     return new RouteBuilder() {
>       @Override
>       public void configure() throws Exception {
>         from("direct:foo")
>           .id(ROUTE_ID)
>           .to("mock:extract");
>       }
>     };
>   }
>   @Test
>   public void shouldFail() throws InterruptedException {
>     // given
>     final MockEndpoint mock = getMockEndpoint("mock:extract");
>     // declare
>     mock.expectedHeaderReceived("foo", "bar");
>     // when
> //template.sendBody("direct:foo", "test");
>     // then
>     mock.assertIsSatisfied();
>   }
> }
> {code}
> Because we were expecting some headers, but none headers were received



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)