@Test
public void testCombinedEntityBasics() throws Exception {
final HttpEntity httpEntity = mock(HttpEntity.class);
when(httpEntity.getContent()).thenReturn(
new ByteArrayInputStream(new byte[] { 6, 7, 8, 9, 10 }));
final ByteArrayBuffer buf = new ByteArrayBuffer(1024);
final byte[] tmp = new byte[] { 1, 2, 3, 4, 5 };
buf.append(tmp, 0, tmp.length);
final CombinedEntity entity = new CombinedEntity(httpEntity, buf);
Assert.assertEquals(-1, entity.getContentLength());
Assert.assertFalse(entity.isRepeatable());
Assert.assertTrue(entity.isStreaming());
Assert.assertArrayEquals(new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }, EntityUtils.toByteArray(entity));
verify(httpEntity).getContent();
entity.close();
verify(httpEntity).close();
}