@Test public void givenBeanWithEmptyElementInCollection_shouldValidate() { Person person = new Person(); person.setCars(new ArrayList<String>() { { add(null); } }); Set<ConstraintViolation<Person>> constraintViolations = validator.validateProperty(person, "cars"); assertThat(constraintViolations.size()).isEqualTo(1); }
public void setCars(List<String> cars) { this.cars = cars; }
Person { public void setCars(List<String> cars) { this.cars = cars; } }
Person { public void setCars(List<String> cars) { this.cars = cars; }  }
Person { public void setCars(List<String> cars) { this.cars = cars; }  String getFirstName(); void setFirstName(String firstName); String getSecondName(); void setSecondName(String secondName); String getEmail(); void setEmail(String email); List<String> getCars(); void setCars(List<String> cars); }
Person { public void setCars(List<String> cars) { this.cars = cars; }  String getFirstName(); void setFirstName(String firstName); String getSecondName(); void setSecondName(String secondName); String getEmail(); void setEmail(String email); List<String> getCars(); void setCars(List<String> cars);  }