private void assertAllocations(String allocated, Function<ConnectorsAndTasks, ? extends Collection<?>> allocation, int... rawExpectedAllocations) {
        List<Integer> expectedAllocations = IntStream.of(rawExpectedAllocations)
                .boxed()
                .sorted()
                .collect(Collectors.toList());
        List<Integer> actualAllocations = allocations(allocation);
        assertEquals(expectedAllocations,
            actualAllocations,
            "Allocation of assigned " + allocated + " across cluster does not match expected counts");
    }
Assert that the task counts for each worker in the cluster match the expected counts.
For example, calling {@code assertTaskAllocations(0, 0, 2, 3)} ensures that there are two
workers in the cluster that are assigned no tasks, one worker that is assigned two tasks,
and one worker that is assigned three tasks.
connect/runtime/src/test/java/org/apache/kafka/connect/runtime/distributed/IncrementalCooperativeAssignorTest.java