@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); }
public void addClientChoices(String name, List<Choice> choices) { clientChoices.put(name, choices); }
ClientChoice { public void addClientChoices(String name, List<Choice> choices) { clientChoices.put(name, choices); } }
ClientChoice { public void addClientChoices(String name, List<Choice> choices) { clientChoices.put(name, choices); }  }
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(); }
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();  }