### Question:
SelectionLengthValidator extends CustomValidator<ObservableList<E>> { public static <T> SelectionLengthValidator<T> upTo(int max, String errorMessage) { return new SelectionLengthValidator<>(0, 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 upToTest() { SelectionLengthValidator<Integer> s = SelectionLengthValidator.upTo(2, "test"); Assert.assertFalse(s.validate(FXCollections.observableArrayList(3, 5, 1)).getResult()); Assert.assertTrue(s.validate(FXCollections.observableArrayList(1, 2)).getResult()); Assert.assertTrue(s.validate(FXCollections.observableArrayList()).getResult()); Assert.assertFalse(s.validate(FXCollections.observableArrayList(1, 2, 3, 5, 14)).getResult()); }