@Test
    void tenPoliciesVeryParallelServerWithShortTaskQueue() {
        for (int repeat = 0; repeat < 2; repeat++) {
            long operations = 1_000_000;
            int workPerSuccess = 6;
            int numberOfWorkers = 6;
            int maximumTasksPerWorker = 180 + (int) (120 * Math.random());
            int workerParallelism = 60 + (int) (40 * Math.random());
            ManualTimer timer = new ManualTimer();
            int p = 10;
            DynamicThrottlePolicy[] policies = IntStream.range(0, p)
                    .mapToObj(j -> new DynamicThrottlePolicy(timer)
                            .setWeight((j + 1.0) / p)
                            .setWindowSizeIncrement(5)
                            .setMinWindowSize(1))
                    .toArray(DynamicThrottlePolicy[]::new);
            Summary summary = run(operations, workPerSuccess, numberOfWorkers, maximumTasksPerWorker, workerParallelism, timer, policies);

            double minMaxPending = numberOfWorkers * workerParallelism;
            double maxMaxPending = numberOfWorkers * maximumTasksPerWorker;
            assertInRange(minMaxPending, summary.averagePending, maxMaxPending);
            for (int j = 0; j < p; j++) {
                double expectedShare = (j + 1) / (0.5 * p * (p + 1));
                double imperfectionFactor = 1.6;
                // Actual shares are not distributed perfectly proportionally to weights, but close enough.
                assertInRange(minMaxPending * expectedShare / imperfectionFactor,
                        summary.averageWindows[j],
                        maxMaxPending * expectedShare * imperfectionFactor);
            }
            assertInRange(1.0, summary.inefficiency, 1.05);
            assertInRange(0, summary.waste, 0.1);
        }
    }
A more realistic test, where throughput gradually flattens with increasing window size, and with more variance in throughput.
messagebus/src/test/java/com/yahoo/messagebus/DynamicThrottlePolicyTest.java