@Test
    void testJsonOutput() throws DocumentRetrieverException, IOException {
        ClientParameters params = createParameters()
                .setDocumentIds(asIterator(DOC_ID_1, DOC_ID_2, DOC_ID_3))
                .setJsonOutput(true)
                .build();

        when(mockedSession.syncSend(any())).thenReturn(
                createDocumentReply(DOC_ID_1),
                createDocumentReply(DOC_ID_2),
                createDocumentReply(DOC_ID_3));

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

        verify(mockedSession, times(3)).syncSend(any());
        @SuppressWarnings("unchecked")
        List<Map<String, Object>> feed = Jackson.mapper().readValue(outContent.toByteArray(), List.class);
        assertEquals(DOC_ID_1, feed.get(0).get("id"));
        assertEquals(DOC_ID_2, feed.get(1).get("id"));
        assertEquals(DOC_ID_3, feed.get(2).get("id"));
    }
Test class for {@link DocumentRetriever}

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