@SuppressWarnings("unchecked")
    @Test
    void testStreamedRendering() throws Exception {
        // Set up
        Chain<Processor> streamChain = new Chain<>(new StreamProcessor());

        ProcessorLibrary.ListenableFutureDataSource futureDataSource = new ProcessorLibrary.ListenableFutureDataSource();
        Chain<Processor> mainChain = new Chain<>("main", new ProcessorLibrary.StreamProcessingInitiator(streamChain), futureDataSource);
        driver = new ProcessingTestDriver(mainChain);

        ProcessingTestDriver.MockResponseHandler responseHandler = driver.sendRequest("http://localhost/?chain=main");

        // Add one data element
        futureDataSource.incomingData.get().add(new MapData(null));
        assertEquals(
                "{\"datalist\":[" +
                        "{\"data\":\"map data: {streamProcessed=true}\"}",
                responseHandler.read()
        );
        // add another
        futureDataSource.incomingData.get().add(new MapData(null));
        assertEquals(
                ",{\"data\":\"map data: {streamProcessed=true}\"}",
                responseHandler.read());

        // add last
        futureDataSource.incomingData.get().addLast(new MapData(null));
        assertEquals(
                ",{\"data\":\"map data: {streamProcessed=true}\"}]}",
                responseHandler.read());

        assertNull(responseHandler.read(), "Transmission completed");
    }
Tests that the ResponseStatus takes precedence over errors
container-core/src/test/java/com/yahoo/processing/handler/ProcessingHandlerTestCase.java