### Question:
DecompressingEntity extends HttpEntityWrapper { @Override public InputStream getContent() throws IOException { if (super.isStreaming()) { if (content == null) { content = getDecompressingStream(); } return content; } return getDecompressingStream(); } DecompressingEntity(
            final HttpEntity wrapped,
            final InputStreamFactory inputStreamFactory); @Override InputStream getContent(); @Override void writeTo(final OutputStream outStream); @Override String getContentEncoding(); @Override long getContentLength();  }### Answer:
@Test public void testNonStreaming() throws Exception { final CRC32 crc32 = new CRC32(); final StringEntity wrapped = new StringEntity("1234567890", StandardCharsets.US_ASCII); final ChecksumEntity entity = new ChecksumEntity(wrapped, crc32); Assert.assertFalse(entity.isStreaming()); final String s = EntityUtils.toString(entity); Assert.assertEquals("1234567890", s); Assert.assertEquals(639479525L, crc32.getValue()); final InputStream in1 = entity.getContent(); final InputStream in2 = entity.getContent(); Assert.assertTrue(in1 != in2); }
@Test public void testStreaming() throws Exception { final CRC32 crc32 = new CRC32(); final ByteArrayInputStream in = new ByteArrayInputStream("1234567890".getBytes(StandardCharsets.US_ASCII)); final InputStreamEntity wrapped = new InputStreamEntity(in, -1, ContentType.DEFAULT_TEXT); final ChecksumEntity entity = new ChecksumEntity(wrapped, crc32); Assert.assertTrue(entity.isStreaming()); final String s = EntityUtils.toString(entity); Assert.assertEquals("1234567890", s); Assert.assertEquals(639479525L, crc32.getValue()); final InputStream in1 = entity.getContent(); final InputStream in2 = entity.getContent(); Assert.assertTrue(in1 == in2); EntityUtils.consume(entity); EntityUtils.consume(entity); }