private void testQueryInTrace(boolean expectQueryInTrace, String queryParameters) {
        Query query = new Query("?query=foo&trace.level=1&" + queryParameters);
        Chain<Searcher> chain = new Chain<>(new Tracer("tracer1", true));
        Execution execution = new Execution(chain, Execution.Context.createContextStub());
        Result result = execution.search(query);
        Iterator<String> trace = collectTrace(query).iterator();
        assertEquals("(level start)", trace.next());
        assertEquals("  No query profile is used", trace.next());
        assertEquals("  (level start)", trace.next());
        if (expectQueryInTrace)
            assertEquals("    During tracer1: 0: [WEAKAND(100) foo]", trace.next());
        else
            assertEquals("    During tracer1: 0", trace.next());
    }
Tests tracing scenarios where traces from multiple executions over the same query are involved.

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