@Test public void givenMapWithConstraints_shouldNotValidate() { Book book = new Book(); book.addAuthorChapter(" "," "); Set<ConstraintViolation<Book>> constraintViolations = validator.validate(book); assertThat(constraintViolations.size()).isEqualTo(2); }
public void addAuthorChapter(String author, String chapter) { authorChapter.put(author,chapter); }
Book { public void addAuthorChapter(String author, String chapter) { authorChapter.put(author,chapter); } }
Book { public void addAuthorChapter(String author, String chapter) { authorChapter.put(author,chapter); }  }
Book { public void addAuthorChapter(String author, String chapter) { authorChapter.put(author,chapter); }  List<String> getChapterTitles(); void addChapterTitle(String chapterTitle); Map<String, String> getAuthorChapter(); void addAuthorChapter(String author, String chapter); }
Book { public void addAuthorChapter(String author, String chapter) { authorChapter.put(author,chapter); }  List<String> getChapterTitles(); void addChapterTitle(String chapterTitle); Map<String, String> getAuthorChapter(); void addAuthorChapter(String author, String chapter);  }