SearchServiceImpl implements SearchService { @Override public SearchResult search(SearchRequest searchRequest) throws IOException { Query query = null; CrescentSearchRequestWrapper csrw = new CrescentSearchRequestWrapper(searchRequest); try { SearchRequestValidator validator = new SearchRequestValidator(); validator.isValid(searchRequest); query = csrw.getQuery(); } catch (CrescentInvalidRequestException e) { SearchResult searchResult = new SearchResult(); Map<String, Object> result = new HashMap<String, Object>(); List<Map<String, String>> resultList = new ArrayList<Map<String, String>>(); result.put("total_count", 0); result.put("result_list", resultList); result.put("error_code", -1); result.put("error_msg", e.getMessage()); logger.error("검색 중 에러 발생함." , e); searchResult.setErrorCode(-1); searchResult.setErrorMsg(e.getMessage()); searchResult.setSearchResult(result); searchResult.setResultList(resultList); return searchResult; } logger.debug("query : {}" , query); SearchResult searchResult = crescentDocSearcher.search(csrw); return searchResult; }  @Override SearchResult search(SearchRequest searchRequest);  }
@Test public void search() throws IOException { SearchRequest searchRequest = new SearchRequest(); searchRequest.setCollectionName("sample"); searchRequest.setKeyword("1"); SearchResult searchResult = searchService.search(searchRequest); Assert.assertTrue(searchResult.getTotalHitsCount() > 0); }