Skip to content

Matchers section is missed in ContractVerifierTest #722

@Hronom

Description

@Hronom

I'm use 2.0.1.RELEASE.

I have response body

[
  {
    "id": "00000bb0b000b00000b0b000",
    "name": "Admin test project 1"
  },
  {
    "id": "11111bb1b111b11111b1b111",
    "name": "Admin test project 2"
  }
]

My contract in yaml

request:
  method: GET
  url: /projects
  headers:
    Content-Type: application/json;charset=UTF-8
response:
  status: 200
  headers:
    Content-Type: application/json;charset=UTF-8
  matchers:
    body:
      - path: $[0].id
        type: by_regex
        value: "[0-9a-z]{24}"
      - path: $[1].id
        type: by_regex
        value: "[0-9a-z]{24}"

The generated ContractVerifierTest don't has matchers part

        // given:
            MockMvcRequestSpecification request = given()
                    .header("Content-Type", "application/json;charset=UTF-8");

        // when:
            ResponseOptions response = given().spec(request)
                    .get("/projects");

        // then:
            assertThat(response.statusCode()).isEqualTo(200);
            assertThat(response.header("Content-Type")).isEqualTo("application/json;charset=UTF-8");

It will be good if matchers section will be generated even if no body section, since in this situation I have anonymous array with dynamic data that can't be verified in body section.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions