@SuppressWarnings("unchecked") @Test public void null_value_skipped() throws Exception { Field field = mockField(); MessageFormatter formatter = mockMessageFormatter(); Validator validator = mockValidator(); train_isRequired(validator, false); replay(); FieldValidator fv = new FieldValidatorImpl(field, null, formatter, validator, null); fv.validate(null); verify(); }
@SuppressWarnings("unchecked") public void validate(Object value) throws ValidationException { if (!validator.isRequired() && isBlank(value)) return; if (value != null && !validator.getValueType().isInstance(value)) return; validator.validate(field, constraintValue, messageFormatter, value); }
FieldValidatorImpl implements FieldValidator { @SuppressWarnings("unchecked") public void validate(Object value) throws ValidationException { if (!validator.isRequired() && isBlank(value)) return; if (value != null && !validator.getValueType().isInstance(value)) return; validator.validate(field, constraintValue, messageFormatter, value); } }
FieldValidatorImpl implements FieldValidator { @SuppressWarnings("unchecked") public void validate(Object value) throws ValidationException { if (!validator.isRequired() && isBlank(value)) return; if (value != null && !validator.getValueType().isInstance(value)) return; validator.validate(field, constraintValue, messageFormatter, value); } FieldValidatorImpl(Field field, Object constraintValue, MessageFormatter messageFormatter,
                              Validator validator, FormSupport formSupport); }
FieldValidatorImpl implements FieldValidator { @SuppressWarnings("unchecked") public void validate(Object value) throws ValidationException { if (!validator.isRequired() && isBlank(value)) return; if (value != null && !validator.getValueType().isInstance(value)) return; validator.validate(field, constraintValue, messageFormatter, value); } FieldValidatorImpl(Field field, Object constraintValue, MessageFormatter messageFormatter,
                              Validator validator, FormSupport formSupport); @SuppressWarnings("unchecked") void validate(Object value); @SuppressWarnings("unchecked") void render(MarkupWriter writer); boolean isRequired(); }
FieldValidatorImpl implements FieldValidator { @SuppressWarnings("unchecked") public void validate(Object value) throws ValidationException { if (!validator.isRequired() && isBlank(value)) return; if (value != null && !validator.getValueType().isInstance(value)) return; validator.validate(field, constraintValue, messageFormatter, value); } FieldValidatorImpl(Field field, Object constraintValue, MessageFormatter messageFormatter,
                              Validator validator, FormSupport formSupport); @SuppressWarnings("unchecked") void validate(Object value); @SuppressWarnings("unchecked") void render(MarkupWriter writer); boolean isRequired();  }