### Question:
HttpContentCompressor extends HttpContentEncoder { @SuppressWarnings("FloatingPointEquality") protected ZlibWrapper determineWrapper(String acceptEncoding) { float starQ = -1.0f; float gzipQ = -1.0f; float deflateQ = -1.0f; for (String encoding : acceptEncoding.split(",")) { float q = 1.0f; int equalsPos = encoding.indexOf('='); if (equalsPos != -1) { try { q = Float.parseFloat(encoding.substring(equalsPos + 1)); } catch (NumberFormatException e) { q = 0.0f; } } if (encoding.contains("*")) { starQ = q; } else if (encoding.contains("gzip") && q > gzipQ) { gzipQ = q; } else if (encoding.contains("deflate") && q > deflateQ) { deflateQ = q; } } if (gzipQ > 0.0f || deflateQ > 0.0f) { if (gzipQ >= deflateQ) { return ZlibWrapper.GZIP; } else { return ZlibWrapper.ZLIB; } } if (starQ > 0.0f) { if (gzipQ == -1.0f) { return ZlibWrapper.GZIP; } if (deflateQ == -1.0f) { return ZlibWrapper.ZLIB; } } return null; } HttpContentCompressor();  HttpContentCompressor(int compressionLevel);  HttpContentCompressor(int compressionLevel, int windowBits, int memLevel);  HttpContentCompressor(int compressionLevel, int windowBits, int memLevel, int contentSizeThreshold); @Override void handlerAdded(ChannelHandlerContext ctx);  }### Answer:
@Test public void testGetTargetContentEncoding() throws Exception { HttpContentCompressor compressor = new HttpContentCompressor(); String[] tests = { "", null, "*", "gzip", "*;q=0.0", null, "gzip", "gzip", "compress, gzip;q=0.5", "gzip", "gzip; q=0.5, identity", "gzip", "gzip ; q=0.1", "gzip", "gzip; q=0, deflate", "deflate", " deflate ; q=0 , *;q=0.5", "gzip", }; for (int i = 0; i < tests.length; i += 2) { String acceptEncoding = tests[i]; String contentEncoding = tests[i + 1]; ZlibWrapper targetWrapper = compressor.determineWrapper(acceptEncoding); String targetEncoding = null; if (targetWrapper != null) { switch (targetWrapper) { case GZIP: targetEncoding = "gzip"; break; case ZLIB: targetEncoding = "deflate"; break; default: fail(); } } assertEquals(contentEncoding, targetEncoding); } }