@Test public final void test_search() { List<Recovery> search = new ArrayList<>(); search.add(getRecoverySearch()); Pagination<Recovery> expectedResult = new Pagination<>(); expectedResult.setPagedData(search); when(recoveryRepository.search(any(RecoverySearch.class))).thenReturn(expectedResult); Pagination<Recovery> actualResult = recoveryService.search(getRecoverySearch(), errors); assertEquals(expectedResult, actualResult); }
public Pagination<Recovery> search(RecoverySearch recoverySearch, BindingResult errors) { try { List<Recovery> recoveries = new ArrayList<>(); recoveries.add(recoverySearch); validate(recoveries, Constants.ACTION_SEARCH, errors); if (errors.hasErrors()) { throw new CustomBindException(errors); } } catch (CustomBindException e) { throw new CustomBindException(errors); } return recoveryRepository.search(recoverySearch); }
RecoveryService { public Pagination<Recovery> search(RecoverySearch recoverySearch, BindingResult errors) { try { List<Recovery> recoveries = new ArrayList<>(); recoveries.add(recoverySearch); validate(recoveries, Constants.ACTION_SEARCH, errors); if (errors.hasErrors()) { throw new CustomBindException(errors); } } catch (CustomBindException e) { throw new CustomBindException(errors); } return recoveryRepository.search(recoverySearch); } }
RecoveryService { public Pagination<Recovery> search(RecoverySearch recoverySearch, BindingResult errors) { try { List<Recovery> recoveries = new ArrayList<>(); recoveries.add(recoverySearch); validate(recoveries, Constants.ACTION_SEARCH, errors); if (errors.hasErrors()) { throw new CustomBindException(errors); } } catch (CustomBindException e) { throw new CustomBindException(errors); } return recoveryRepository.search(recoverySearch); }  }
RecoveryService { public Pagination<Recovery> search(RecoverySearch recoverySearch, BindingResult errors) { try { List<Recovery> recoveries = new ArrayList<>(); recoveries.add(recoverySearch); validate(recoveries, Constants.ACTION_SEARCH, errors); if (errors.hasErrors()) { throw new CustomBindException(errors); } } catch (CustomBindException e) { throw new CustomBindException(errors); } return recoveryRepository.search(recoverySearch); }  @Transactional List<Recovery> create(List<Recovery> recoveries, BindingResult errors,
                                 RequestInfo requestInfo); @Transactional List<Recovery> update(List<Recovery> recoveries, BindingResult errors,
                                 RequestInfo requestInfo); List<Recovery> fetchRelated(List<Recovery> recoveries); Pagination<Recovery> search(RecoverySearch recoverySearch, BindingResult errors); @Transactional Recovery save(Recovery recovery); @Transactional Recovery update(Recovery recovery); }
RecoveryService { public Pagination<Recovery> search(RecoverySearch recoverySearch, BindingResult errors) { try { List<Recovery> recoveries = new ArrayList<>(); recoveries.add(recoverySearch); validate(recoveries, Constants.ACTION_SEARCH, errors); if (errors.hasErrors()) { throw new CustomBindException(errors); } } catch (CustomBindException e) { throw new CustomBindException(errors); } return recoveryRepository.search(recoverySearch); }  @Transactional List<Recovery> create(List<Recovery> recoveries, BindingResult errors,
                                 RequestInfo requestInfo); @Transactional List<Recovery> update(List<Recovery> recoveries, BindingResult errors,
                                 RequestInfo requestInfo); List<Recovery> fetchRelated(List<Recovery> recoveries); Pagination<Recovery> search(RecoverySearch recoverySearch, BindingResult errors); @Transactional Recovery save(Recovery recovery); @Transactional Recovery update(Recovery recovery);  }