### Question:
LZMACompressionFilter extends InputStream implements CompressionStream, Runnable { @Override public Map<String, String> getStreamMetadata() { if(!closed) { throw new IllegalStateException("Stream must be closed before getting metadata"); } Map<String,String> metadata = new HashMap<String, String>(); long compSize = compressedSize.getByteCount(); long uncompSize = uncompressedSize.getByteCount(); String compRatioString = String.format("%.1f%%", 100.0 - (compSize*100.0/uncompSize)); metadata.put(TransformConstants.META_COMPRESSION_UNCOMP_SIZE, ""+uncompSize); metadata.put(TransformConstants.META_COMPRESSION_COMP_SIZE, ""+compSize); metadata.put(TransformConstants.META_COMPRESSION_COMP_RATIO, ""+compRatioString); metadata.put(TransformConstants.META_COMPRESSION_UNCOMP_SHA1, KeyUtils.toHexPadded(digest)); return metadata; } LZMACompressionFilter(InputStream in, int compressionLevel);  LZMACompressionFilter(InputStream in, LzmaProfile compressionProfile); @Override int read(); @Override int read(byte[] b); @Override int read(byte[] b, int off, int len); @Override int available(); @Override long skip(long n); @Override void close(); @Override void run(); @Override Map<String, String> getStreamMetadata();  }### Answer:
@Test public void testCompressionMetadata() throws Exception { LZMACompressionFilter lzma = runCompressMode(new LzmaProfile(16 * 1024, 128, Encoder.EMatchFinderTypeBT2)); Map<String, String> m = lzma.getStreamMetadata(); assertEquals("Uncompressed digest incorrect", "027e997e6b1dfc97b93eb28dc9a6804096d85873", m.get(TransformConstants.META_COMPRESSION_UNCOMP_SHA1)); assertEquals("Compression ratio incorrect", "93.9%", m.get(TransformConstants.META_COMPRESSION_COMP_RATIO)); assertEquals("Uncompressed size incorrect", 2516125, Long.parseLong(m .get(TransformConstants.META_COMPRESSION_UNCOMP_SIZE))); assertEquals("Compressed size incorrect", 154656, Long.parseLong(m .get(TransformConstants.META_COMPRESSION_COMP_SIZE))); }