Custom Matcher Example

412 views
Skip to first unread message

Ben Ifie

unread,
May 20, 2021, 6:31:07 AM5/20/21
to wiremock-user
Hi guys

I am trying to create a custom matcher for wiremock. I have very limited java experience hence I couldnt really figure it out from the documentation. 

Could you kindly explain in more details how I create the class or point me to an example project or implementation please?

Thanks


aaron...@willowtreeapps.com

unread,
May 20, 2021, 9:48:21 AM5/20/21
to wiremock-user
Here is the documentation on Custom Request Matchers. There is an example for checking if a query parameter of `maxLength` is greater than a specified value.

To create your own, you'll need to extend the `RequestMatcherExtension` class, and override the `getName()` and `match()` methods. Here's a little blurb on extending in java, and another on overriding.

Ben Ifie

unread,
May 22, 2021, 12:01:47 AM5/22/21
to wiremock-user
Thanks for your help
Reply all
Reply to author
Forward
0 new messages