public void testWildcard() throws Exception
{
// Test xxx.xxx.*
assertFalse(new NetworkFirewallRule("192.168.*")
.matches(InetAddress.getByName("192.169.1.0")));
assertTrue(new NetworkFirewallRule("192.168.*")
.matches(InetAddress.getByName("192.168.1.0")));
assertTrue(new NetworkFirewallRule("192.168.*")
.matches(InetAddress.getByName("192.168.255.255")));
// Test xxx.xxx.xxx.*
assertFalse(new NetworkFirewallRule("192.168.1.*")
.matches(InetAddress.getByName("192.169.2.0")));
assertTrue(new NetworkFirewallRule("192.168.1.*")
.matches(InetAddress.getByName("192.168.1.0")));
assertTrue(new NetworkFirewallRule("192.168.1.*")
.matches(InetAddress.getByName("192.168.1.255")));
}