public final Function<Random, TestMethod> nextMethod(Class<?> actualType) {
        AliasedMethodTable<TestMethod> d = cache.get(requireNonNull(actualType));
        return d != null ? d : cache.computeIfAbsent(actualType, new Function<Class<?>, AliasedMethodTable<TestMethod>>() {
            public AliasedMethodTable<TestMethod> apply(Class<?> at) {
                LinkedHashMap<TestMethod, Double> weights = new LinkedHashMap<>();
                for (TestMethod rtm : TestMethodLoader.getTestsForType(at)) {
                    double weight = calculateTestWeight(rtm);
                    assertFalse(Double.isNaN(weight) || Double.isInfinite(weight));
                    if (weight > 0) {
                        weights.put(rtm, weight);
                        // System.out.println(rtm.toString2() + " " + weight);
                    }
                }
                if (weights.isEmpty()) {
                    throw new IllegalArgumentException(
                            "All weights are 0 for targets of " + at.getCanonicalName() + " tm =" + TestMethodLoader.getTestsForType(at));
                }

                return new AliasedMethodTable<>(weights);
            }
        });
    }