@Test
    void singlePolicySingleWorkerWithIncreasingParallelism() {
        for (int exponent = 0; exponent < 4; exponent++) {
            ManualTimer timer = new ManualTimer();
            DynamicThrottlePolicy policy = new DynamicThrottlePolicy(timer);
            int scaleFactor = (int) Math.pow(10, exponent);
            long operations = 3_000L * scaleFactor;
            int workPerSuccess = 6;
            int numberOfWorkers = 1;
            int maximumTasksPerWorker = 100000;
            int workerParallelism = scaleFactor;
            Summary summary = run(operations, workPerSuccess, numberOfWorkers, maximumTasksPerWorker, workerParallelism, timer, policy);

            double minMaxPending = numberOfWorkers * workerParallelism;
            double maxMaxPending = numberOfWorkers * maximumTasksPerWorker;
            assertInRange(minMaxPending, summary.averagePending, maxMaxPending);
            assertInRange(minMaxPending, summary.averageWindows[0], maxMaxPending);
            assertInRange(1, summary.inefficiency, 1 + (5e-5 * scaleFactor)); // Slow ramp-up
            assertInRange(0, summary.waste, 0.1);
        }
    }
Sort of a dummy test, as the conditions are perfect. In a more realistic scenario, below, the algorithm needs luck to climb this high.
messagebus/src/test/java/com/yahoo/messagebus/DynamicThrottlePolicyTest.java