Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add wiremock module #22

Closed
MrAolen opened this issue Oct 6, 2020 · 3 comments · Fixed by #23
Closed

Add wiremock module #22

MrAolen opened this issue Oct 6, 2020 · 3 comments · Fixed by #23
Assignees
Labels
enhancement New feature or request

Comments

@MrAolen
Copy link

MrAolen commented Oct 6, 2020

Hi,

it could be cool to provide a wiremock module to validate request or response body json with JCV validators.

In wiremock, when we try to compare a json array with another one but not in the same order, the EqualToJsonPattern doesn't match. ( here is an issue in wiremock repository : wiremock/wiremock#1230 ). If we use a JCV with wiremock it should fix this.

If you want to test the current EqualToJsonPattern error, here is a test :

@Test
  void reproduceFailingIgnoreArrayOrder() {
    var expected = "{ \"array\": [\"a\",\"b\",\"c\",\"d\",\"e\",\"f\",\"g\",\"h\"] }";
    var actual = "{ \"array\": [\"b\",\"a\",\"d\",\"c\",\"e\",\"f\",\"g\",\"h\"] }";
    var pattern = new EqualToJsonPattern(expected, true, false);
    var result = pattern.match(actual);
    var exact = result.isExactMatch();
    assertTrue(exact);
  }
@MrAolen MrAolen added the enhancement New feature or request label Oct 6, 2020
@leomillon leomillon self-assigned this Oct 6, 2020
@clemstoquart
Copy link
Collaborator

Hi,

I cant' reproduce the failing test with both JDK 11.0.9 and 15.

@leomillon
Copy link
Collaborator

@clemstoquart me neither, but anyway, this could still be an interesting feature

@leomillon
Copy link
Collaborator

Erratum: it's failing with WireMock version 2.25.1 but not anymore with the latest 2.27.2 version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants