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

Document Hamcrest assertions if root is array #563

Open
dschulten opened this issue Oct 5, 2022 · 1 comment
Open

Document Hamcrest assertions if root is array #563

dschulten opened this issue Oct 5, 2022 · 1 comment

Comments

@dschulten
Copy link

Read the documentation, maybe we already have the feature

Is your feature request related to a problem? Please describe.
I couldn't find documentation about asserting the content of an array at root. In the end I found that the path to refer to an array at the json root is "", so this works:

@Test
    void assertsArraySize() {
        assertThat("[\"foo\",\"bar\"]", jsonPartMatches("", hasSize(2)));
    }

Describe the solution you'd like
Add array assertions at root to documentation

@lukas-krecan
Copy link
Owner

Hi, sorry for late response. What is the reason to access the root using path if you can write directly this assertThat("[\"foo\",\"bar\"]", hasSize(2));? I should definitely document it, I just wonder what the use-case is.

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

2 participants