@Test public final void testSearch() { List<Fund> search = new ArrayList<>(); search.add(getFundSearch()); Pagination<Fund> expectedResult = new Pagination<>(); expectedResult.setPagedData(search); when(fundRepository.search(any(FundSearch.class))).thenReturn(expectedResult); Pagination<Fund> actualResult = fundService.search(getFundSearch(), errors); assertEquals(expectedResult, actualResult); }
public Pagination<Fund> search(FundSearch fundSearch, BindingResult errors) { try { List<Fund> funds = new ArrayList<>(); funds.add(fundSearch); validate(funds, Constants.ACTION_SEARCH, errors); if (errors.hasErrors()) { throw new CustomBindException(errors); } } catch (CustomBindException e) { throw new CustomBindException(errors); } return fundRepository.search(fundSearch); }
FundService { public Pagination<Fund> search(FundSearch fundSearch, BindingResult errors) { try { List<Fund> funds = new ArrayList<>(); funds.add(fundSearch); validate(funds, Constants.ACTION_SEARCH, errors); if (errors.hasErrors()) { throw new CustomBindException(errors); } } catch (CustomBindException e) { throw new CustomBindException(errors); } return fundRepository.search(fundSearch); } }
FundService { public Pagination<Fund> search(FundSearch fundSearch, BindingResult errors) { try { List<Fund> funds = new ArrayList<>(); funds.add(fundSearch); validate(funds, Constants.ACTION_SEARCH, errors); if (errors.hasErrors()) { throw new CustomBindException(errors); } } catch (CustomBindException e) { throw new CustomBindException(errors); } return fundRepository.search(fundSearch); }  }
FundService { public Pagination<Fund> search(FundSearch fundSearch, BindingResult errors) { try { List<Fund> funds = new ArrayList<>(); funds.add(fundSearch); validate(funds, Constants.ACTION_SEARCH, errors); if (errors.hasErrors()) { throw new CustomBindException(errors); } } catch (CustomBindException e) { throw new CustomBindException(errors); } return fundRepository.search(fundSearch); }  @Transactional List<Fund> create(List<Fund> funds, BindingResult errors, RequestInfo requestInfo); @Transactional List<Fund> update(List<Fund> funds, BindingResult errors, RequestInfo requestInfo); List<Fund> fetchRelated(List<Fund> funds); Pagination<Fund> search(FundSearch fundSearch, BindingResult errors); @Transactional Fund save(Fund fund); @Transactional Fund update(Fund fund); }
FundService { public Pagination<Fund> search(FundSearch fundSearch, BindingResult errors) { try { List<Fund> funds = new ArrayList<>(); funds.add(fundSearch); validate(funds, Constants.ACTION_SEARCH, errors); if (errors.hasErrors()) { throw new CustomBindException(errors); } } catch (CustomBindException e) { throw new CustomBindException(errors); } return fundRepository.search(fundSearch); }  @Transactional List<Fund> create(List<Fund> funds, BindingResult errors, RequestInfo requestInfo); @Transactional List<Fund> update(List<Fund> funds, BindingResult errors, RequestInfo requestInfo); List<Fund> fetchRelated(List<Fund> funds); Pagination<Fund> search(FundSearch fundSearch, BindingResult errors); @Transactional Fund save(Fund fund); @Transactional Fund update(Fund fund);  }