@Test
    final void test() throws InterruptedException, ExecutionException,
            IOException {
        String rawExpected = "{"
                + "    \"root\": {"
                + "        \"children\": ["
                + "            {"
                + "                \"id\": \"yahoo1\","
                + "                \"relevance\": 1.0"
                + "            },"
                + "            {"
                + "                \"id\": \"yahoo2\","
                + "                \"relevance\": 1.0"
                + "            }"
                + "        ],"
                + "        \"fields\": {"
                + "            \"totalCount\": 0"
                + "        },"
                + "        \"id\": \"yahoo\","
                + "        \"relevance\": 1.0"
                + "    }"
                + "}";
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        HitGroup h = new InstrumentedGroup("yahoo");
        h.incoming().add(new Hit("yahoo1"));
        JsonRenderer renderer = new JsonRenderer();
        Result result = new Result(new Query(), h);
        renderer.init();
        CompletableFuture<Boolean> f = renderer.renderResponse(out, result,
                new Execution(Execution.Context.createContextStub()),
                result.getQuery());
        WrappedFuture<DataList<Hit>> x = (WrappedFuture<DataList<Hit>>) h.incoming().completedFuture();
        x.isListening.get(86_400_000);
        h.incoming().add(new Hit("yahoo2"));
        h.incoming().markComplete();
        Boolean b = f.get();
        assertTrue(b);
        String rawGot = Utf8.toString(out.toByteArray());
        Map<?, ?> expected = Jackson.mapper().readValue(rawExpected, Map.class);
        Map<?, ?> got = Jackson.mapper().readValue(rawGot, Map.class);
        assertEquals(expected, got);
    }
Test adding hits to a hit group during rendering.

@author <a href="mailto:steinar@yahoo-inc.com">Steinar Knutsen</a>
container-search/src/test/java/com/yahoo/search/rendering/AsyncGroupPopulationTestCase.java