@Test public void testSearchAndZipWhenQueryIsNotValid() throws IOException { given(luceneEngine.search("test")).willThrow(new QueryCannotBeParsedException("Parse Exception")); underTest.searchAndZip("test", response); verify(fileZipper).createZipWithFiles(new ArrayList<List<String>>(), outputStream); }
@RequestMapping(value = "/search", method = RequestMethod.GET) public void searchAndZip(@RequestParam("text") final String searchedText, final HttpServletResponse resp) { if (searchedText != null && !"".equals(searchedText)) { List<List<String>> searchResult; try { searchResult = searchForText(searchedText); } catch (QueryCannotBeParsedException e) { logger.warn("Invalid query"); searchResult = new ArrayList<List<String>>(); } zipSearchResult(searchedText, resp, searchResult); } }
SearchController { @RequestMapping(value = "/search", method = RequestMethod.GET) public void searchAndZip(@RequestParam("text") final String searchedText, final HttpServletResponse resp) { if (searchedText != null && !"".equals(searchedText)) { List<List<String>> searchResult; try { searchResult = searchForText(searchedText); } catch (QueryCannotBeParsedException e) { logger.warn("Invalid query"); searchResult = new ArrayList<List<String>>(); } zipSearchResult(searchedText, resp, searchResult); } } }
SearchController { @RequestMapping(value = "/search", method = RequestMethod.GET) public void searchAndZip(@RequestParam("text") final String searchedText, final HttpServletResponse resp) { if (searchedText != null && !"".equals(searchedText)) { List<List<String>> searchResult; try { searchResult = searchForText(searchedText); } catch (QueryCannotBeParsedException e) { logger.warn("Invalid query"); searchResult = new ArrayList<List<String>>(); } zipSearchResult(searchedText, resp, searchResult); } }  }
SearchController { @RequestMapping(value = "/search", method = RequestMethod.GET) public void searchAndZip(@RequestParam("text") final String searchedText, final HttpServletResponse resp) { if (searchedText != null && !"".equals(searchedText)) { List<List<String>> searchResult; try { searchResult = searchForText(searchedText); } catch (QueryCannotBeParsedException e) { logger.warn("Invalid query"); searchResult = new ArrayList<List<String>>(); } zipSearchResult(searchedText, resp, searchResult); } }  @RequestMapping(value = "/search", method = RequestMethod.GET) void searchAndZip(@RequestParam("text") final String searchedText, final HttpServletResponse resp); @ResponseBody @RequestMapping(value = "/search", method = RequestMethod.POST) ResponseEntity<String> searchForFiles(@RequestParam("searchedText") final String searchedText, final HttpSession session); }
SearchController { @RequestMapping(value = "/search", method = RequestMethod.GET) public void searchAndZip(@RequestParam("text") final String searchedText, final HttpServletResponse resp) { if (searchedText != null && !"".equals(searchedText)) { List<List<String>> searchResult; try { searchResult = searchForText(searchedText); } catch (QueryCannotBeParsedException e) { logger.warn("Invalid query"); searchResult = new ArrayList<List<String>>(); } zipSearchResult(searchedText, resp, searchResult); } }  @RequestMapping(value = "/search", method = RequestMethod.GET) void searchAndZip(@RequestParam("text") final String searchedText, final HttpServletResponse resp); @ResponseBody @RequestMapping(value = "/search", method = RequestMethod.POST) ResponseEntity<String> searchForFiles(@RequestParam("searchedText") final String searchedText, final HttpSession session);  }