### Question:
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);  }### Answer:
@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(); }
@Test public void shouldListAllUsers_GivenThereNoneExist_ThenTheEmptyCollectionShouldBeReturned() throws Exception { stubRepositoryToReturnExistingUsers(0); Collection<Book> list = bookService.getList(); assertNotNull(list); assertTrue(list.isEmpty()); verify(bookRepository, times(1)).findAll(); }