EmailValidator implements ConstraintValidator<Email, String> { public boolean isValid(String value, ConstraintValidatorContext context) { return Strings.nullToEmpty(value).matches(EMAIL_PATTERN); }  void initialize(Email annotation); boolean isValid(String value, ConstraintValidatorContext context);  }
@Test public void isValid_empty() { assertFalse(emailValidator.isValid("", null)); }
@Test public void isValid_null() { assertFalse(emailValidator.isValid(null, null)); }
@Test public void isValid_valid() { assertTrue(emailValidator.isValid("simon.pierre.gingras@gmail.com", null)); }
@Test public void isValid_invalid() { assertFalse(emailValidator.isValid("simon.pierre.gingras@gmail.c", null)); }