public void testEqualsAndHashCode()
{
String hostname1 = "hostname1";
String hostname2 = "hostname2";
HostnameFirewallRule rule = new HostnameFirewallRule(hostname1, hostname2);
HostnameFirewallRule equalRule = new HostnameFirewallRule(hostname1, hostname2);
assertTrue(rule.equals(rule));
assertTrue(rule.equals(equalRule));
assertTrue(equalRule.equals(rule));
assertTrue(rule.hashCode() == equalRule.hashCode());
assertFalse("Different hostnames should cause rules to be unequal",
rule.equals(new HostnameFirewallRule(hostname1, "different-hostname")));
}