### Question:
PageSizeValidator implements ConstraintValidator<PageSize, Integer> { @Override public boolean isValid(Integer value, ConstraintValidatorContext context) { return value!= null && ArrayUtils.contains(JCUser.PAGE_SIZES_AVAILABLE, value); }  @Override void initialize(PageSize constraintAnnotation); @Override boolean isValid(Integer value, ConstraintValidatorContext context);  }### Answer:
@Test(dataProvider = "validPageSizes") public void testIsValidWithAvailablePageSize(int availablePageSize) { boolean isValid = pageSizeValidator.isValid(availablePageSize, validatorContext); Assert.assertTrue(isValid, "Value from the list of available sizes must be valid."); }
@Test public void testIsValidWithPageSizeAsNull() { boolean isValid = pageSizeValidator.isValid(null, validatorContext); Assert.assertFalse(isValid, "Null must be invalid value."); }
@Test(dataProvider = "boundaryValues") public void testIsValidWithBoundaryValue(int boundaryValue) { boolean isValid = pageSizeValidator.isValid(null, validatorContext); Assert.assertFalse(isValid, "Max possible integer and min possible integer must be invalid values."); }
@Test public void testIsValidWithNotAvailablePageSize() { int notAvailablePageSize = 379; boolean isValid = pageSizeValidator.isValid(notAvailablePageSize, validatorContext); Assert.assertFalse(isValid, "This value isn't available, so it must be invalid. Passed value - " + notAvailablePageSize); }