@Test
public void buffersContentOfEntityStreamToFileAndReadsAsDataSource() throws Exception {

    when(context.getEverrestConfiguration().getMaxBufferSize()).thenReturn(8);
    DataSource result = dataSourceEntityProvider.readFrom(DataSource.class, null, null, TEXT_PLAIN_TYPE, null, new ByteArrayInputStream(testContent));
    assertTrue(result instanceof FileDataSource);
    byte[] bytes = ByteStreams.toByteArray(result.getInputStream());
    assertArrayEquals(testContent, bytes);
    assertEquals(TEXT_PLAIN, result.getContentType());
}