CompressionServiceProvider { public CompressionService getCompressionService(final DocumentCompression documentCompression) { if (!compressionServices.containsKey(documentCompression)) { throw new MissingCompressionServiceException("No compression service is registered for " + documentCompression + "!"); } return compressionServices.get(documentCompression); } CompressionServiceProvider(final GZIPCompressionService gzipCompressionService,
            final LZMACompressionService lzmaCompressionService); CompressionService getCompressionService(final DocumentCompression documentCompression);  }
@Test void testWhenProviderShouldProvideGzipCompressionService() { final CompressionService result = underTest.getCompressionService(DocumentCompression.GZIP); assertThat(result, is(gzipCompressionService)); }
@Test void testWhenProviderShouldProvideLzmaCompressionService() { final CompressionService result = underTest.getCompressionService(DocumentCompression.LZMA); assertThat(result, is(lzmaCompressionService)); }