From 13828056b47a25e7ddee80a042a6a8d3b670ff32 Mon Sep 17 00:00:00 2001 From: Stefaan Dutry Date: Thu, 3 Aug 2017 19:01:14 +0200 Subject: [PATCH] added tests for valid urls with default regex consisting of ip-address --- .../xwork2/validator/URLValidatorTest.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/core/src/test/java/com/opensymphony/xwork2/validator/URLValidatorTest.java b/core/src/test/java/com/opensymphony/xwork2/validator/URLValidatorTest.java index baa2bb1ca0..3a39573b0c 100644 --- a/core/src/test/java/com/opensymphony/xwork2/validator/URLValidatorTest.java +++ b/core/src/test/java/com/opensymphony/xwork2/validator/URLValidatorTest.java @@ -168,6 +168,19 @@ public void testValidUrlWithDefaultRegex() throws Exception { //this will cause test to hang indefinitely using JDK 1.8.0_121, Struts 2.5.10.1 and JUnit 4.5 assertTrue(pattern.matcher("http://wargame.ch/wc/acw/sub/aotm/guestbook/index.php?page3D183EClearwater20Roofing20Contractors3C/a3E3Ekaldu20non20msg3C/a3E").matches()); assertTrue(UrlValidator.getInstance().isValid("http://wargame.ch/wc/acw/sub/aotm/guestbook/index.php?page3D183EClearwater20Roofing20Contractors3C/a3E3Ekaldu20non20msg3C/a3E")); + + assertTrue(pattern.matcher("http://253.254.255.1").matches()); + assertTrue(UrlValidator.getInstance().isValid("http://253.254.255.1")); + + assertTrue(pattern.matcher("http://253.254.255.12").matches()); + assertTrue(UrlValidator.getInstance().isValid("http://253.254.255.12")); + + assertTrue(pattern.matcher("http://1.2.3.100").matches()); + assertTrue(UrlValidator.getInstance().isValid("http://1.2.3.100")); + + assertTrue(pattern.matcher("http://1.2.3.255").matches()); + assertTrue(UrlValidator.getInstance().isValid("http://1.2.3.255")); + } public void testLongRunningValidations() throws Exception {