private ShareFetchResponse createShareFetchResponse() {
        ShareFetchResponseData data = new ShareFetchResponseData();
        MemoryRecords records = MemoryRecords.withRecords(Compression.NONE, new SimpleRecord("blah".getBytes()));
        ShareFetchResponseData.PartitionData partition = new ShareFetchResponseData.PartitionData()
                .setPartitionIndex(0)
                .setErrorCode(Errors.NONE.code())
                .setRecords(records)
                .setAcquiredRecords(singletonList(new ShareFetchResponseData.AcquiredRecords()
                        .setFirstOffset(0)
                        .setLastOffset(0)
                        .setDeliveryCount((short) 1)));
        ShareFetchResponseData.ShareFetchableTopicResponse response = new ShareFetchResponseData.ShareFetchableTopicResponse()
                .setTopicId(Uuid.randomUuid())
                .setPartitions(singletonList(partition));

        data.setResponses(singletonList(response));
        data.setThrottleTimeMs(345);
        data.setErrorCode(Errors.NONE.code());
        return new ShareFetchResponse(data);
    }
Check that all error codes in the response get included in {@link AbstractResponse#errorCounts()}.
clients/src/test/java/org/apache/kafka/common/requests/RequestResponseTest.java