@Test
    void testTrace() throws DocumentRetrieverException {
        final int traceLevel = 9;
        ClientParameters params = createParameters()
                .setDocumentIds(asIterator(DOC_ID_1))
                .setTraceLevel(traceLevel)
                .build();

        GetDocumentReply reply = new GetDocumentReply(new Document(DataType.DOCUMENT, new DocumentId(DOC_ID_1)));
        reply.getTrace().getRoot().addChild("childnode");
        when(mockedSession.syncSend(any())).thenReturn(reply);

        DocumentRetriever documentRetriever = createDocumentRetriever(params);
        documentRetriever.retrieveDocuments();

        verify(mockedSession, times(1)).setTraceLevel(traceLevel);
        assertTrue(outContent.toString().contains("<trace>"));
    }
Test class for {@link DocumentRetriever}

@author bjorncs
vespaclient-java/src/test/java/com/yahoo/vespaget/DocumentRetrieverTest.java