@Override
    public void onNewResourcesAvailable() {
        checkDesiredOrSufficientResourcesAvailable();
    }
@Test
    void testStabilizationTimeoutReset() {
        Duration initialResourceTimeout = Duration.ofMillis(-1);
        Duration stabilizationTimeout = Duration.ofMillis(50L);

        WaitingForResources wfr =
                new WaitingForResources(
                        ctx,
                        LOG,
                        initialResourceTimeout,
                        stabilizationTimeout,
                        ctx.getClock(),
                        null);

        ctx.setHasDesiredResources(() -> false);

        // notify about resources, trigger stabilization timeout
        ctx.setHasSufficientResources(() -> true);
        ctx.advanceTimeByMillis(40); // advance time, but don't trigger stabilizationTimeout
        wfr.onNewResourcesAvailable();

        // notify again, but insufficient (reset stabilization timeout)
        ctx.setHasSufficientResources(() -> false);
        ctx.advanceTimeByMillis(40);
        wfr.onNewResourcesAvailable();

        // notify again, but sufficient, trigger timeout
        ctx.setHasSufficientResources(() -> true);
        ctx.advanceTimeByMillis(40);
        wfr.onNewResourcesAvailable();

        // sanity check: no state transition has been triggered so far
        assertThat(ctx.hasStateTransition()).isFalse();
        assertThat(ctx.getTestDuration()).isGreaterThan(stabilizationTimeout);

        ctx.setExpectCreatingExecutionGraph();

        ctx.advanceTimeByMillis(1);
        assertThat(ctx.hasStateTransition()).isFalse();

        ctx.advanceTimeByMillis(stabilizationTimeout.toMillis());
        assertThat(ctx.hasStateTransition()).isTrue();
    }