static

in disco-java-agent/disco-java-agent-core/src/integ/java/software/amazon/disco/agent/integtest/concurrent/source/TestForkJoinTaskFactory.java [30:53]


    static {
        numFactoryMethods = 0;
        for (Method method: TestRunnableFactory.class.getDeclaredMethods()) {
            if (method.getReturnType().equals(TestRunnableFactory.TestableRunnable.class) && method.getName().startsWith("create")) {
                numFactoryMethods++;
            }
        }
        //we use the set of runnables twice for two types of adaptation - with and without result
        numFactoryMethods = numFactoryMethods * 2;

        for (Method method: TestCallableFactory.class.getDeclaredMethods()) {
            if (method.getReturnType().equals(TestCallableFactory.NonThrowingTestableCallable.class) && method.getName().startsWith("create")) {
                numFactoryMethods++;
            }
        }

        for (Method method: TestForkJoinTaskFactory.class.getDeclaredMethods()) {
            if (method.getReturnType().equals(NonThrowingTestableForkJoinTask.class) && method.getName().startsWith("create")) {
                numFactoryMethods++;
            }
        }

        Assert.assertEquals("Incorrect number of factory methods found in static initializer", Data.provideAllForkJoinTasks().size(), numFactoryMethods);
    }