You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by dg...@apache.org on 2003/05/03 01:53:38 UTC
cvs commit: jakarta-commons/validator/src/test/org/apache/commons/validator EmailTest.java
dgraham 2003/05/02 16:53:38
Modified: validator/src/test/org/apache/commons/validator
EmailTest.java
Log:
Added some more tests.
Revision Changes Path
1.9 +48 -38 jakarta-commons/validator/src/test/org/apache/commons/validator/EmailTest.java
Index: EmailTest.java
===================================================================
RCS file: /home/cvs/jakarta-commons/validator/src/test/org/apache/commons/validator/EmailTest.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- EmailTest.java 13 Mar 2003 02:26:25 -0000 1.8
+++ EmailTest.java 2 May 2003 23:53:38 -0000 1.9
@@ -59,7 +59,6 @@
*
*/
-
package org.apache.commons.validator;
import java.io.IOException;
@@ -72,11 +71,11 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-
/**
* <p>Performs Validation Test for e-mail validations.</p>
*
* @author David Winterfeldt
+ * @author David Graham
* @version $Revision$ $Date$
*/
public class EmailTest extends TestCase {
@@ -161,26 +160,34 @@
valueTest(info, true);
}
- /**
- * Tests the e-mail validation.
- */
- public void testEmailExtension() throws ValidatorException {
- // Create bean to run test on.
- ValueBean info = new ValueBean();
-
- info.setValue("jsmith@apache.org");
- valueTest(info, true);
-
- info.setValue("jsmith@apache.com");
- valueTest(info, true);
-
- info.setValue("jsmith@apache.net");
- valueTest(info, true);
-
- info.setValue("jsmith@apache.info");
- valueTest(info, true);
-
- }
+ /**
+ * Tests the e-mail validation.
+ */
+ public void testEmailExtension() throws ValidatorException {
+ // Create bean to run test on.
+ ValueBean info = new ValueBean();
+
+ info.setValue("jsmith@apache.org");
+ valueTest(info, true);
+
+ info.setValue("jsmith@apache.com");
+ valueTest(info, true);
+
+ info.setValue("jsmith@apache.net");
+ valueTest(info, true);
+
+ info.setValue("jsmith@apache.info");
+ valueTest(info, true);
+
+ info.setValue("jsmith@apache.infoo");
+ valueTest(info, false);
+
+ info.setValue("jsmith@apache.");
+ valueTest(info, false);
+
+ info.setValue("jsmith@apache.c");
+ valueTest(info, false);
+ }
/**
* <p>Tests the e-mail validation with a dash in
@@ -212,18 +219,21 @@
}
- /**
- * <p>Tests the e-mail validation with an RCS-noncompliant character in
- * the address.</p>
- */
- public void testEmailWithBogusCharacter() throws ValidatorException {
- // Create bean to run test on.
- ValueBean info = new ValueBean();
-
- info.setValue("andy.noble@\u008fdata-workshop.com");
- valueTest(info, false);
-
- }
+ /**
+ * <p>Tests the e-mail validation with an RCS-noncompliant character in
+ * the address.</p>
+ */
+ public void testEmailWithBogusCharacter() throws ValidatorException {
+ // Create bean to run test on.
+ ValueBean info = new ValueBean();
+
+ info.setValue("andy.noble@\u008fdata-workshop.com");
+ valueTest(info, false);
+
+ // The ' character is valid in an email address.
+ info.setValue("andy.o'reilly@data-workshop.com");
+ valueTest(info, true);
+ }
/**
* Tests the email validation with commas.
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org