Skip to content
Advertisement

MockServer verify with multiple body matchers

I’m using MockServer body matchers to verify an endpoint request’s body parameters. Some properties can be matched exactly, but others may need a separate subString or regex matcher, because part of that property is unknown. For example, a date-time string may have a known date, but unknown time.

However, with multiple withBody() calls, the verify method passes if one or more matcher passes. How to implement a logical AND instead of an OR?

JavaScript

Advertisement

Answer

To perform a logical-AND on multiple body matcher criteria, you need to call the verify() method multiple times:

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement