You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by lu...@apache.org on 2016/11/25 18:35:24 UTC
struts git commit: Adds additional example URLs to check if
validation works properly
Repository: struts
Updated Branches:
refs/heads/support-2-3 b12864dd3 -> 54dff362f
Adds additional example URLs to check if validation works properly
Project: http://git-wip-us.apache.org/repos/asf/struts/repo
Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/54dff362
Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/54dff362
Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/54dff362
Branch: refs/heads/support-2-3
Commit: 54dff362f50a60084c9ff01ef59516686d26c9f1
Parents: b12864d
Author: Lukasz Lenart <lu...@apache.org>
Authored: Fri Nov 25 19:35:15 2016 +0100
Committer: Lukasz Lenart <lu...@apache.org>
Committed: Fri Nov 25 19:35:15 2016 +0100
----------------------------------------------------------------------
.../opensymphony/xwork2/validator/URLValidatorTest.java | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/struts/blob/54dff362/xwork-core/src/test/java/com/opensymphony/xwork2/validator/URLValidatorTest.java
----------------------------------------------------------------------
diff --git a/xwork-core/src/test/java/com/opensymphony/xwork2/validator/URLValidatorTest.java b/xwork-core/src/test/java/com/opensymphony/xwork2/validator/URLValidatorTest.java
index da9806a..c238081 100644
--- a/xwork-core/src/test/java/com/opensymphony/xwork2/validator/URLValidatorTest.java
+++ b/xwork-core/src/test/java/com/opensymphony/xwork2/validator/URLValidatorTest.java
@@ -17,7 +17,6 @@ package com.opensymphony.xwork2.validator;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.XWorkTestCase;
-import com.opensymphony.xwork2.util.URLUtil;
import com.opensymphony.xwork2.util.ValueStack;
import com.opensymphony.xwork2.validator.validators.URLValidator;
@@ -132,14 +131,18 @@ public class URLValidatorTest extends XWorkTestCase {
public void testValidUrlWithDefaultRegex() throws Exception {
URLValidator validator = new URLValidator();
- Pattern pattern = Pattern.compile(validator.getUrlRegex());
+ Pattern pattern = Pattern.compile(validator.getUrlRegex(), Pattern.CASE_INSENSITIVE);
assertFalse(pattern.matcher("myapp://test.com").matches());
assertFalse(pattern.matcher("myap://test.com").matches());
assertFalse(pattern.matcher("").matches());
assertFalse(pattern.matcher(" ").matches());
assertFalse(pattern.matcher("no url").matches());
- assertFalse(pattern.matcher("http://example.com////////////////////////////////////////////////////////////////////////////////////??").matches());
+ assertFalse(pattern.matcher("http://example.com////////////////////////////////////////////////////////////////////////////////////??").matches());
+
+ assertTrue(pattern.matcher("http://www.legalspace.com/__media__/js/netsoltrademark.php?d=www.a-vos-travaux.fr%2Facheter-un-aspirateur-sans-sac-pas-cher%2F").matches());
+ assertTrue(pattern.matcher("http://www.duadmin.isaev.Infoduadmin.Isaev.info/?a%5B%5D=%3Ca%20href%3Dhttp%3A%2F%2Fwww.aspert.fr%2Fun-seche-cheveux-lisseur-est-il-vraiment-utile%2F%3Eseche%20cheveux%20dyson%20test%3C%2Fa").matches());
+ assertTrue(pattern.matcher("http://netsol-underconstruction-page-monitor-1.com/__media__/js/netsoltrademark.php?d=www.le-soutien-scolaire.fr%2Favis-et-test-comparatifs-des-robots-multifonctions%2F").matches());
assertTrue(pattern.matcher("http://www.opensymphony.com").matches());
assertTrue(pattern.matcher("https://www.opensymphony.com").matches());
@@ -181,7 +184,7 @@ public class URLValidatorTest extends XWorkTestCase {
}
public String getTestingUrl5() {
- return "http://yahoo.com/articles?id=123";
+ return "http://yahoo.com/articles?id=123\n";
}
}