EmailValidator implements Serializable { public boolean isValidUser(String user) { return USER_PATTERN.matcher(user).matches(); } 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 testIsValidUser() { assertTrue(EmailValidator.getInstance(true).isValidUser("sina.com")); assertFalse(EmailValidator.getInstance(true).isValidUser("111;22")); }