@Test public void findAll_ShouldReturnTodoList() { List<Todo> models = new ArrayList<Todo>(); when(repositoryMock.findAll()).thenReturn(models); List<Todo> actual = service.findAll(); verify(repositoryMock, times(1)).findAll(); verifyNoMoreInteractions(repositoryMock); verifyZeroInteractions(indexServiceMock); assertEquals(models, actual); }
@PreAuthorize("hasPermission('Todo', 'list')") @Transactional(readOnly = true) @Override public List<Todo> findAll() { LOGGER.debug("Finding all to-do entries"); return repository.findAll(); }
RepositoryTodoService implements TodoService { @PreAuthorize("hasPermission('Todo', 'list')") @Transactional(readOnly = true) @Override public List<Todo> findAll() { LOGGER.debug("Finding all to-do entries"); return repository.findAll(); } }
RepositoryTodoService implements TodoService { @PreAuthorize("hasPermission('Todo', 'list')") @Transactional(readOnly = true) @Override public List<Todo> findAll() { LOGGER.debug("Finding all to-do entries"); return repository.findAll(); }  }
RepositoryTodoService implements TodoService { @PreAuthorize("hasPermission('Todo', 'list')") @Transactional(readOnly = true) @Override public List<Todo> findAll() { LOGGER.debug("Finding all to-do entries"); return repository.findAll(); }  @PreAuthorize("hasPermission('Todo', 'add')") @Transactional @Override Todo add(TodoDTO added); @PreAuthorize("hasPermission('Todo', 'delete')") @Transactional(rollbackFor = {TodoNotFoundException.class}) @Override Todo deleteById(Long id); @PreAuthorize("hasPermission('Todo', 'list')") @Transactional(readOnly = true) @Override List<Todo> findAll(); @PreAuthorize("hasPermission('Todo', 'find')") @Transactional(readOnly = true, rollbackFor = {TodoNotFoundException.class}) @Override Todo findById(Long id); @PreAuthorize("hasPermission('Todo', 'update')") @Transactional(rollbackFor = {TodoNotFoundException.class}) @Override Todo update(TodoDTO updated); @PreAuthorize("hasPermission('Todo', 'search')") @Override List<TodoDocument> search(String searchTerm); }
RepositoryTodoService implements TodoService { @PreAuthorize("hasPermission('Todo', 'list')") @Transactional(readOnly = true) @Override public List<Todo> findAll() { LOGGER.debug("Finding all to-do entries"); return repository.findAll(); }  @PreAuthorize("hasPermission('Todo', 'add')") @Transactional @Override Todo add(TodoDTO added); @PreAuthorize("hasPermission('Todo', 'delete')") @Transactional(rollbackFor = {TodoNotFoundException.class}) @Override Todo deleteById(Long id); @PreAuthorize("hasPermission('Todo', 'list')") @Transactional(readOnly = true) @Override List<Todo> findAll(); @PreAuthorize("hasPermission('Todo', 'find')") @Transactional(readOnly = true, rollbackFor = {TodoNotFoundException.class}) @Override Todo findById(Long id); @PreAuthorize("hasPermission('Todo', 'update')") @Transactional(rollbackFor = {TodoNotFoundException.class}) @Override Todo update(TodoDTO updated); @PreAuthorize("hasPermission('Todo', 'search')") @Override List<TodoDocument> search(String searchTerm);  }