@Test
    void testLinearExecutions()  {
        // Make a chain
        List<Searcher> searchers1 = new ArrayList<>();
        searchers1.add(new TestSearcher("searcher1"));
        searchers1.add(new TestSearcher("searcher2"));
        searchers1.add(new TestSearcher("searcher3"));
        searchers1.add(new TestSearcher("searcher4"));
        Chain<Searcher> chain1 = new Chain<>(new ComponentId("chain1"), searchers1);
        // Make another chain containing two of the same searcher instances and two new
        List<Searcher> searchers2 = new ArrayList<>(searchers1);
        searchers2.set(1, new TestSearcher("searcher5"));
        searchers2.set(3, new TestSearcher("searcher6"));
        Chain<Searcher> chain2 = new Chain<>(new ComponentId("chain2"), searchers2);
        // Execute both
        Query query = new Query("test");
        Result result1 = new Execution(chain1, Execution.Context.createContextStub()).search(query);
        Result result2 = new Execution(chain2, Execution.Context.createContextStub()).search(query);
        // Verify results
        assertEquals(4, result1.getConcreteHitCount());
        assertNotNull(result1.hits().get("searcher1-1"));
        assertNotNull(result1.hits().get("searcher2-1"));
        assertNotNull(result1.hits().get("searcher3-1"));
        assertNotNull(result1.hits().get("searcher4-1"));

        assertEquals(4, result2.getConcreteHitCount());
        assertNotNull(result2.hits().get("searcher1-2"));
        assertNotNull(result2.hits().get("searcher5-1"));
        assertNotNull(result2.hits().get("searcher3-2"));
        assertNotNull(result2.hits().get("searcher6-1"));
    }
Tests basic search chain execution functionality

@author bratseth
container-search/src/test/java/com/yahoo/search/searchchain/test/ExecutionTestCase.java