### Question:
IPvXCondition extends EntitlementConditionAdaptor { public void setDnsName(List<String> dnsName) throws EntitlementException { if (dnsName != null) { for (String dnsNameEntry : dnsName) { if (!isValidDnsName(dnsNameEntry)) { throw new EntitlementException(INVALID_PROPERTY_VALUE, new String[]{DNS_NAME, dnsNameEntry}); } } } this.dnsName = dnsName; } 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 testIsSatisfiedIfDnsNameMatchesExactly() throws Exception { condition.setDnsName(asList("example.com", "example.net")); assertConditionDecision(true, NO_IP_ADDRESS, "example.com"); assertConditionDecision(true, NO_IP_ADDRESS, "example.net"); assertConditionDecision(false, NO_IP_ADDRESS, "www.example.com"); }
@Test public void testIsSatisfiedIfDnsNameMatchesSubDomainWildcardPattern() throws Exception { condition.setDnsName(asList("*.example.com", "*.example.net")); assertConditionDecision(false, NO_IP_ADDRESS, "example.com"); assertConditionDecision(true, NO_IP_ADDRESS, "www.example.com"); assertConditionDecision(true, NO_IP_ADDRESS, "www.example.net"); }
@Test public void testIsSatisfiedIfDnsNameMatchesAnyDomainWildcardPattern() throws Exception { condition.setDnsName(asList("*")); assertConditionDecision(true, NO_IP_ADDRESS, "any.domain.com"); }
@Test(dataProvider = "invalidDnsNames", expectedExceptions = EntitlementException.class) public void testInvalidDnsNamesAreRejected(String invalidDnsName) throws EntitlementException { condition.setDnsName(asList(invalidDnsName)); }