### Question:
ValidationController { public <T> void processBeanValidation(final T entity) { ValidatorFactory factory = Validation.buildDefaultValidatorFactory(); Validator validator = factory.getValidator(); Set<ConstraintViolation<T>> errors = validator.validate(entity); if (!errors.isEmpty()) { throw new ConstraintViolationException(errors); } } private  ValidationController(); static ValidationController get(final Class<T> clazz); void processBeanValidation(final T entity); void processBeanValidationForProperty(final T entity, String propertyName); void processBeanValidationForGroup(final T entity, Class<?>... groupClasses);  }### Answer:
@Test public void processBeanValidation() throws Exception { TestEntity testEntity = new TestEntity(); testEntity.futureDate = ZonedDateTime.now().minusDays(1); try { ValidationController.get(TestEntity.class).processBeanValidation(testEntity); fail("Wrong values are not recognized"); } catch (Exception ex) { ex.printStackTrace(); assertThat(ex, instanceOf(ConstraintViolationException.class)); assertThat(((ConstraintViolationException)ex).getConstraintViolations().size(), is(3)); } }