private void assertBalancedAllocation() {
        List<Integer> connectorCounts = allocations(ConnectorsAndTasks::connectors);
        List<Integer> taskCounts = allocations(ConnectorsAndTasks::tasks);

        int minConnectors = connectorCounts.get(0);
        int maxConnectors = connectorCounts.get(connectorCounts.size() - 1);

        int minTasks = taskCounts.get(0);
        int maxTasks = taskCounts.get(taskCounts.size() - 1);

        assertTrue(maxConnectors - minConnectors <= 1,
            "Assignments are imbalanced. The spread of connectors across each worker is: " + connectorCounts);
        assertTrue(maxTasks - minTasks <= 1,
            "Assignments are imbalanced. The spread of tasks across each worker is: " + taskCounts);
    }
Ensure that no connectors or tasks that were already assigned during the previous round are newly assigned in this round,
and that each newly-assigned connector and task is only assigned to a single worker.
connect/runtime/src/test/java/org/apache/kafka/connect/runtime/distributed/IncrementalCooperativeAssignorTest.java