@Test public void givenListWithConstraints_shouldNotValidate() { ClientChoice clientChoice = new ClientChoice(); clientChoice.addChoices(new Choice(1, "Fish")); clientChoice.addChoices(new Choice(2, "Egg")); clientChoice.addChoices(new Choice(3, "Apple")); Set<ConstraintViolation<ClientChoice>> constraintViolations = validator.validate(clientChoice); assertThat(constraintViolations.size()).isEqualTo(2); }
public void addChoices(Choice choice) { choices.add(choice); }
ClientChoice { public void addChoices(Choice choice) { choices.add(choice); } }
ClientChoice { public void addChoices(Choice choice) { choices.add(choice); }  }
ClientChoice { public void addChoices(Choice choice) { choices.add(choice); }  void addChoices(Choice choice); void addClientChoices(String name, List<Choice> choices); List<Choice> getChoices(); Map<String, List<Choice>> getClientChoices(); }
ClientChoice { public void addChoices(Choice choice) { choices.add(choice); }  void addChoices(Choice choice); void addClientChoices(String name, List<Choice> choices); List<Choice> getChoices(); Map<String, List<Choice>> getClientChoices();  }