### Question:
ClientChoice { public void addClientChoices(String name, List<Choice> choices) { clientChoices.put(name, choices); }  void addChoices(Choice choice); void addClientChoices(String name, List<Choice> choices); List<Choice> getChoices(); Map<String, List<Choice>> getClientChoices();  }### Answer:
@Test public void givenMapWithConstraints_shouldValidate() { ClientChoice clientChoice = new ClientChoice(); clientChoice.addClientChoices("John", new ArrayList<Choice>() {{ add(new Choice(1, "Roast Lamb")); add(new Choice(1, "Ice Cream")); add(new Choice(1, "Apple")); }}); clientChoice.addClientChoices("May", new ArrayList<Choice>() {{ add(new Choice(1, "Grapes")); add(new Choice(1, "Beef Stake")); add(new Choice(1, "Pizza")); }}); Set<ConstraintViolation<ClientChoice>> constraintViolations = validator.validate(clientChoice); assertThat(constraintViolations.size()).isEqualTo(0); }
@Test public void givenMapWithConstraints_shouldNotValidate() { ClientChoice clientChoice = new ClientChoice(); clientChoice.addClientChoices("John", new ArrayList<Choice>() {{ add(new Choice(1, "Fish")); add(new Choice(1, "Egg")); add(new Choice(1, "Apple")); }}); clientChoice.addClientChoices("May", new ArrayList<Choice>() {{ add(new Choice(1, "Grapes")); add(new Choice(1, "Beef Stake")); add(new Choice(1, "Pizza")); }}); Set<ConstraintViolation<ClientChoice>> constraintViolations = validator.validate(clientChoice); assertThat(constraintViolations.size()).isEqualTo(2); }