public boolean hasTimeLeft() {
        return clock.instant().isBefore(endTime);
    }
@Test
    public void testHasTimeLeft() {
        ManualClock clock = new ManualClock();

        TimeoutBudget budget = new TimeoutBudget(clock, Duration.ofMillis(7));
        assertThat(budget.hasTimeLeft(), is(true));
        clock.advance(Duration.ofMillis(1));
        assertThat(budget.hasTimeLeft(), is(true));
        clock.advance(Duration.ofMillis(5));
        assertThat(budget.hasTimeLeft(), is(true));
        assertThat(budget.hasTimeLeft(), is(true));
        clock.advance(Duration.ofMillis(1));
        assertThat(budget.hasTimeLeft(), is(false));
        clock.advance(Duration.ofMillis(5));
        assertThat(budget.hasTimeLeft(), is(false));

        clock.advance(Duration.ofMillis(1));
        assertThat(budget.timesUsed(), is("[total: 13 ms]"));
    }