struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lukaszlen...@apache.org
Subject [3/4] struts git commit: added tests for valid urls with default regex consisting of ip-address
Date Mon, 07 Aug 2017 05:55:36 GMT
added tests for valid urls with default regex consisting of ip-address


Project: http://git-wip-us.apache.org/repos/asf/struts/repo
Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/13828056
Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/13828056
Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/13828056

Branch: refs/heads/master
Commit: 13828056b47a25e7ddee80a042a6a8d3b670ff32
Parents: 418a20c
Author: Stefaan Dutry <stefaan.dutry@gmail.com>
Authored: Thu Aug 3 19:01:14 2017 +0200
Committer: Stefaan Dutry <stefaan.dutry@gmail.com>
Committed: Thu Aug 3 19:01:14 2017 +0200

----------------------------------------------------------------------
 .../xwork2/validator/URLValidatorTest.java             | 13 +++++++++++++
 1 file changed, 13 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/13828056/core/src/test/java/com/opensymphony/xwork2/validator/URLValidatorTest.java
----------------------------------------------------------------------
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 baa2bb1..3a39573 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 class URLValidatorTest extends XWorkTestCase {
         //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 {


Mime
View raw message