@Test
    void testParallelExecutionOfOneChain() {
        ExecutorService executor = Executors.newFixedThreadPool(16);
        // Setup
        Chain<Searcher> mainChain = new Chain<>(new ParallelExecutor(executor), new ResultProcessor(), new RegularProvider());

        // Execute
        Result result = new Execution(mainChain, Execution.Context.createContextStub()).search(new Query());

        // Verify
        assertEquals(3 * 2, result.hits().size(), "Received 2 hits from 3 threads");
        assertEquals(1.0, result.hits().get("thread-0:hit-0").getRelevance().getScore(), delta);
        assertEquals(1.0, result.hits().get("thread-1:hit-0").getRelevance().getScore(), delta);
        assertEquals(1.0, result.hits().get("thread-2:hit-0").getRelevance().getScore(), delta);
        assertEquals(0.5, result.hits().get("thread-0:hit-1").getRelevance().getScore(), delta);
        assertEquals(0.5, result.hits().get("thread-1:hit-1").getRelevance().getScore(), delta);
        assertEquals(0.5, result.hits().get("thread-2:hit-1").getRelevance().getScore(), delta);
        assertEquals(0, executor.shutdownNow().size());
    }
Tests having a result with some slow source data which should pass directly to rendering
container-search/src/test/java/com/yahoo/search/searchchain/AsyncExecutionOfOneChainTestCase.java