@Test
public void shouldCreateSuccessResponseWithLargeStreamEntity() throws IOException {

    Response response = JSONResponse.createResponse(Status.OK, new LargeEntity(), null);
    assertThat(response.getStatus(), is(200));
    assertThat(response.getMediaType(), is(MediaType.APPLICATION_JSON_TYPE));
    Object entity = response.getEntity();
    assertThat(entity.getClass(), is(typeCompatibleWith(InputStream.class)));
    try (InputStream entityInStream = (InputStream) entity) {
        String largeEntityJSON = new String(entityInStream.readAllBytes(), StandardCharsets.UTF_8);
        assertThat(largeEntityJSON, is(notNullValue()));
        assertTrue(largeEntityJSON.startsWith("{"));
        assertTrue(largeEntityJSON.endsWith("}"));
    }
}