Created
August 2, 2020 22:24
-
-
Save andrealaforgia/21055b1bafa568ba6bd0004942a866d3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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