@Test public final void testSearch(){ List<ChartOfAccountDetail> search = new ArrayList<>(); search.add(getChartOfAccountDetailSearch()); Pagination<ChartOfAccountDetail> expectedResult = new Pagination<>(); expectedResult.setPagedData(search); when(chartOfAccountDetailRepository.search(any(ChartOfAccountDetailSearch.class))).thenReturn(expectedResult); Pagination<ChartOfAccountDetail> actualResult = chartOfAccountDetailService.search(getChartOfAccountDetailSearch(), errors); assertEquals(expectedResult, actualResult); }
public Pagination<ChartOfAccountDetail> search(ChartOfAccountDetailSearch chartOfAccountDetailSearch, BindingResult errors) { try { List<ChartOfAccountDetail> chartOfAccountDetails = new ArrayList<>(); chartOfAccountDetails.add(chartOfAccountDetailSearch); validate(chartOfAccountDetails, Constants.ACTION_SEARCH, errors); if (errors.hasErrors()) { throw new CustomBindException(errors); } } catch (CustomBindException e) { throw new CustomBindException(errors); } return chartOfAccountDetailRepository.search(chartOfAccountDetailSearch); }
ChartOfAccountDetailService { public Pagination<ChartOfAccountDetail> search(ChartOfAccountDetailSearch chartOfAccountDetailSearch, BindingResult errors) { try { List<ChartOfAccountDetail> chartOfAccountDetails = new ArrayList<>(); chartOfAccountDetails.add(chartOfAccountDetailSearch); validate(chartOfAccountDetails, Constants.ACTION_SEARCH, errors); if (errors.hasErrors()) { throw new CustomBindException(errors); } } catch (CustomBindException e) { throw new CustomBindException(errors); } return chartOfAccountDetailRepository.search(chartOfAccountDetailSearch); } }
ChartOfAccountDetailService { public Pagination<ChartOfAccountDetail> search(ChartOfAccountDetailSearch chartOfAccountDetailSearch, BindingResult errors) { try { List<ChartOfAccountDetail> chartOfAccountDetails = new ArrayList<>(); chartOfAccountDetails.add(chartOfAccountDetailSearch); validate(chartOfAccountDetails, Constants.ACTION_SEARCH, errors); if (errors.hasErrors()) { throw new CustomBindException(errors); } } catch (CustomBindException e) { throw new CustomBindException(errors); } return chartOfAccountDetailRepository.search(chartOfAccountDetailSearch); }  }
ChartOfAccountDetailService { public Pagination<ChartOfAccountDetail> search(ChartOfAccountDetailSearch chartOfAccountDetailSearch, BindingResult errors) { try { List<ChartOfAccountDetail> chartOfAccountDetails = new ArrayList<>(); chartOfAccountDetails.add(chartOfAccountDetailSearch); validate(chartOfAccountDetails, Constants.ACTION_SEARCH, errors); if (errors.hasErrors()) { throw new CustomBindException(errors); } } catch (CustomBindException e) { throw new CustomBindException(errors); } return chartOfAccountDetailRepository.search(chartOfAccountDetailSearch); }  List<ChartOfAccountDetail> fetchRelated(List<ChartOfAccountDetail> chartofaccountdetails); @Transactional List<ChartOfAccountDetail> add(List<ChartOfAccountDetail> chartofaccountdetails, BindingResult errors); @Transactional List<ChartOfAccountDetail> update(List<ChartOfAccountDetail> chartofaccountdetails, BindingResult errors); void addToQue(ChartOfAccountDetailRequest request); Pagination<ChartOfAccountDetail> search(ChartOfAccountDetailSearch chartOfAccountDetailSearch, BindingResult errors); @Transactional ChartOfAccountDetail save(ChartOfAccountDetail chartOfAccountDetail); @Transactional ChartOfAccountDetail update(ChartOfAccountDetail chartOfAccountDetail); }
ChartOfAccountDetailService { public Pagination<ChartOfAccountDetail> search(ChartOfAccountDetailSearch chartOfAccountDetailSearch, BindingResult errors) { try { List<ChartOfAccountDetail> chartOfAccountDetails = new ArrayList<>(); chartOfAccountDetails.add(chartOfAccountDetailSearch); validate(chartOfAccountDetails, Constants.ACTION_SEARCH, errors); if (errors.hasErrors()) { throw new CustomBindException(errors); } } catch (CustomBindException e) { throw new CustomBindException(errors); } return chartOfAccountDetailRepository.search(chartOfAccountDetailSearch); }  List<ChartOfAccountDetail> fetchRelated(List<ChartOfAccountDetail> chartofaccountdetails); @Transactional List<ChartOfAccountDetail> add(List<ChartOfAccountDetail> chartofaccountdetails, BindingResult errors); @Transactional List<ChartOfAccountDetail> update(List<ChartOfAccountDetail> chartofaccountdetails, BindingResult errors); void addToQue(ChartOfAccountDetailRequest request); Pagination<ChartOfAccountDetail> search(ChartOfAccountDetailSearch chartOfAccountDetailSearch, BindingResult errors); @Transactional ChartOfAccountDetail save(ChartOfAccountDetail chartOfAccountDetail); @Transactional ChartOfAccountDetail update(ChartOfAccountDetail chartOfAccountDetail);  }