### Question:
IPvXCondition extends EntitlementConditionAdaptor { @Deprecated public void setIpRange(List<String> ipRanges) throws EntitlementException { ipRange.clear(); ipList.clear(); if (ipRanges != null) { for (String ipRange : ipRanges) { StringTokenizer st = new StringTokenizer(ipRange, "-"); int tokenCount = st.countTokens(); if (tokenCount == 0) { return; } if (tokenCount > 2) { throw new EntitlementException(INVALID_PROPERTY_VALUE, new String[]{IP_RANGE, ipRange}); } String startIp = st.nextToken(); this.ipRange.add(startIp); ipList.add(stringToIp(startIp)); if (tokenCount == 2) { String endIp = st.nextToken(); this.ipRange.add(endIp); ipList.add(stringToIp(endIp)); } } } } protected  IPvXCondition(Debug debug, T initialStartIp, T initialEndIp, IPVersion version); protected  IPvXCondition(Debug debug, T initialStartIp, T initialEndIp, IPVersion version,
                            String startIp, String endIp, List<String> ipRange, List<String> dnsName); @Override void setState(String state); String getStartIp(); String getEndIp(); void setStartIpAndEndIp(String startIp, String endIp); List<String> getDnsName(); void setDnsName(List<String> dnsName); @Deprecated List<String> getIpRange(); @Deprecated void setIpRange(List<String> ipRanges); @Override String getState(); @Override void validate(); @Override ConditionDecision evaluate(String realm, Subject subject, String resourceName, Map<String, Set<String>> env); @SuppressWarnings("unchecked") String getRequestIp(Map env); String getSessionIp(Subject subject); @Override String toString(); @Override boolean equals(Object obj); @Override int hashCode();  }### Answer:
@Test public void testIsSatisfiedIfIpWithinAnyRange() throws Exception { condition.setIpRange(asList(ip1 + "-" + ip1, ip10 + "-" + ip20)); assertConditionDecision(false, ipMin, NO_DNS_NAME); assertConditionDecision(true, ip1, NO_DNS_NAME); assertConditionDecision(false, ip2, NO_DNS_NAME); assertConditionDecision(false, ip9, NO_DNS_NAME); assertConditionDecision(true, ip10, NO_DNS_NAME); assertConditionDecision(true, ip15, NO_DNS_NAME); assertConditionDecision(true, ip20, NO_DNS_NAME); assertConditionDecision(false, ip21, NO_DNS_NAME); }
@Test(dataProvider = "invalidIpAddresses", expectedExceptions = EntitlementException.class) public void testStartIpOfRangeMustBeValidIfSet(String invalidStartIp) throws EntitlementException { condition.setIpRange(asList(invalidStartIp)); }
@Test(dataProvider = "invalidIpAddresses", expectedExceptions = EntitlementException.class) public void testEndIpOfRangeMustBeValidIfSet(String invalidEndIp) throws EntitlementException { condition.setIpRange(asList(ipMin + "-" + invalidEndIp)); }