You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ni...@apache.org on 2011/11/28 13:42:03 UTC

svn commit: r1207110 - /commons/proper/validator/trunk/src/test/java/org/apache/commons/validator/routines/EmailValidatorTest.java

Author: nick
Date: Mon Nov 28 12:42:01 2011
New Revision: 1207110

URL: http://svn.apache.org/viewvc?rev=1207110&view=rev
Log:
Unit tests for VALIDATOR-296 - / and ! in domain part of emails

Modified:
    commons/proper/validator/trunk/src/test/java/org/apache/commons/validator/routines/EmailValidatorTest.java

Modified: commons/proper/validator/trunk/src/test/java/org/apache/commons/validator/routines/EmailValidatorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/validator/trunk/src/test/java/org/apache/commons/validator/routines/EmailValidatorTest.java?rev=1207110&r1=1207109&r2=1207110&view=diff
==============================================================================
--- commons/proper/validator/trunk/src/test/java/org/apache/commons/validator/routines/EmailValidatorTest.java (original)
+++ commons/proper/validator/trunk/src/test/java/org/apache/commons/validator/routines/EmailValidatorTest.java Mon Nov 28 12:42:01 2011
@@ -206,6 +206,25 @@ public class EmailValidatorTest extends 
              noLocal.isValid("joe@localhost")
        );
     }
+    
+    /**
+     * VALIDATOR-296 - A / or a ! is valid in the user part,
+     *  but not in the domain part 
+     */
+    public void testEmailWithSlashes() {
+       assertTrue(
+             "/ and ! valid in username",
+             validator.isValid("joe!/blow@apache.org")
+       );
+       assertFalse(
+             "/ not valid in domain",
+             validator.isValid("joe@ap/ache.org")
+       );
+       assertFalse(
+             "! not valid in domain",
+             validator.isValid("joe@apac!he.org")
+       );
+    }
 
     /**
      * Write this test according to parts of RFC, as opposed to the type of character