### Question:
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();  }### Answer:
@Test public void givenListWithConstraints_shouldValidate() { ClientChoice clientChoice = new ClientChoice(); clientChoice.addChoices(new Choice(1, "Pineapple")); clientChoice.addChoices(new Choice(2, "Banana")); clientChoice.addChoices(new Choice(3, "Apple")); Set<ConstraintViolation<ClientChoice>> constraintViolations = validator.validate(clientChoice); assertThat(constraintViolations.size()).isEqualTo(0); }
@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); }