@Rollback(true)
@Transactional
@Test
public void testSaveBook() {
Book book = new Book();
book.setIsbnNumber("1234567890");
book.setDescription("This is a wonderfil book.");
book.setTitle("The Art of living");
// the author must be existend in the persistence when it is assigned to
// the book -> CascadingType
Author author = createAuthor();
authorRepository.save(author);
book.setAuthor(author);
bookRepository.save(book);
// check a book was persisted
List<Book> availableBooks = bookRepository.findAll();
assertEquals(1, availableBooks.size());
// check if the author is available
Book check = availableBooks.get(0);
assertEquals(author, check.getAuthor());
}