@Test public void testIsValidCompressFormat_null() { boolean isValid = true; try { isValid = CompressorFactory.isValidCompressFormat(null); } catch (CompressionException e) { isValid = false; } Assert.assertFalse(isValid); }
public static boolean isValidCompressFormat(final String compressFormat) throws CompressionException { if (!StringUtils.hasText(compressFormat)) { throw new CompressionException("Compress format is either null or empty!"); } else if (compressFormat.equalsIgnoreCase(GZIP_COMPRESS_FORMAT) || compressFormat.equalsIgnoreCase(DEFLATE_COMPRESS_FORMAT)) { return true; } else { throw new CompressionException("There is no compression technique for the given compress format : " + compressFormat); } }
CompressorFactory { public static boolean isValidCompressFormat(final String compressFormat) throws CompressionException { if (!StringUtils.hasText(compressFormat)) { throw new CompressionException("Compress format is either null or empty!"); } else if (compressFormat.equalsIgnoreCase(GZIP_COMPRESS_FORMAT) || compressFormat.equalsIgnoreCase(DEFLATE_COMPRESS_FORMAT)) { return true; } else { throw new CompressionException("There is no compression technique for the given compress format : " + compressFormat); } } }
CompressorFactory { public static boolean isValidCompressFormat(final String compressFormat) throws CompressionException { if (!StringUtils.hasText(compressFormat)) { throw new CompressionException("Compress format is either null or empty!"); } else if (compressFormat.equalsIgnoreCase(GZIP_COMPRESS_FORMAT) || compressFormat.equalsIgnoreCase(DEFLATE_COMPRESS_FORMAT)) { return true; } else { throw new CompressionException("There is no compression technique for the given compress format : " + compressFormat); } } private  CompressorFactory(); }
CompressorFactory { public static boolean isValidCompressFormat(final String compressFormat) throws CompressionException { if (!StringUtils.hasText(compressFormat)) { throw new CompressionException("Compress format is either null or empty!"); } else if (compressFormat.equalsIgnoreCase(GZIP_COMPRESS_FORMAT) || compressFormat.equalsIgnoreCase(DEFLATE_COMPRESS_FORMAT)) { return true; } else { throw new CompressionException("There is no compression technique for the given compress format : " + compressFormat); } } private  CompressorFactory(); static CompressorFactory getInstance(); static ICompressor getCompressor(final String compressFormat); static boolean isValidCompressFormat(final String compressFormat); }
CompressorFactory { public static boolean isValidCompressFormat(final String compressFormat) throws CompressionException { if (!StringUtils.hasText(compressFormat)) { throw new CompressionException("Compress format is either null or empty!"); } else if (compressFormat.equalsIgnoreCase(GZIP_COMPRESS_FORMAT) || compressFormat.equalsIgnoreCase(DEFLATE_COMPRESS_FORMAT)) { return true; } else { throw new CompressionException("There is no compression technique for the given compress format : " + compressFormat); } } 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; }