@Test public void search_QueryGenerationFromMethodNameIsUsed_ShouldReturnTodoDocuments() { ReflectionTestUtils.setField(service, "queryMethodType", RepositoryTodoIndexService.QUERY_METHOD_METHOD_NAME); List<TodoDocument> expected = new ArrayList<TodoDocument>(); when(repositoryMock.findByTitleContainsOrDescriptionContains(eq(SEARCH_TERM), eq(SEARCH_TERM), any(Pageable.class))).thenReturn(expected); PageRequest page = new PageRequest(1, 1); List<TodoDocument> actual = service.search(SEARCH_TERM, page); verify(repositoryMock, times(1)).findByTitleContainsOrDescriptionContains(SEARCH_TERM, SEARCH_TERM, page); verifyNoMoreInteractions(repositoryMock); assertEquals(expected, actual); }
@Override public List<TodoDocument> search(String searchTerm, Pageable page) { LOGGER.debug("Searching documents with search term: {} and page: {}", searchTerm, page); return findDocuments(searchTerm, page); }
RepositoryTodoIndexService implements TodoIndexService { @Override public List<TodoDocument> search(String searchTerm, Pageable page) { LOGGER.debug("Searching documents with search term: {} and page: {}", searchTerm, page); return findDocuments(searchTerm, page); } }
RepositoryTodoIndexService implements TodoIndexService { @Override public List<TodoDocument> search(String searchTerm, Pageable page) { LOGGER.debug("Searching documents with search term: {} and page: {}", searchTerm, page); return findDocuments(searchTerm, page); }  }
RepositoryTodoIndexService implements TodoIndexService { @Override public List<TodoDocument> search(String searchTerm, Pageable page) { LOGGER.debug("Searching documents with search term: {} and page: {}", searchTerm, page); return findDocuments(searchTerm, page); }  @Transactional @Override void addToIndex(Todo todoEntry); @Override long countSearchResults(String searchTerm); @Transactional @Override void deleteFromIndex(Long id); @Override List<TodoDocument> search(String searchTerm, Pageable page); @Transactional @Override void update(Todo todoEntry); }
RepositoryTodoIndexService implements TodoIndexService { @Override public List<TodoDocument> search(String searchTerm, Pageable page) { LOGGER.debug("Searching documents with search term: {} and page: {}", searchTerm, page); return findDocuments(searchTerm, page); }  @Transactional @Override void addToIndex(Todo todoEntry); @Override long countSearchResults(String searchTerm); @Transactional @Override void deleteFromIndex(Long id); @Override List<TodoDocument> search(String searchTerm, Pageable page); @Transactional @Override void update(Todo todoEntry);  }