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 da9806a96c..c2380810e2 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 @@ 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 void testValidUrlWithRegexExpression() throws Exception { 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 String getTestingUrl4() { } public String getTestingUrl5() { - return "http://yahoo.com/articles?id=123"; + return "http://yahoo.com/articles?id=123\n"; } }