Пример #1
0
 @Test
 public void testShouldFindBookById() {
   // given
   final long bookId = 1;
   // when
   BookEntity bookEntity = bookDao.findOne(bookId);
   // then
   assertNotNull(bookEntity);
   assertEquals("Pierwsza książka", bookEntity.getTitle());
 }
 // TODO test
 @Override
 @Transactional(readOnly = false)
 public BookTo saveBook(BookTo book) {
   if (!book.getLibraryId().equals(null)) {
     LibraryEntity libraryEntity = libraryRepository.getOne(book.getLibraryId());
     if (!libraryEntity.equals(null)) {
       BookEntity entity = BookMapper.map(book);
       entity.setLibrary(libraryEntity);
       entity = bookRepository.save(entity);
       return BookMapper.map(entity);
     }
   }
   return null;
 }