@Test
    public void testMessageTracing() {
        VisitorParameters visitorParameters = createVisitorParameters("");
        visitorParameters.setTraceLevel(7);
        MockComponents mc = createDefaultMock(visitorParameters);
        mc.visitorSession.start();
        mc.executor.expectAndProcessTasks(1);

        final TraceNode traceNodes[] = {
                new TraceNode().addChild("hello"),
                new TraceNode().addChild("world")
        };

        for (int i = 0; i < 2; ++i) {
            final int idx = i;
            replyToCreateVisitor(mc.sender, (reply) -> reply.getTrace().getRoot().addChild(traceNodes[idx]));
        }
        mc.executor.expectAndProcessTasks(2);
        mc.executor.expectNoTasks();
        assertTrue(mc.controlHandler.isDone());

        Trace trace = mc.visitorSession.getTrace();
        assertNotNull(trace);
        assertEquals(7, trace.getLevel());
        assertEquals(
                "<trace>\n" +
                "    <trace>\n" +
                "        <trace>\n" +
                "            hello\n" +
                "        </trace>\n" +
                "    </trace>\n" +
                "    <trace>\n" +
                "        <trace>\n" +
                "            world\n" +
                "        </trace>\n" +
                "    </trace>\n" +
                "</trace>\n",
                trace.toString());
    }
Test assembly of message traces in session. Trace level propagation
is already tested elsewhere.
documentapi/src/test/java/com/yahoo/documentapi/messagebus/MessageBusVisitorSessionTestCase.java