### Question:
UniqueFieldValidatorImpl implements UniqueFieldValidator { @VisibleForTesting Object propertyValue(Object obj, String property) { try { PropertyDescriptor desc = PropertyUtils.getPropertyDescriptor(obj, property); return desc.getReadMethod().invoke(obj, new Object[]{}); } catch( Exception e) { throw new ValidationException(e); } }  @Override void initialize(UniqueField constraintAnnotation); @Override boolean isValid(Collection<?> list, ConstraintValidatorContext context);  }### Answer:
@Test public void testPropertyValue() { TestBean bean = new TestBean("a", "b"); Object value = validator.propertyValue(bean, "field1"); assertEquals("a", value); }