### Question:
Book { public void addChapterTitle(String chapterTitle) { chapterTitles.add(chapterTitle); }  List<String> getChapterTitles(); void addChapterTitle(String chapterTitle); Map<String, String> getAuthorChapter(); void addAuthorChapter(String author, String chapter);  }### Answer:
@Test public void givenListWithConstraints_shouldValidate() { Book book = new Book(); book.addChapterTitle("Chapter 1"); Set<ConstraintViolation<Book>> constraintViolations = validator.validate(book); assertThat(constraintViolations.size()).isEqualTo(0); }
@Test public void givenListWithConstraints_shouldNotValidate() { Book book = new Book(); book.addChapterTitle(" "); Set<ConstraintViolation<Book>> constraintViolations = validator.validate(book); assertThat(constraintViolations.size()).isEqualTo(1); }