@Test public void testGetCompressor_others() { boolean isException = false; try { CompressorFactory.getCompressor("others"); } catch (CompressionException e) { isException = true; } Assert.assertTrue(isException); }
public static ICompressor getCompressor(final String compressFormat) throws CompressionException { ICompressor compressor = null; if (isValidCompressFormat(compressFormat)) { if (compressFormat.equalsIgnoreCase(GZIP_COMPRESS_FORMAT)) { compressor = new GZIPCompressor(); } else if (compressFormat.equalsIgnoreCase(DEFLATE_COMPRESS_FORMAT)) { compressor = new DeflateCompressor(); } } return compressor; }
CompressorFactory { public static ICompressor getCompressor(final String compressFormat) throws CompressionException { ICompressor compressor = null; if (isValidCompressFormat(compressFormat)) { if (compressFormat.equalsIgnoreCase(GZIP_COMPRESS_FORMAT)) { compressor = new GZIPCompressor(); } else if (compressFormat.equalsIgnoreCase(DEFLATE_COMPRESS_FORMAT)) { compressor = new DeflateCompressor(); } } return compressor; } }
CompressorFactory { public static ICompressor getCompressor(final String compressFormat) throws CompressionException { ICompressor compressor = null; if (isValidCompressFormat(compressFormat)) { if (compressFormat.equalsIgnoreCase(GZIP_COMPRESS_FORMAT)) { compressor = new GZIPCompressor(); } else if (compressFormat.equalsIgnoreCase(DEFLATE_COMPRESS_FORMAT)) { compressor = new DeflateCompressor(); } } return compressor; } private  CompressorFactory(); }
CompressorFactory { public static ICompressor getCompressor(final String compressFormat) throws CompressionException { ICompressor compressor = null; if (isValidCompressFormat(compressFormat)) { if (compressFormat.equalsIgnoreCase(GZIP_COMPRESS_FORMAT)) { compressor = new GZIPCompressor(); } else if (compressFormat.equalsIgnoreCase(DEFLATE_COMPRESS_FORMAT)) { compressor = new DeflateCompressor(); } } return compressor; } private  CompressorFactory(); static CompressorFactory getInstance(); static ICompressor getCompressor(final String compressFormat); static boolean isValidCompressFormat(final String compressFormat); }
CompressorFactory { public static ICompressor getCompressor(final String compressFormat) throws CompressionException { ICompressor compressor = null; if (isValidCompressFormat(compressFormat)) { if (compressFormat.equalsIgnoreCase(GZIP_COMPRESS_FORMAT)) { compressor = new GZIPCompressor(); } else if (compressFormat.equalsIgnoreCase(DEFLATE_COMPRESS_FORMAT)) { compressor = new DeflateCompressor(); } } return compressor; } private  CompressorFactory(); static CompressorFactory getInstance(); static ICompressor getCompressor(final String compressFormat); static boolean isValidCompressFormat(final String compressFormat); static final String GZIP_COMPRESS_FORMAT; static final String DEFLATE_COMPRESS_FORMAT; }