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

Matcher to check whether json contains certain field without value check #6

Closed
olenagerasimova opened this issue Nov 13, 2018 · 4 comments
Assignees

Comments

@olenagerasimova
Copy link

It would be nice to have opportunity to check whether json contains certain field without exact field value check, for example json contains field

  • with the any value of given type
  • with any non-empty string value
  • with string value that starts/ends/contains given sub string
@g4s8 g4s8 self-assigned this Nov 19, 2018
g4s8 added a commit that referenced this issue Nov 19, 2018
@g4s8
Copy link
Owner

g4s8 commented Nov 19, 2018

@olenagerasimova you can use JsonValueIs primary constructor with any matcher:

MatcherAssert.assertThat(
    Json.createValue("Starting with 1 2 3"),
    new JsonValueIs(
        JsonValue.ValueType.STRING,
        Matchers.startsWith("Starting")
    )
);

see 34f5de5

@g4s8
Copy link
Owner

g4s8 commented Nov 19, 2018

@rultor release, tag=0.3.1

@rultor
Copy link
Collaborator

rultor commented Nov 19, 2018

@rultor release, tag=0.3.1

@g4s8 OK, I will release it now. Please check the progress here

@rultor
Copy link
Collaborator

rultor commented Nov 19, 2018

@rultor release, tag=0.3.1

@g4s8 Done! FYI, the full log is here (took me 4min)

@g4s8 g4s8 closed this as completed Feb 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants