Introduce queryParamCount()
in MockRestRequestMatchers
#34703
Labels
in: test
Issues in the test module
in: web
Issues in web modules (web, webmvc, webflux, websocket)
type: enhancement
A general enhancement
Milestone
Summary
Currently,
MockRestServiceServer
providesMockRestRequestMatchers.queryParam(String, Matcher)
to validate parameter values. However, there is no built-in way to:Users must currently implement a custom
RequestMatcher
, adding unnecessary complexity.Proposed Solution
Introduce a new
MockRestRequestMatchers
method:expectedCount
.Example Usage
Workarounds
Currently, users must manually parse the URI's query string inside a custom
RequestMatcher
, which introduces unnecessary boilerplate. Example:Benefit
Adding
queryParamCount()
would:✅ Improve test readability and maintainability.
✅ Prevent silent failures due to extra or missing parameters.
✅ Reduce boilerplate when asserting both parameter existence and correctness.
Would this be a useful addition to
MockRestRequestMatchers
?The text was updated successfully, but these errors were encountered: