EmailValidator implements Serializable { public boolean isValidDomain(String domain) { Matcher ipDomainMatcher = IP_DOMAIN_PATTERN.matcher(domain); if (ipDomainMatcher.matches()) { InetAddressValidator inetAddressValidator = InetAddressValidator.getInstance(); return inetAddressValidator.isValid(ipDomainMatcher.group(1)); } else { DomainValidator domainValidator = DomainValidator.getInstance(allowLocal); return domainValidator.isValid(domain); } } protected  EmailValidator(boolean allowLocal); static EmailValidator getInstance(); static EmailValidator getInstance(boolean allowLocal); boolean isValid(String email); boolean isValidDomain(String domain); boolean isValidUser(String user);  }
@Test public void testIsValidDomain() { assertTrue(EmailValidator.getInstance(true).isValidDomain("sina.com")); assertFalse(EmailValidator.getInstance(true).isValidDomain("222;11")); }