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

Enforce matching all query parameters #1879

Open
sdaus opened this issue May 31, 2024 · 0 comments
Open

Enforce matching all query parameters #1879

sdaus opened this issue May 31, 2024 · 0 comments

Comments

@sdaus
Copy link

sdaus commented May 31, 2024

Describe the feature request
I am using the .withQueryStringParameter method in MockServer for parameter matching. However, there does not seem to be a way to always force matching all query parameters. If parameters are omitted, the test still passes because it doesn't test for the presence of any parameters. I would like to request a feature to always check for all parameters.

What you are trying to do
I'm trying to make sure that the parameter is passed to the endpoint with .withQueryStringParameter:

        mockServerClient
                .when(MockServerRequests.getForJson("/example")
                        .withQueryStringParameter("token", "EXAMPLETOKEN"), Times.once())
                .respond(response().withStatusCode(Integer.valueOf(200)));

However, the following example will also work without any parameters at all:

        mockServerClient
                .when(MockServerRequests.getForJson("/example"), Times.once())
                .respond(response().withStatusCode(Integer.valueOf(200)));

The solution you'd like
I want to make sure that certain parameter(s) are always present, and the test should fail if those parameters are not passed.

Describe alternatives you've considered
None so far.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant