Hi everybody,

First, sorry for my english.

I tried the EmailValidator component and I was surprised that it accepts a
domain part that contains only the TLD (like [email protected]). See below a failing
test.

Although domainValidator.isValid(domain) returns false
domainValidator.isValid(domain) || domainValidator.isValidTld(domain)
returns true
Is it the source of the problem ? Why does it bypass the domain validation
if the TLD is valid ?
NB: DomainValidator.isValid already contains isValidTld()

Sébastien

/**
* Tests the email validation for empty domain.
*/
public void testEmailWithEmptyDomain()  {
    assertFalse("empty domain name should fail",
emailValidator.commonsValidator("joe@"));
    assertFalse("domain name starting with dot should fail",
emailValidator.commonsValidator("[email protected]"));
    assertFalse("domain name with only TLD should fail",
emailValidator.commonsValidator("[email protected]")); // yes or no ?
}

Reply via email to