@Test public void search_ShouldReturnTodoDocuments() { List<TodoDocument> expected = new ArrayList<TodoDocument>(); when(indexServiceMock.search(eq(SEARCH_TERM), any(Pageable.class))).thenReturn(expected); Pageable page = new PageRequest(0, 10); List<TodoDocument> actual = service.search(SEARCH_TERM, page); verify(indexServiceMock, times(1)).search(SEARCH_TERM, page); verifyNoMoreInteractions(indexServiceMock); verifyZeroInteractions(repositoryMock); assertEquals(expected, actual); }
@PreAuthorize("hasPermission('Todo', 'search')") @Override public List<TodoDocument> search(String searchTerm, Pageable page) { LOGGER.debug("Search todo entries with search term: {} and page: {}", searchTerm, page); return indexService.search(searchTerm, page); }
RepositoryTodoService implements TodoService { @PreAuthorize("hasPermission('Todo', 'search')") @Override public List<TodoDocument> search(String searchTerm, Pageable page) { LOGGER.debug("Search todo entries with search term: {} and page: {}", searchTerm, page); return indexService.search(searchTerm, page); } }
RepositoryTodoService implements TodoService { @PreAuthorize("hasPermission('Todo', 'search')") @Override public List<TodoDocument> search(String searchTerm, Pageable page) { LOGGER.debug("Search todo entries with search term: {} and page: {}", searchTerm, page); return indexService.search(searchTerm, page); }  }
RepositoryTodoService implements TodoService { @PreAuthorize("hasPermission('Todo', 'search')") @Override public List<TodoDocument> search(String searchTerm, Pageable page) { LOGGER.debug("Search todo entries with search term: {} and page: {}", searchTerm, page); return indexService.search(searchTerm, page); }  @PreAuthorize("hasPermission('Todo', 'add')") @Transactional @Override Todo add(TodoDTO added); @PreAuthorize("hasPermission('Todo', 'search')") @Override long countSearchResults(String searchTerm); @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, Pageable page); }
RepositoryTodoService implements TodoService { @PreAuthorize("hasPermission('Todo', 'search')") @Override public List<TodoDocument> search(String searchTerm, Pageable page) { LOGGER.debug("Search todo entries with search term: {} and page: {}", searchTerm, page); return indexService.search(searchTerm, page); }  @PreAuthorize("hasPermission('Todo', 'add')") @Transactional @Override Todo add(TodoDTO added); @PreAuthorize("hasPermission('Todo', 'search')") @Override long countSearchResults(String searchTerm); @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, Pageable page);  }