### Question:
ConfigurationValidator { public void validate(T clazz) throws InitializationException { ValidatorFactory validatorFactory = Validation.buildDefaultValidatorFactory(); Validator validator = validatorFactory.getValidator(); Set<ConstraintViolation<T>> violations = validator.validate(clazz); for (ConstraintViolation<T> violation : violations) { throw new InitializationException(getMessage(violation)); } }  String getMessage(ConstraintViolation<T> violation); void validate(T clazz);  }### Answer:
@Test public void validate() throws InitializationException { ConfigurationValidator<TestProperty> v = new ConfigurationValidator<>(); TestProperty o = new TestProperty(); try { v.validate(o); fail("Property is null but validate is passed"); } catch (InitializationException e) { } o.property = "value"; v.validate(o); assertEquals("value", o.property); }