public StartAndStopLatch expectedRestarts(int expectedStarts, int expectedStops, List<StartAndStopLatch> dependents) {
        StartAndStopLatch latch = new StartAndStopLatch(expectedStarts, expectedStops, this::remove, dependents, clock);
        restartLatches.add(latch);
        return latch;
    }
Obtain a {@link StartAndStopLatch} that can be used to wait until the expected number of restarts
has been completed.

@param expectedStarts   the expected number of starts; may be 0
@param expectedStops    the expected number of stops; may be 0
@param dependents       any dependent latches that must also complete in order for the
                        resulting latch to complete
@return the latch; never null
connect/runtime/src/test/java/org/apache/kafka/connect/integration/StartAndStopCounter.java