### Question:
AbstractMethodValidator implements MethodValidator { @Override public MessageError validate(HttpServletRequest request, MessageError messageError) { Map<String, String> headers = Collections.list(request.getHeaderNames()) .stream() .collect(Collectors.toMap(h -> h, request::getHeader)); TreeMap<String, String> caseInsensitiveHeaders = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); caseInsensitiveHeaders.putAll(headers); MessageError resultingMessageError = messageError; Map<String, List<String>> queryParameters = extractQueryParameters(request); Map<String, String> pathParameters = extractPathParameters(request); for (PathParameterValidator pathParameterValidator : validatorWrapper.getPathParameterValidators()) { resultingMessageError = pathParameterValidator.validate(pathParameters, resultingMessageError); } for (QueryParameterValidator queryParameterValidator : validatorWrapper.getQueryParameterValidators()) { resultingMessageError = queryParameterValidator.validate(queryParameters, resultingMessageError); } for (HeaderValidator headerValidator : validatorWrapper.getHeaderValidators()) { resultingMessageError = headerValidator.validate(caseInsensitiveHeaders, resultingMessageError); } for (BodyValidator bodyValidator : validatorWrapper.getBodyValidators()) { resultingMessageError = bodyValidator.validate(request, resultingMessageError); } return resultingMessageError; }  @Override MessageError validate(HttpServletRequest request, MessageError messageError);  }### Answer:
@Test void validate() { messageError = methodValidator.validate(request, messageError); verify(headerValidator, times(1)).validate(headersCaptor.capture(), eq(messageError)); verify(bodyValidator, times(1)).validate(eq(request), eq(messageError)); verify(queryParameterValidator, times(1)).validate(queryParametersCaptor.capture(), eq(messageError)); assertEquals(1, headersCaptor.getValue().size()); assertEquals("application/json", headersCaptor.getValue().get("Content-Type")); assertEquals(Collections.singletonList(QUERY_PARAMETER_VALUE), queryParametersCaptor.getValue().get(QUERY_PARAMETER_NAME)); }