@Test public void shouldIsNotEmptyNotAcceptValueLongerThan() throws Exception { ValidationUtils.isNotEmpty("123456", property, messagePrefix, 5, error); verify(error).rejectValue(eq(property), startsWith(messagePrefix)); }
public static void isNotEmpty(String value, String property, String messagePrefix, int length, Errors error) { if (StringUtils.isBlank(value)) { error.rejectValue(property, messagePrefix + " can't be empty"); } else if (value.length() > length) { error.rejectValue(property, messagePrefix + " shouldn't be longer than " + length + " characters"); } }
ValidationUtils { public static void isNotEmpty(String value, String property, String messagePrefix, int length, Errors error) { if (StringUtils.isBlank(value)) { error.rejectValue(property, messagePrefix + " can't be empty"); } else if (value.length() > length) { error.rejectValue(property, messagePrefix + " shouldn't be longer than " + length + " characters"); } } }
ValidationUtils { public static void isNotEmpty(String value, String property, String messagePrefix, int length, Errors error) { if (StringUtils.isBlank(value)) { error.rejectValue(property, messagePrefix + " can't be empty"); } else if (value.length() > length) { error.rejectValue(property, messagePrefix + " shouldn't be longer than " + length + " characters"); } }  }
ValidationUtils { public static void isNotEmpty(String value, String property, String messagePrefix, int length, Errors error) { if (StringUtils.isBlank(value)) { error.rejectValue(property, messagePrefix + " can't be empty"); } else if (value.length() > length) { error.rejectValue(property, messagePrefix + " shouldn't be longer than " + length + " characters"); } }  static void isNotEmpty(String value, String property, String messagePrefix, int length, Errors error); static void isEmpty(String value, String property, String messagePrefix, Errors error); static void isNotLongerThan(String value, String property, String messagePrefix, int length, Errors error); static void isNotEmpty(Collection collection, String property, String errorMessage, Errors error); static void isNotNull(Object value, String property, String messagePrefix, Errors error); static void isNull(Object value, String property, String messagePrefix, Errors error); static void contains(String sequence, String searchSequence, String property, String messagePrefix, Errors error); static void isGreaterThan(Number value, String property, String messagePrefix, Number min, Errors error); static void isGreaterOrEqualTo(Number value, String property, String messagePrefix, Number min, Errors error); static void isBetween(Number value, String property, String messagePrefix, Number min, Number max, Errors error); static void isBetweenInclusive(Number value, String property, String messagePrefix, Number min, Number max, Errors error); static void isNullOrGreaterOrEqualTo(Number value, String property, String messagePrefix, Number min, Errors error); static void isNullOrGreaterThan(Number value, String property, String messagePrefix, Number min, Errors error); static void isDefined(P entity, R repository, String property, String messagePrefix, Errors error); static void isAfter(Date value, String property, String messagePrefix, Date otherDate, Errors error); static boolean isAnId(@Null final String string); static void entityExists(Long id, CrudRepository repository, String property, String messagePrefix, Errors
            error); }
ValidationUtils { public static void isNotEmpty(String value, String property, String messagePrefix, int length, Errors error) { if (StringUtils.isBlank(value)) { error.rejectValue(property, messagePrefix + " can't be empty"); } else if (value.length() > length) { error.rejectValue(property, messagePrefix + " shouldn't be longer than " + length + " characters"); } }  static void isNotEmpty(String value, String property, String messagePrefix, int length, Errors error); static void isEmpty(String value, String property, String messagePrefix, Errors error); static void isNotLongerThan(String value, String property, String messagePrefix, int length, Errors error); static void isNotEmpty(Collection collection, String property, String errorMessage, Errors error); static void isNotNull(Object value, String property, String messagePrefix, Errors error); static void isNull(Object value, String property, String messagePrefix, Errors error); static void contains(String sequence, String searchSequence, String property, String messagePrefix, Errors error); static void isGreaterThan(Number value, String property, String messagePrefix, Number min, Errors error); static void isGreaterOrEqualTo(Number value, String property, String messagePrefix, Number min, Errors error); static void isBetween(Number value, String property, String messagePrefix, Number min, Number max, Errors error); static void isBetweenInclusive(Number value, String property, String messagePrefix, Number min, Number max, Errors error); static void isNullOrGreaterOrEqualTo(Number value, String property, String messagePrefix, Number min, Errors error); static void isNullOrGreaterThan(Number value, String property, String messagePrefix, Number min, Errors error); static void isDefined(P entity, R repository, String property, String messagePrefix, Errors error); static void isAfter(Date value, String property, String messagePrefix, Date otherDate, Errors error); static boolean isAnId(@Null final String string); static void entityExists(Long id, CrudRepository repository, String property, String messagePrefix, Errors
            error);  }