Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-12947

MockEndpoint.expectedHeaderReceived should fail when no exchange received

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 2.22.1
    • 2.24.0, 2.23.3, 3.0.0, 2.25.0
    • camel-test
    • None
    • Unknown

    Description

      When expecting headers to be passed to a MockEndpoint that is never called the test should fail if the MockEndpoint was never called.

      However it is succeeding.

      Here an example of Junit 4 test succeeding when it should fail

      
      import org.apache.camel.EndpointInject;
      import org.apache.camel.builder.RouteBuilder;
      import org.apache.camel.component.mock.MockEndpoint;
      import org.apache.camel.test.junit4.CamelTestSupport;
      import org.junit.Test;
      
      public class Test extends CamelTestSupport {
      
        @EndpointInject(uri = "mock:direct:foo")
        private MockEndpoint fooProducerMock;
      
        @Override
        public RouteBuilder createRouteBuilder() throws Exception {
      
          return new RouteBuilder() {
      
            @Override
            public void configure() throws Exception {}
          };
        }
      
        @Test
        public void failWhenHeaderAbsent() throws InterruptedException {
          fooProducerMock.expectedHeaderReceived("ghost", "you should be visible");
          MockEndpoint.assertIsSatisfied(context);
        }
      }
      

      Attachments

        Activity

          People

            ramu11 Ramu
            AntoineWils Antoine Wils
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 1h
                1h