[ 
https://issues.apache.org/jira/browse/CAMEL-15037?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

michael elbaz updated CAMEL-15037:
----------------------------------
    Description: 
I reopen the ticket because this still not working as expected on latest camel 
version (3.2.0) 

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

  was:
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


> CLONE - expectedHeaderReceived should failed when no message is received
> ------------------------------------------------------------------------
>
>                 Key: CAMEL-15037
>                 URL: https://issues.apache.org/jira/browse/CAMEL-15037
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-test
>    Affects Versions: 3.2.0
>            Reporter: michael elbaz
>            Assignee: Claus Ibsen
>            Priority: Minor
>
> I reopen the ticket because this still not working as expected on latest 
> camel version (3.2.0) 
> 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
(v8.3.4#803005)

Reply via email to