public void testValidateNestedPropertyPath() throws InvocationTargetException, NoSuchMethodException,
IllegalAccessException {
final String propPath = "addresses[0].country.ISO2Code";
Author author = new Author();
author.setAddresses(new ArrayList<Address>());
Address adr = new Address();
author.getAddresses().add(adr);
Country country = new Country();
adr.setCountry(country);
country.setISO2Code("too_long");
Set<ConstraintViolation<Author>> iv = validator.validateProperty(author, propPath);
Assert.assertEquals(1, iv.size());
ConstraintViolation<Author> vio = iv.iterator().next();
assertEquals(propPath, vio.getPropertyPath().toString());
assertSame(author, vio.getRootBean());
assertSame(author.getAddresses().get(0).getCountry(), vio.getLeafBean());
country.setISO2Code("23");
iv = validator.validateProperty(author, propPath);
Assert.assertEquals(0, iv.size());