Skip to content

Instantly share code, notes, and snippets.

@andrealaforgia
Created August 1, 2020 23:37
Show Gist options
  • Save andrealaforgia/d380228a6ac49f00a57b51f0ad796370 to your computer and use it in GitHub Desktop.
Save andrealaforgia/d380228a6ac49f00a57b51f0ad796370 to your computer and use it in GitHub Desktop.
...
@Test
void shouldCompressAndDecompress() throws IOException {
whenCompressingData();
thenDataIsCompressed();
thenCompressedDataShouldBeCorrectlyDecompressed();
andTheCompressionRatioIsPrintedOut();
}
private void andTheCompressionRatioIsPrintedOut() {
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