@Override
    public Map<Errors, Integer> errorCounts() {
        HashMap<Errors, Integer> counts = new HashMap<>();
        data.groups().forEach(
            group -> updateErrorCounts(counts, Errors.forCode(group.errorCode()))
        );
        return counts;
    }
@Test
    void testErrorCounts() {
        Errors e = Errors.INVALID_GROUP_ID;
        int errorCount = 2;
        ConsumerGroupDescribeResponseData data = new ConsumerGroupDescribeResponseData();
        for (int i = 0; i < errorCount; i++) {
            data.groups().add(
                new ConsumerGroupDescribeResponseData.DescribedGroup()
                    .setErrorCode(e.code())
            );
        }
        ConsumerGroupDescribeResponse response = new ConsumerGroupDescribeResponse(data);

        Map<Errors, Integer> counts = response.errorCounts();

        assertEquals(errorCount, counts.get(e));
        assertNull(counts.get(Errors.COORDINATOR_NOT_AVAILABLE));
    }