protected Validator createValidator() {
return factory.getValidator();
}
public void testValidateList() {
Author author = new Author();
author.setFirstName("Peter");
author.setLastName("Ford");
author.setCompany("IBM");
author.setAddresses(new ArrayList<Address>());
Address adr1, adr2, adr3;
adr1 = new Address();
adr1.setCountry(new Country());
adr1.getCountry().setName("Germany");
adr1.setCity("Bonn");
adr1.setAddressline1("Strasse 1");
adr2 = new Address();
adr2.setCountry(new Country());
adr2.getCountry().setName("Cuba");
adr2.setCity("Habana");
adr2.setAddressline1("Calle 2");
adr3 = new Address();
adr3.setCountry(new Country());
adr3.getCountry().setName("USA");
adr3.setCity("San Francisco");
adr3.setAddressline1("Street 3");
author.getAddresses().add(adr1);
author.getAddresses().add(adr2);
author.getAddresses().add(adr3);
Set<ConstraintViolation<Author>> violations;
violations = validator.validate(author);
assertEquals(0, violations.size());