@SuppressWarnings("unchecked")
    @Test
    void testProcessingHandlerSupportsAsyncUnorderedRendering() {
        // Set up
        ProcessorLibrary.FutureDataSource futureDataSource1 = new ProcessorLibrary.FutureDataSource();
        ProcessorLibrary.FutureDataSource futureDataSource2 = new ProcessorLibrary.FutureDataSource();
        Chain<Processor> chain =
                new Chain<>("federation",
                        new ProcessorLibrary.Federator(false, new Chain<Processor>(futureDataSource1),
                                new Chain<Processor>(futureDataSource2)));
        List<Chain<Processor>> chains = new ArrayList<>();
        chains.add(chain);
        driver = new ProcessingTestDriver(chains);

        ProcessingTestDriver.MockResponseHandler responseHandler = driver.sendRequest("http://localhost/?chain=federation");
        assertEquals(
                "{\"datalist\":[",
                responseHandler.read());
        assertEquals(0, responseHandler.available(), "No more data is available at this point");

        // Complete second async data first
        futureDataSource2.incomingData.get(0).addLast(new ProcessorLibrary.StringData(null, "d2"));
        assertEquals(
                "{\"datalist\":[" +
                        "{\"data\":\"d2\"}" +
                        "]}",
                responseHandler.read());

        // Now complete first async data (which is therefore rendered last)
        futureDataSource1.incomingData.get(0).addLast(new ProcessorLibrary.StringData(null, "d1"));
        assertEquals(
                "," +
                        "{\"datalist\":[" +
                        "{\"data\":\"d1\"}" +
                        "]}",
                responseHandler.read());
        assertEquals(
                "]}",
                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