-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Email address format validation (#312)
* Email address format validation * Update regx for email format * Allowing empty email in email format validation to avoid schematron validation duplication
- Loading branch information
Showing
8 changed files
with
106 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -83,4 +83,6 @@ | |
<ECThesaurusOrg>Thesaurus cited responsible party organisation is required</ECThesaurusOrg> | ||
<ECThesaurusRole>Thesaurus cited responsible party role is required</ECThesaurusRole> | ||
<ECThesaurusEmail>Thesaurus cited responsible party email is required</ECThesaurusEmail> | ||
|
||
<ElectronicMailFormat>Electronic mail address format is invalid (for example [email protected])</ElectronicMailFormat> | ||
</strings> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,4 +56,6 @@ | |
<ResourceDescriptionContentType>Online resource description content type is not valid. Valid values are: Web Service,Service Web,Dataset,Données,API,Application,Supporting Document,Document de soutien</ResourceDescriptionContentType> | ||
<ResourceDescriptionFormat>Online resource description format is not valid. Valid values are:</ResourceDescriptionFormat> | ||
<ResourceDescriptionLanguage>Online resource description language is not valid. Should be a comma separated values of ISO-LANG-3 codes</ResourceDescriptionLanguage> | ||
|
||
<ElectronicMailFormat>Electronic mail address format is invalid (for example [email protected])</ElectronicMailFormat> | ||
</strings> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -84,4 +84,6 @@ | |
<ECThesaurusOrg>Le nom de l’organisation responsable du thésaurus est requis</ECThesaurusOrg> | ||
<ECThesaurusRole>Le rôle du responsable du thesaurus est requis</ECThesaurusRole> | ||
<ECThesaurusEmail>Le courriel du responsable du thésaurus est requis</ECThesaurusEmail> | ||
|
||
<ElectronicMailFormat>Le format de l'adresse électronique n'est pas valide (par exemple [email protected])</ElectronicMailFormat> | ||
</strings> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,4 +56,6 @@ | |
<ResourceDescriptionContentType>Le type de contenu dans la description de la ressource en ligne n'est pas valide. Les valeurs valides sont : Web Service,Service Web,Dataset,Données,API,Application,Supporting Document,Document de soutien</ResourceDescriptionContentType> | ||
<ResourceDescriptionFormat>Le format dans la description de la ressource en ligne n’est pas valide. Les valeurs valides sont : </ResourceDescriptionFormat> | ||
<ResourceDescriptionLanguage>La langue dans la description de la ressource en ligne n’est pas valide. Devrait être des valeurs de code ISO-LANG-3 séparées par des virgules</ResourceDescriptionLanguage> | ||
|
||
<ElectronicMailFormat>Le format de l'adresse électronique n'est pas valide (par exemple [email protected])</ElectronicMailFormat> | ||
</strings> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,6 +31,8 @@ | |
import java.util.ArrayList; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
import static org.junit.Assert.assertFalse; | ||
import static org.junit.Assert.assertTrue; | ||
|
||
/** | ||
* Tests for {@link XslUtilHnap} class. | ||
|
@@ -133,6 +135,22 @@ public void removeFromUrl() { | |
|
||
} | ||
|
||
@Test | ||
public void testIsEmailAddress() { | ||
assertTrue(XslUtilHnap.isEmailFormat("o'brian.test@localhost", false)); | ||
assertTrue(XslUtilHnap.isEmailFormat("o'[email protected]", false)); | ||
|
||
assertFalse(XslUtilHnap.isEmailFormat("o'[email protected].", false)); | ||
assertFalse(XslUtilHnap.isEmailFormat("o'brian.test@localhost.", false)); | ||
assertFalse(XslUtilHnap.isEmailFormat("o'brian.test@", false)); | ||
assertFalse(XslUtilHnap.isEmailFormat("o'brian.test", false)); | ||
|
||
assertFalse(XslUtilHnap.isEmailFormat("",false)); | ||
assertTrue(XslUtilHnap.isEmailFormat("",true)); | ||
assertTrue(XslUtilHnap.isEmailFormat(null,true)); | ||
|
||
} | ||
|
||
class MyTinyNodeImpl extends TinyNodeImpl { | ||
|
||
private String value; | ||
|