@Test public void shouldListAllUsers_GivenThereExistSome_ThenTheCollectionShouldBeReturned() throws Exception { stubRepositoryToReturnExistingUsers(10); Collection<Book> list = bookService.getList(); assertNotNull(list); assertEquals(10, list.size()); verify(bookRepository, times(1)).findAll(); }
@Override @Transactional(readOnly = true) public List<Book> getList() { LOGGER.debug("Retrieving the list of all users"); return repository.findAll(); }
BookServiceImpl implements BookService { @Override @Transactional(readOnly = true) public List<Book> getList() { LOGGER.debug("Retrieving the list of all users"); return repository.findAll(); } }
BookServiceImpl implements BookService { @Override @Transactional(readOnly = true) public List<Book> getList() { LOGGER.debug("Retrieving the list of all users"); return repository.findAll(); } @Autowired  BookServiceImpl(final BookRepository repository); }
BookServiceImpl implements BookService { @Override @Transactional(readOnly = true) public List<Book> getList() { LOGGER.debug("Retrieving the list of all users"); return repository.findAll(); } @Autowired  BookServiceImpl(final BookRepository repository); @Override @Transactional Book saveBook(@NotNull @Valid final Book book); @Override @Transactional(readOnly = true) List<Book> getList(); @Override Book getBook(Long bookId); @Override @Transactional void deleteBook(final Long bookId); }
BookServiceImpl implements BookService { @Override @Transactional(readOnly = true) public List<Book> getList() { LOGGER.debug("Retrieving the list of all users"); return repository.findAll(); } @Autowired  BookServiceImpl(final BookRepository repository); @Override @Transactional Book saveBook(@NotNull @Valid final Book book); @Override @Transactional(readOnly = true) List<Book> getList(); @Override Book getBook(Long bookId); @Override @Transactional void deleteBook(final Long bookId);  }