### Question:
PartiallyRepeatableHttpEntity extends HttpEntityWrapper { @Override public void writeTo( final OutputStream stream ) throws IOException { IOUtils.copy( getContent(), stream ); } PartiallyRepeatableHttpEntity(final HttpEntity entity, int bufferSize);  PartiallyRepeatableHttpEntity(final HttpEntity entity); @Override boolean isRepeatable(); @Override boolean isStreaming(); @Override boolean isChunked(); @Override long getContentLength(); @Override InputStream getContent(); @Override void writeTo( final OutputStream stream ); @Override @SuppressWarnings( "deprecation" ) void consumeContent(); static final int DEFAULT_BUFFER_SIZE; }### Answer:
@Test public void testWriteTo() throws Exception { String input = "0123456789"; BasicHttpEntity basic; PartiallyRepeatableHttpEntity replay; basic = new BasicHttpEntity(); basic.setContent( new ByteArrayInputStream( input.getBytes( StandardCharsets.UTF_8 ) ) ); replay = new PartiallyRepeatableHttpEntity( basic, 5 ); ByteArrayOutputStream buffer = new ByteArrayOutputStream(); replay.writeTo( buffer ); String output = new String( buffer.toByteArray(), StandardCharsets.UTF_8 ); assertThat( output, is( input ) ); }