@Override
    public void completeAll(long currentTimeMs) {
        for (CompletableFuture<Long> completion : thresholdMap.values()) {
            completion.complete(currentTimeMs);
        }
    }
@Test
    public void testCompleteAll() throws Exception {
        CompletableFuture<Long> future1 = purgatory.await(3L, 500);
        CompletableFuture<Long> future2 = purgatory.await(1L, 500);
        CompletableFuture<Long> future3 = purgatory.await(5L, 500);
        assertEquals(3, purgatory.numWaiting());

        long completionTime = time.milliseconds();
        purgatory.completeAll(completionTime);
        assertEquals(completionTime, future1.get());
        assertEquals(completionTime, future2.get());
        assertEquals(completionTime, future3.get());
        assertEquals(0, purgatory.numWaiting());
    }