@Test public void countSearchResults_ShouldReturnSearchResultCount() { when(serviceMock.countSearchResults(SEARCH_TERM)).thenReturn(RESULT_COUNT); long actual = controller.countSearchResults(SEARCH_TERM); verify(serviceMock, times(1)).countSearchResults(SEARCH_TERM); verifyNoMoreInteractions(serviceMock); verifyZeroInteractions(localeHolderWrapperMock, messageSourceMock); assertEquals(RESULT_COUNT, actual); }
@RequestMapping(value = "/api/todo/search/count/{searchTerm}", method = RequestMethod.GET) @ResponseBody public long countSearchResults(@PathVariable("searchTerm") String searchTerm) { LOGGER.debug("Finding search result count for search term: {}", searchTerm); return service.countSearchResults(searchTerm); }
TodoController { @RequestMapping(value = "/api/todo/search/count/{searchTerm}", method = RequestMethod.GET) @ResponseBody public long countSearchResults(@PathVariable("searchTerm") String searchTerm) { LOGGER.debug("Finding search result count for search term: {}", searchTerm); return service.countSearchResults(searchTerm); } }
TodoController { @RequestMapping(value = "/api/todo/search/count/{searchTerm}", method = RequestMethod.GET) @ResponseBody public long countSearchResults(@PathVariable("searchTerm") String searchTerm) { LOGGER.debug("Finding search result count for search term: {}", searchTerm); return service.countSearchResults(searchTerm); }  }
TodoController { @RequestMapping(value = "/api/todo/search/count/{searchTerm}", method = RequestMethod.GET) @ResponseBody public long countSearchResults(@PathVariable("searchTerm") String searchTerm) { LOGGER.debug("Finding search result count for search term: {}", searchTerm); return service.countSearchResults(searchTerm); }  @RequestMapping(value = "/api/todo", method = RequestMethod.POST) @ResponseBody TodoDTO add(@RequestBody TodoDTO dto); @RequestMapping(value = "/api/todo/search/count/{searchTerm}", method = RequestMethod.GET) @ResponseBody long countSearchResults(@PathVariable("searchTerm") String searchTerm); @RequestMapping(value = "/api/todo/{id}", method = RequestMethod.DELETE) @ResponseBody TodoDTO deleteById(@PathVariable("id") Long id); @RequestMapping(value = "/api/todo", method = RequestMethod.GET) @ResponseBody List<TodoDTO> findAll(); @RequestMapping(value = "/api/todo/{id}", method = RequestMethod.GET) @ResponseBody TodoDTO findById(@PathVariable("id") Long id); @RequestMapping(value = "/api/todo/{id}", method = RequestMethod.PUT) @ResponseBody TodoDTO update(@RequestBody TodoDTO dto, @PathVariable("id") Long todoId); @ExceptionHandler(FormValidationError.class) @ResponseBody @ResponseStatus(HttpStatus.BAD_REQUEST) FormValidationErrorDTO handleFormValidationError(FormValidationError validationError); @RequestMapping(value = "/api/todo/search/{searchTerm}", method = RequestMethod.GET) @ResponseBody List<TodoDTO> search(@PathVariable("searchTerm") String searchTerm, Pageable page); @ExceptionHandler(TodoNotFoundException.class) @ResponseStatus(HttpStatus.NOT_FOUND) void handleTodoNotFoundException(TodoNotFoundException ex); }
TodoController { @RequestMapping(value = "/api/todo/search/count/{searchTerm}", method = RequestMethod.GET) @ResponseBody public long countSearchResults(@PathVariable("searchTerm") String searchTerm) { LOGGER.debug("Finding search result count for search term: {}", searchTerm); return service.countSearchResults(searchTerm); }  @RequestMapping(value = "/api/todo", method = RequestMethod.POST) @ResponseBody TodoDTO add(@RequestBody TodoDTO dto); @RequestMapping(value = "/api/todo/search/count/{searchTerm}", method = RequestMethod.GET) @ResponseBody long countSearchResults(@PathVariable("searchTerm") String searchTerm); @RequestMapping(value = "/api/todo/{id}", method = RequestMethod.DELETE) @ResponseBody TodoDTO deleteById(@PathVariable("id") Long id); @RequestMapping(value = "/api/todo", method = RequestMethod.GET) @ResponseBody List<TodoDTO> findAll(); @RequestMapping(value = "/api/todo/{id}", method = RequestMethod.GET) @ResponseBody TodoDTO findById(@PathVariable("id") Long id); @RequestMapping(value = "/api/todo/{id}", method = RequestMethod.PUT) @ResponseBody TodoDTO update(@RequestBody TodoDTO dto, @PathVariable("id") Long todoId); @ExceptionHandler(FormValidationError.class) @ResponseBody @ResponseStatus(HttpStatus.BAD_REQUEST) FormValidationErrorDTO handleFormValidationError(FormValidationError validationError); @RequestMapping(value = "/api/todo/search/{searchTerm}", method = RequestMethod.GET) @ResponseBody List<TodoDTO> search(@PathVariable("searchTerm") String searchTerm, Pageable page); @ExceptionHandler(TodoNotFoundException.class) @ResponseStatus(HttpStatus.NOT_FOUND) void handleTodoNotFoundException(TodoNotFoundException ex);  }