@Test
public void writesStreamingOutputToOutputStream() throws Exception {

    StreamingOutput streamingOutput = mock(StreamingOutput.class);
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    byte[] streamingOutputContent = "streaming output".getBytes();
    doAnswer(invocation -> {
        out.write(streamingOutputContent);
        return null;
    }).when(streamingOutput).write(out);
    streamOutputEntityProvider.writeTo(streamingOutput, String.class, null, null, null, new MultivaluedHashMap<>(), out);
    assertArrayEquals(streamingOutputContent, out.toByteArray());
}