### Question:
SelectionLengthValidator extends CustomValidator<ObservableList<E>> { public static <T> SelectionLengthValidator<T> between(int min, int max, String errorMessage) { if (min < 0) { throw new IllegalArgumentException("Minimum string length cannot be negative."); } else if (min > max) { throw new IllegalArgumentException("Minimum must not be larger than maximum."); } return new SelectionLengthValidator<>(min, max, errorMessage); } private  SelectionLengthValidator(int min, int max, String errorMessage); static SelectionLengthValidator<T> between(int min, int max, String errorMessage); static SelectionLengthValidator<T> atLeast(int min, String errorMessage); static SelectionLengthValidator<T> upTo(int max, String errorMessage); static SelectionLengthValidator<T> exactly(int value, String errorMessage);  }### Answer:
@Test public void betweenTest() { SelectionLengthValidator<Integer> s = SelectionLengthValidator.between(1, 3, "test"); Assert.assertTrue(s.validate(FXCollections.observableArrayList(1, 2, 3)).getResult()); Assert.assertFalse(s.validate(FXCollections.observableArrayList()).getResult()); Assert.assertFalse(s.validate(FXCollections.observableArrayList(1, 2, 3, 4, 5)).getResult()); try { SelectionLengthValidator s2 = SelectionLengthValidator.between(-10, 2, "test"); fail(); } catch (IllegalArgumentException ignored) {} try { SelectionLengthValidator s3 = SelectionLengthValidator.between(0, 0, "test"); } catch (IllegalArgumentException e) { fail(); } try { SelectionLengthValidator s4 = SelectionLengthValidator.between(10, 1, "test"); fail(); } catch (IllegalArgumentException ignored) {} }