private FetchResponse createFetchResponse(boolean includeAborted) {
        LinkedHashMap<TopicIdPartition, FetchResponseData.PartitionData> responseData = new LinkedHashMap<>();
        Uuid topicId = Uuid.randomUuid();
        MemoryRecords records = MemoryRecords.withRecords(Compression.NONE, new SimpleRecord("blah".getBytes()));
        responseData.put(new TopicIdPartition(topicId, new TopicPartition("test", 0)), new FetchResponseData.PartitionData()
                        .setPartitionIndex(0)
                        .setHighWatermark(1000000)
                        .setLogStartOffset(0)
                        .setRecords(records));

        List<FetchResponseData.AbortedTransaction> abortedTransactions = emptyList();
        if (includeAborted) {
            abortedTransactions = singletonList(
                    new FetchResponseData.AbortedTransaction().setProducerId(234L).setFirstOffset(999L));
        }
        responseData.put(new TopicIdPartition(topicId, new TopicPartition("test", 1)), new FetchResponseData.PartitionData()
                        .setPartitionIndex(1)
                        .setHighWatermark(1000000)
                        .setLogStartOffset(0)
                        .setAbortedTransactions(abortedTransactions));
        return FetchResponse.parse(FetchResponse.of(Errors.NONE, 25, INVALID_SESSION_ID,
            responseData).serialize(FETCH.latestVersion()), FETCH.latestVersion());
    }
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