private OffsetFetchResponse createOffsetFetchResponse(short version) {
        Map<TopicPartition, OffsetFetchResponse.PartitionData> responseData = new HashMap<>();
        responseData.put(new TopicPartition("test", 0), new OffsetFetchResponse.PartitionData(
            100L, Optional.empty(), "", Errors.NONE));
        responseData.put(new TopicPartition("test", 1), new OffsetFetchResponse.PartitionData(
            100L, Optional.of(10), null, Errors.NONE));
        if (version < 8) {
            return new OffsetFetchResponse(Errors.NONE, responseData);
        }
        int throttleMs = 10;
        return new OffsetFetchResponse(throttleMs, Collections.singletonMap("group1", Errors.NONE),
            Collections.singletonMap("group1", responseData));
    }
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