@Test public void input_mismatch() throws Exception { Field field = mockField(); MessageFormatter formatter = mockMessageFormatter(); Html5Support html5Support = mockHtml5Support(); replay(); Email validator = new Email(null, html5Support); try { validator.validate(field, null, formatter, "invalid_email"); unreachable(); } catch (ValidationException ex) { } try { validator.validate(field, null, formatter, "@mail.com"); unreachable(); } catch (ValidationException ex) { } try { validator.validate(field, null, formatter, "aaa@bbb/cc"); unreachable(); } catch (ValidationException ex) { } verify(); }
public void validate(Field field, Void constraintValue, MessageFormatter formatter, String value) throws ValidationException { if (!PATTERN.matcher(value).matches()) throw new ValidationException(formatter.toString()); }
Email extends AbstractValidator<Void, String> { public void validate(Field field, Void constraintValue, MessageFormatter formatter, String value) throws ValidationException { if (!PATTERN.matcher(value).matches()) throw new ValidationException(formatter.toString()); } }
Email extends AbstractValidator<Void, String> { public void validate(Field field, Void constraintValue, MessageFormatter formatter, String value) throws ValidationException { if (!PATTERN.matcher(value).matches()) throw new ValidationException(formatter.toString()); } Email(JavaScriptSupport javaScriptSupport, Html5Support html5Support); }
Email extends AbstractValidator<Void, String> { public void validate(Field field, Void constraintValue, MessageFormatter formatter, String value) throws ValidationException { if (!PATTERN.matcher(value).matches()) throw new ValidationException(formatter.toString()); } Email(JavaScriptSupport javaScriptSupport, Html5Support html5Support); void render(Field field, Void constraintValue, MessageFormatter formatter, MarkupWriter writer,
                       FormSupport formSupport); void validate(Field field, Void constraintValue, MessageFormatter formatter, String value); }
Email extends AbstractValidator<Void, String> { public void validate(Field field, Void constraintValue, MessageFormatter formatter, String value) throws ValidationException { if (!PATTERN.matcher(value).matches()) throw new ValidationException(formatter.toString()); } Email(JavaScriptSupport javaScriptSupport, Html5Support html5Support); void render(Field field, Void constraintValue, MessageFormatter formatter, MarkupWriter writer,
                       FormSupport formSupport); void validate(Field field, Void constraintValue, MessageFormatter formatter, String value);  }