Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@apache.org Received: (qmail 11798 invoked from network); 2 May 2003 23:53:41 -0000 Received: from exchange.sun.com (192.18.33.10) by daedalus.apache.org with SMTP; 2 May 2003 23:53:41 -0000 Received: (qmail 27733 invoked by uid 97); 2 May 2003 23:55:50 -0000 Delivered-To: qmlist-jakarta-archive-commons-dev@nagoya.betaversion.org Received: (qmail 27726 invoked from network); 2 May 2003 23:55:49 -0000 Received: from daedalus.apache.org (HELO apache.org) (208.185.179.12) by nagoya.betaversion.org with SMTP; 2 May 2003 23:55:49 -0000 Received: (qmail 11541 invoked by uid 500); 2 May 2003 23:53:39 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 11530 invoked by uid 500); 2 May 2003 23:53:39 -0000 Received: (qmail 11527 invoked from network); 2 May 2003 23:53:39 -0000 Received: from icarus.apache.org (208.185.179.13) by daedalus.apache.org with SMTP; 2 May 2003 23:53:39 -0000 Received: (qmail 62960 invoked by uid 1581); 2 May 2003 23:53:38 -0000 Date: 2 May 2003 23:53:38 -0000 Message-ID: <20030502235338.62951.qmail@icarus.apache.org> From: dgraham@apache.org To: jakarta-commons-cvs@apache.org Subject: cvs commit: jakarta-commons/validator/src/test/org/apache/commons/validator EmailTest.java X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N 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; - /** *

Performs Validation Test for e-mail validations.

* * @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); + } /** *

Tests the e-mail validation with a dash in @@ -212,18 +219,21 @@ } - /** - *

Tests the e-mail validation with an RCS-noncompliant character in - * the address.

- */ - 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); - - } + /** + *

Tests the e-mail validation with an RCS-noncompliant character in + * the address.

+ */ + 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