MockServer records every request it receives — both requests that matched an expectation and requests that were proxied. Use verification to assert after the fact that specific requests arrived, and in what quantity or order.
Verify a single request
Call verify with a request matcher and a times condition.
At least N times
At most N times
Exactly N times
Never received
Verify using an OpenAPI matcher
Use an OpenAPI spec as the request matcher in a verification call. This is useful when you want to verify that a request conforming to a specific API operation was received.
Verify by expectation ID
If you assigned an id to an expectation, you can verify by that ID directly:
Verify a sequence of requests
Use verifySequence (or pass multiple request matchers to verify in Java) to assert that a set of requests arrived in order. Each request in the sequence must have been received at least once, and each must have been received after the previous one.
Mix request matchers and OpenAPI matchers in a sequence
Retrieve recorded requests for debugging
Retrieve all requests MockServer has recorded so you can inspect what arrived:
Retrieve recorded requests as Java code or JSON:
Retrieve active expectations (useful for confirming which expectations are still registered):
If a verification assertion fails unexpectedly, retrieve recorded requests to see exactly what MockServer received. This can reveal URL encoding differences, unexpected headers, or missing request bodies.