Skip to content

Instantly share code, notes, and snippets.

@andrealaforgia
Created August 2, 2020 22:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrealaforgia/21055b1bafa568ba6bd0004942a866d3 to your computer and use it in GitHub Desktop.
Save andrealaforgia/21055b1bafa568ba6bd0004942a866d3 to your computer and use it in GitHub Desktop.
@Test
void shouldCompressAndDecompress() throws IOException {
whenCompressingData();
thenDataIsCompressed();
thenCompressedDataShouldBeCorrectlyDecompressed();
thenTheCompressionRatioIsPrintedOut();
}
private void thenTheCompressionRatioIsPrintedOut() {
long inputSize = TEST_DATA.getBytes().length;
System.out.printf("Input size: %d - Compressed size: %d - Compression ratio: %5.2f%%%n",
inputSize,
compressedStream.size(),
(inputSize-compressedStream.size())*100.0/inputSize);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment