@Test public void testNull() { assertTrue(victim.isValid(null, null)); }
@Override public boolean isValid(Number value, ConstraintValidatorContext constraintValidatorContext) { if (value == null) { return true; } if (value instanceof BigDecimal) { return ((BigDecimal) value).compareTo(BigDecimal.ZERO) == 1 || ((BigDecimal) value).compareTo(BigDecimal.ZERO) == 0; } else if (value instanceof BigInteger) { return ((BigInteger) value).compareTo(BigInteger.ZERO) == 1 || ((BigInteger) value).compareTo(BigInteger.ZERO) == 0; } else { return value.floatValue() >= 0; } }
NotNegativeNumberValidator implements ConstraintValidator<NotNegative, Number> { @Override public boolean isValid(Number value, ConstraintValidatorContext constraintValidatorContext) { if (value == null) { return true; } if (value instanceof BigDecimal) { return ((BigDecimal) value).compareTo(BigDecimal.ZERO) == 1 || ((BigDecimal) value).compareTo(BigDecimal.ZERO) == 0; } else if (value instanceof BigInteger) { return ((BigInteger) value).compareTo(BigInteger.ZERO) == 1 || ((BigInteger) value).compareTo(BigInteger.ZERO) == 0; } else { return value.floatValue() >= 0; } } }
NotNegativeNumberValidator implements ConstraintValidator<NotNegative, Number> { @Override public boolean isValid(Number value, ConstraintValidatorContext constraintValidatorContext) { if (value == null) { return true; } if (value instanceof BigDecimal) { return ((BigDecimal) value).compareTo(BigDecimal.ZERO) == 1 || ((BigDecimal) value).compareTo(BigDecimal.ZERO) == 0; } else if (value instanceof BigInteger) { return ((BigInteger) value).compareTo(BigInteger.ZERO) == 1 || ((BigInteger) value).compareTo(BigInteger.ZERO) == 0; } else { return value.floatValue() >= 0; } }  }
NotNegativeNumberValidator implements ConstraintValidator<NotNegative, Number> { @Override public boolean isValid(Number value, ConstraintValidatorContext constraintValidatorContext) { if (value == null) { return true; } if (value instanceof BigDecimal) { return ((BigDecimal) value).compareTo(BigDecimal.ZERO) == 1 || ((BigDecimal) value).compareTo(BigDecimal.ZERO) == 0; } else if (value instanceof BigInteger) { return ((BigInteger) value).compareTo(BigInteger.ZERO) == 1 || ((BigInteger) value).compareTo(BigInteger.ZERO) == 0; } else { return value.floatValue() >= 0; } }  @Override void initialize(NotNegative minValue); @Override boolean isValid(Number value, ConstraintValidatorContext constraintValidatorContext); }
NotNegativeNumberValidator implements ConstraintValidator<NotNegative, Number> { @Override public boolean isValid(Number value, ConstraintValidatorContext constraintValidatorContext) { if (value == null) { return true; } if (value instanceof BigDecimal) { return ((BigDecimal) value).compareTo(BigDecimal.ZERO) == 1 || ((BigDecimal) value).compareTo(BigDecimal.ZERO) == 0; } else if (value instanceof BigInteger) { return ((BigInteger) value).compareTo(BigInteger.ZERO) == 1 || ((BigInteger) value).compareTo(BigInteger.ZERO) == 0; } else { return value.floatValue() >= 0; } }  @Override void initialize(NotNegative minValue); @Override boolean isValid(Number value, ConstraintValidatorContext constraintValidatorContext);  }