@Test public void value_too_large() throws Exception { String label = "My Field"; Field field = mockFieldWithLabel(label); MessageFormatter formatter = mockMessageFormatter(); String message = "{message}"; Long constraint = 100l; Number value = 101; train_format(formatter, message, constraint, label); Max validator = new Max(null, mockHtml5Support()); replay(); try { validator.validate(field, constraint, formatter, value); unreachable(); } catch (ValidationException ex) { assertEquals(ex.getMessage(), message); } verify(); }
public void validate(Field field, Long constraintValue, MessageFormatter formatter, Number value) throws ValidationException { if (value.longValue() > constraintValue) throw new ValidationException(buildMessage(formatter, field, constraintValue)); }
Max extends AbstractValidator<Long, Number> { public void validate(Field field, Long constraintValue, MessageFormatter formatter, Number value) throws ValidationException { if (value.longValue() > constraintValue) throw new ValidationException(buildMessage(formatter, field, constraintValue)); } }
Max extends AbstractValidator<Long, Number> { public void validate(Field field, Long constraintValue, MessageFormatter formatter, Number value) throws ValidationException { if (value.longValue() > constraintValue) throw new ValidationException(buildMessage(formatter, field, constraintValue)); } Max(JavaScriptSupport javaScriptSupport, Html5Support html5Support); }
Max extends AbstractValidator<Long, Number> { public void validate(Field field, Long constraintValue, MessageFormatter formatter, Number value) throws ValidationException { if (value.longValue() > constraintValue) throw new ValidationException(buildMessage(formatter, field, constraintValue)); } Max(JavaScriptSupport javaScriptSupport, Html5Support html5Support); void validate(Field field, Long constraintValue, MessageFormatter formatter, Number value); void render(Field field, Long constraintValue, MessageFormatter formatter, MarkupWriter writer,
                       FormSupport formSupport); }
Max extends AbstractValidator<Long, Number> { public void validate(Field field, Long constraintValue, MessageFormatter formatter, Number value) throws ValidationException { if (value.longValue() > constraintValue) throw new ValidationException(buildMessage(formatter, field, constraintValue)); } Max(JavaScriptSupport javaScriptSupport, Html5Support html5Support); void validate(Field field, Long constraintValue, MessageFormatter formatter, Number value); void render(Field field, Long constraintValue, MessageFormatter formatter, MarkupWriter writer,
                       FormSupport formSupport);  }