diff options
author | Mikael Grankvist <mgrankvi@vaadin.com> | 2013-01-11 14:44:33 +0200 |
---|---|---|
committer | Mikael Grankvist <mgrankvi@vaadin.com> | 2013-01-11 14:44:33 +0200 |
commit | 71b5cce309028033fc5251dc14449ac7f9c0c704 (patch) | |
tree | de4152c7afdff2a2ab3ad035ac3849b23e827b8d /server/tests | |
parent | 0b6c89db179c03903db2423f4925ad097ce001c7 (diff) | |
download | vaadin-framework-71b5cce309028033fc5251dc14449ac7f9c0c704.tar.gz vaadin-framework-71b5cce309028033fc5251dc14449ac7f9c0c704.zip |
(#10561) Email should be valid for null and empty string.
Created tests for email validator.
Change-Id: I6be05672ff506247da488ad142f63b7337952bab
Diffstat (limited to 'server/tests')
-rw-r--r-- | server/tests/src/com/vaadin/tests/data/validator/TestEmailValidator.java | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/server/tests/src/com/vaadin/tests/data/validator/TestEmailValidator.java b/server/tests/src/com/vaadin/tests/data/validator/TestEmailValidator.java new file mode 100644 index 0000000000..7644b4738c --- /dev/null +++ b/server/tests/src/com/vaadin/tests/data/validator/TestEmailValidator.java @@ -0,0 +1,26 @@ +package com.vaadin.tests.data.validator; + +import junit.framework.TestCase; + +import com.vaadin.data.validator.EmailValidator; + +public class TestEmailValidator extends TestCase { + + private EmailValidator validator = new EmailValidator("Error"); + + public void testEmailValidatorWithNull() { + assertTrue(validator.isValid(null)); + } + + public void testEmailValidatorWithEmptyString() { + assertTrue(validator.isValid("")); + } + + public void testEmailValidatorWithFaultyString() { + assertFalse(validator.isValid("not.an.email")); + } + + public void testEmailValidatorWithOkEmail() { + assertTrue(validator.isValid("my.name@email.com")); + } +} |