Commit 879de45b authored by Tigran Mkrtchyan's avatar Tigran Mkrtchyan
Browse files

junit: add more tests for IP matcher

parent 049bc90f
......@@ -110,12 +110,31 @@ public class IPMatcherTest {
boolean match = IPMatcher.match( InetAddress.getByName("131.169.214.0") ,
InetAddress.getByName("131.169.40.255") ,
16);
InetAddress.getByName("131.169.40.255"), 16);
assertTrue("failed to match host by netmask", match);
}
@Test
public void testIpBased2() throws UnknownHostException {
boolean match = IPMatcher.match( InetAddress.getByName("131.169.40.16") ,
InetAddress.getByName("131.169.40.0"), 28);
assertFalse("Wrong subnet matched", match);
}
@Test
public void testIpBased3() throws UnknownHostException {
boolean match = IPMatcher.match( InetAddress.getByName("131.169.40.15") ,
InetAddress.getByName("131.169.40.0"), 28);
assertTrue("subnet not matched", match);
}
@Test
public void testIpBasedNegative() throws UnknownHostException {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment