@Test public void testCompressShouldReturnABtyeArrayOutputStream() throws IOException { given(source.read((byte[]) Mockito.any())).willReturn(-1); ByteArrayOutputStream actual = underTest.compress(source); assertEquals(actual, baos); }
@Override public ByteArrayOutputStream compress(final InputStream inputStream) { InputStream source = inputStream; ByteArrayOutputStream baos = outputStreamFactory.createByteArrayOutputStream(); try { GZIPOutputStream gout = gzipOutputStreamFactory.createOutputStream(baos); IOUtils.copy(source, gout); gout.finish(); gout.close(); } catch (IOException e) { throw new SystemException("Could not gzip message body!", e); } return baos; }
GzipCompressionService implements CompressionService { @Override public ByteArrayOutputStream compress(final InputStream inputStream) { InputStream source = inputStream; ByteArrayOutputStream baos = outputStreamFactory.createByteArrayOutputStream(); try { GZIPOutputStream gout = gzipOutputStreamFactory.createOutputStream(baos); IOUtils.copy(source, gout); gout.finish(); gout.close(); } catch (IOException e) { throw new SystemException("Could not gzip message body!", e); } return baos; } }
GzipCompressionService implements CompressionService { @Override public ByteArrayOutputStream compress(final InputStream inputStream) { InputStream source = inputStream; ByteArrayOutputStream baos = outputStreamFactory.createByteArrayOutputStream(); try { GZIPOutputStream gout = gzipOutputStreamFactory.createOutputStream(baos); IOUtils.copy(source, gout); gout.finish(); gout.close(); } catch (IOException e) { throw new SystemException("Could not gzip message body!", e); } return baos; }  }
GzipCompressionService implements CompressionService { @Override public ByteArrayOutputStream compress(final InputStream inputStream) { InputStream source = inputStream; ByteArrayOutputStream baos = outputStreamFactory.createByteArrayOutputStream(); try { GZIPOutputStream gout = gzipOutputStreamFactory.createOutputStream(baos); IOUtils.copy(source, gout); gout.finish(); gout.close(); } catch (IOException e) { throw new SystemException("Could not gzip message body!", e); } return baos; }  @Override ByteArrayOutputStream compress(final InputStream inputStream); @Override ByteArrayOutputStream decompress(final InputStream inputStream); }
GzipCompressionService implements CompressionService { @Override public ByteArrayOutputStream compress(final InputStream inputStream) { InputStream source = inputStream; ByteArrayOutputStream baos = outputStreamFactory.createByteArrayOutputStream(); try { GZIPOutputStream gout = gzipOutputStreamFactory.createOutputStream(baos); IOUtils.copy(source, gout); gout.finish(); gout.close(); } catch (IOException e) { throw new SystemException("Could not gzip message body!", e); } return baos; }  @Override ByteArrayOutputStream compress(final InputStream inputStream); @Override ByteArrayOutputStream decompress(final InputStream inputStream);  }