You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "David Jacot (Jira)" <ji...@apache.org> on 2021/06/24 11:38:00 UTC

[jira] [Created] (KAFKA-12989) `MockClient` should respect the request matcher passed to `prepareUnsupportedVersionResponse`

David Jacot created KAFKA-12989:
-----------------------------------

             Summary: `MockClient` should respect the request matcher passed to `prepareUnsupportedVersionResponse`
                 Key: KAFKA-12989
                 URL: https://issues.apache.org/jira/browse/KAFKA-12989
             Project: Kafka
          Issue Type: Improvement
            Reporter: David Jacot


The `MockClient` offers the possibility to prepare an unsupported version response with `MockClient#prepareUnsupportedVersionResponse`. That method accepts a `RequestMatcher` but it is never applied. It should be.

{code:java}
            UnsupportedVersionException unsupportedVersionException = null;
            if (futureResp.isUnsupportedRequest) {
                unsupportedVersionException = new UnsupportedVersionException(
                        "Api " + request.apiKey() + " with version " + version);
            } else {
                AbstractRequest abstractRequest = request.requestBuilder().build(version);
                if (!futureResp.requestMatcher.matches(abstractRequest))
                    throw new IllegalStateException("Request matcher did not match next-in-line request "
                            + abstractRequest + " with prepared response " + futureResp.responseBody);
            }
            ClientResponse resp = new ClientResponse(request.makeHeader(version), request.callback(), request.destination(),
                    request.createdTimeMs(), time.milliseconds(), futureResp.disconnected,
                    unsupportedVersionException, null, futureResp.responseBody);
{code}




--
This message was sent by Atlassian Jira
(v8.3.4#803005)