@Test public void integerRangeValidator() { ValidationCallback validator = Validators.integerRangeValidator(0, 42); assertThat(validator.validate("24")).isEmpty(); assertThat(validator.validate("-100")).isEqualTo("Must be between 0 and 42: -100"); assertThat(validator.validate("100")).isEqualTo("Must be between 0 and 42: 100"); assertThat(validator.validate("foo")).isEqualTo("Not an integer: foo"); assertThat(Validators.integerRangeValidator(42, 42).validate("43")).isEqualTo("Must be equal to 42: 43"); assertThat(Validators.integerRangeValidator(Integer.MIN_VALUE, 0).validate("1")).isEqualTo("Must be negative or 0: 1"); assertThat(Validators.integerRangeValidator(Integer.MIN_VALUE, -1).validate("0")).isEqualTo("Must be strictly negative: 0"); assertThat(Validators.integerRangeValidator(Integer.MIN_VALUE, 42).validate("43")).isEqualTo("Must be lower or equal to 42: 43"); assertThat(Validators.integerRangeValidator(0, Integer.MAX_VALUE).validate("-1")).isEqualTo("Must be positive or 0: -1"); assertThat(Validators.integerRangeValidator(1, Integer.MAX_VALUE).validate("0")).isEqualTo("Must be strictly positive: 0"); assertThat(Validators.integerRangeValidator(42, Integer.MAX_VALUE).validate("41")).isEqualTo("Must be greater or equal to 42: 41"); }
public static ValidationCallback integerRangeValidator(int lowerBound, int upperBound) { return new IntegerRangeValidator(lowerBound, upperBound); }
Validators { public static ValidationCallback integerRangeValidator(int lowerBound, int upperBound) { return new IntegerRangeValidator(lowerBound, upperBound); } }
Validators { public static ValidationCallback integerRangeValidator(int lowerBound, int upperBound) { return new IntegerRangeValidator(lowerBound, upperBound); } private  Validators(); }
Validators { public static ValidationCallback integerRangeValidator(int lowerBound, int upperBound) { return new IntegerRangeValidator(lowerBound, upperBound); } private  Validators(); static ValidationCallback charsetValidator(); static ValidationCallback integerRangeValidator(int lowerBound, int upperBound); static ValidationCallback booleanValidator(); }
Validators { public static ValidationCallback integerRangeValidator(int lowerBound, int upperBound) { return new IntegerRangeValidator(lowerBound, upperBound); } private  Validators(); static ValidationCallback charsetValidator(); static ValidationCallback integerRangeValidator(int lowerBound, int upperBound); static ValidationCallback booleanValidator();  }