public static LeaveGroupResponse parse(ByteBuffer buffer, short version) {
        return new LeaveGroupResponse(new LeaveGroupResponseData(new ByteBufferAccessor(buffer), version));
    }
@Test
    public void testParse() {
        Map<Errors, Integer> expectedErrorCounts = Collections.singletonMap(Errors.NOT_COORDINATOR, 1);

        LeaveGroupResponseData data = new LeaveGroupResponseData()
            .setErrorCode(Errors.NOT_COORDINATOR.code())
            .setThrottleTimeMs(throttleTimeMs);

        for (short version : ApiKeys.LEAVE_GROUP.allVersions()) {
            ByteBuffer buffer = MessageUtil.toByteBuffer(data, version);
            LeaveGroupResponse leaveGroupResponse = LeaveGroupResponse.parse(buffer, version);
            assertEquals(expectedErrorCounts, leaveGroupResponse.errorCounts());

            if (version >= 1) {
                assertEquals(throttleTimeMs, leaveGroupResponse.throttleTimeMs());
            } else {
                assertEquals(DEFAULT_THROTTLE_TIME, leaveGroupResponse.throttleTimeMs());
            }

            assertEquals(Errors.NOT_COORDINATOR, leaveGroupResponse.error());
        }
    }