Mule
  1. Mule
  2. MULE-6170

HttpResponseBuilderTestCase.validateHeader() is incorrect which masks broken tests

    Details

    • User impact:
      Very Low
    • Similar Issues:
      MULE-801MessageTypeNotSupportedException fails with NPE - masked by tests
      MULE-2021Registry Retrieval by EndpointURI seems to be Broken
      MULE-6708Fix broken http/tcp tests
      MULE-1150JMS SimpleRetryConnectionStrategy broken with WebSphere MQ
      MULE-3108DefaultModelAndServiceNames test case broken
      MULE-7673DatabaseMuleArtifactTestCase broken after maven changes
      MULE-3107ServerNotificationManagerTestCase broken
      MULE-2454Integration Tests Broken in 2.0
      MULE-5646Passing an broken zip app in the command line will provoke a fatal error
      MULE-4296test API docs broken for 2.2.1

      Description

      validateHeader returns happily if the expected header is not present, which allows otherwise broken tests to pass.

      I suggest to add a fail() statement at the end to solve this:

          private void validateHeader(final Header[] headers, final String headerName, final String expectedValue)
          {
              for (final Header header : headers)
              {
                  if (headerName.equals(header.getName()))
                  {
                      assertEquals(expectedValue, header.getValue());
                      return;
                  }
              }
      
              fail(String.format("Didn't find header: %s=%s in headers: %s", headerName, expectedValue, headers));
          }
      

        Activity

        David Dossot created issue -
        Hide
        David Dossot added a comment -

        headers.toString() doesn't render well so adding it in the fail statement message doesn't help much.

        Show
        David Dossot added a comment - headers.toString() doesn't render well so adding it in the fail statement message doesn't help much.
        Evangelina Martinez Ruiz Moreno made changes -
        Field Original Value New Value
        Assignee Evangelina Martinez Ruiz Moreno [ evangelinamrm ]
        Evangelina Martinez Ruiz Moreno made changes -
        Priority To be reviewed [ 6 ] Critical [ 2 ]
        Evangelina Martinez Ruiz Moreno made changes -
        Status Open [ 1 ] In Progress [ 3 ]
        Hide
        Evangelina Martinez Ruiz Moreno added a comment -

        Thanks for catching this David, I'll commit the fix

        Show
        Evangelina Martinez Ruiz Moreno added a comment - Thanks for catching this David, I'll commit the fix
        Hide
        Evangelina Martinez Ruiz Moreno added a comment -

        Committed on:

        3.3.x - r 24294
        3.x - r 24295

        Show
        Evangelina Martinez Ruiz Moreno added a comment - Committed on: 3.3.x - r 24294 3.x - r 24295
        Hide
        Alejandro Sequeira added a comment -

        Evangelina Martinez Ruiz Moreno, is there still any merge pending?

        Show
        Alejandro Sequeira added a comment - Evangelina Martinez Ruiz Moreno , is there still any merge pending?
        Alejandro Sequeira made changes -
        Affects Version/s 3.3 RC4 [ 11276 ]
        Affects Version/s 3.3.0 [ 11110 ]
        Evangelina Martinez Ruiz Moreno made changes -
        Status In Progress [ 3 ] Closed [ 6 ]
        Fix Version/s 3.3.0 [ 11110 ]
        Fix Version/s 3.4.0 [ 11142 ]
        Resolution Fixed [ 1 ]
        Ramiro Rinaudo made changes -
        Workflow Fixed Main Mule Workflow (after JIRA upgrade) [ 89006 ] Main Mule Workflow v1.0 [ 134528 ]
        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open In Progress In Progress
        17m 35s 1 Evangelina Martinez Ruiz Moreno 17/Apr/12 04:48 PM
        In Progress In Progress Closed Closed
        56d 21h 51m 1 Evangelina Martinez Ruiz Moreno 13/Jun/12 02:39 PM

          People

          • Assignee:
            Evangelina Martinez Ruiz Moreno
            Reporter:
            David Dossot
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development