Как сопоставить параметр запроса WireMock с любым строковым значениемJAVA

Программисты JAVA общаются здесь
Гость
Как сопоставить параметр запроса WireMock с любым строковым значением

Сообщение Гость »


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? :-/


Источник: https://stackoverflow.com/questions/781 ... ring-value

Вернуться в «JAVA»