@Test public void testInvalidCidr() { Assert.assertFalse(validator.isValid("192.168.0.1", context)); Assert.assertFalse(validator.isValid("192.168.0.1/", context)); Assert.assertFalse(validator.isValid("", context)); Assert.assertFalse(validator.isValid(" ", context)); Assert.assertFalse(validator.isValid("/", context)); Assert.assertFalse(validator.isValid("/24", context)); Assert.assertFalse(validator.isValid("192.168.0.1/24/18", context)); Assert.assertFalse(validator.isValid("192.168.0.500/24", context)); Assert.assertFalse(validator.isValid("192.168.0.1/0", context)); Assert.assertFalse(validator.isValid("192.168.0.1/a", context)); Assert.assertFalse(validator.isValid("192.168.0.a/24", context)); Assert.assertFalse(validator.isValid("192.168.0.1/32", context)); }
@Test public void testValidCidr() { Assert.assertTrue(validator.isValid("192.168.0.1/1", context)); Assert.assertTrue(validator.isValid("192.168.0.1/24", context)); Assert.assertTrue(validator.isValid("192.168.0.1/31", context)); }
@Test public void testNull() { Assert.assertFalse(validator.isValid(null, context)); }