### Question:
RangerIpMatcher extends RangerAbstractConditionEvaluator { String digestPolicyIp(final String policyIp) { if (LOG.isDebugEnabled()) { LOG.debug("==> RangerIpMatcher.digestPolicyIp(" + policyIp + ")"); } String result; Matcher matcher = allWildcards.matcher(policyIp); if (matcher.matches()) { if (LOG.isDebugEnabled()) { LOG.debug("digestPolicyIp: policyIP[" + policyIp +"] all wildcards."); } result = ""; } else if (policyIp.contains(".")) { matcher = trailingWildcardsIp4.matcher(policyIp); result = matcher.replaceFirst("."); } else { matcher = trailingWildcardsIp6.matcher(policyIp); result = matcher.replaceFirst(":").toLowerCase(); } if (LOG.isDebugEnabled()) { LOG.debug("<== RangerIpMatcher.digestPolicyIp(" + policyIp + "): " + policyIp); } return result; }  @Override void init(); @Override boolean isMatched(final RangerAccessRequest request);  }### Answer:
@Test public void test_digestIp() { RangerIpMatcher matcher = new RangerIpMatcher(); assertEquals("", matcher.digestPolicyIp("*")); assertEquals("", matcher.digestPolicyIp("*.*")); assertEquals("", matcher.digestPolicyIp("*.*.*")); assertEquals("", matcher.digestPolicyIp("*.*.*.*")); assertEquals("", matcher.digestPolicyIp("*:*:*:*")); assertEquals("", matcher.digestPolicyIp("*:*:*:*:*:*")); assertEquals("10.", matcher.digestPolicyIp("10.*")); assertEquals("10.", matcher.digestPolicyIp("10.*.*")); assertEquals("10.", matcher.digestPolicyIp("10.*.*.*")); assertEquals("10.20.", matcher.digestPolicyIp("10.20.*")); assertEquals("10.20.", matcher.digestPolicyIp("10.20.*.*")); assertEquals("10.20.30.", matcher.digestPolicyIp("10.20.30.*")); assertEquals("a0:", matcher.digestPolicyIp("A0:*")); assertEquals("a0:", matcher.digestPolicyIp("a0:*:*")); assertEquals("a0:", matcher.digestPolicyIp("A0:*:*:*")); assertEquals("a0:b0:c0:", matcher.digestPolicyIp("A0:B0:C0:*")); }