@Test
    void testContextCache() {
        IndexFacts[] contextsBefore = new IndexFacts[5];
        IndexFacts[] contextsAfter = new IndexFacts[5];
        List<Searcher> l = new ArrayList<>(5);
        l.add(new ContextCacheSearcher(0, contextsBefore, contextsAfter));
        l.add(new ContextCacheSearcher(1, contextsBefore, contextsAfter));
        l.add(new ContextCacheSearcher(2, contextsBefore, contextsAfter));
        l.add(new ContextCacheSearcher(3, contextsBefore, contextsAfter));
        l.add(new ContextCacheSearcher(4, contextsBefore, contextsAfter));
        Chain<Searcher> chain = new Chain<>(l);
        Query query = new Query("?mutatecontext=2");
        new Execution(chain, Execution.Context.createContextStub()).search(query);

        assertSame(contextsBefore[0], contextsAfter[0]);
        assertSame(contextsBefore[1], contextsAfter[1]);
        assertSame(contextsBefore[2], contextsAfter[2]);
        assertSame(contextsBefore[3], contextsAfter[3]);
        assertSame(contextsBefore[4], contextsAfter[4]);

        assertSame(contextsBefore[0], contextsBefore[1]);
        assertNotSame(contextsBefore[1], contextsBefore[2]);
        assertSame(contextsBefore[2], contextsBefore[3]);
        assertSame(contextsBefore[3], contextsBefore[4]);
    }
Tests basic search chain execution functionality

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