I would like to do something like this:
mockServer.givenThat(WireMock.get(URL_PATH)
.withQueryParam("param", WireMock.any())
.willReturn(WireMock.ok(SOMETHING)));
So basically, I don't care what will be passed in param parameter, but I want to make sure that it was passed.
The problem is that there is no any() method in WireMock. And I could not find anything similar.
Digging a little bit in the WireMock classes I found there is a AnythingPattern that extends StringValuePattern and always matches. Basically, exactly what I need, which I could use just by instantiating it with a constructor, but it really does not feel right (depending on a concrete implementation).
Another workaround would be to use matching(".*"), which would do the trick, but strictly speaking it is not the same.
Do you know any more elegant way to do this, please?
Strangely enough I could not find any discussion about it in the web. So, I wonder, maybe what I ask doesn't even make sense? :-/
I think the
absent()function would be useful in this case. Pairing it withnot()should get you there.