@Test public final void testSearch() { List<BankBranch> search = new ArrayList<>(); search.add(getBankBranch()); Pagination<BankBranch> expectedResult = new Pagination<>(); expectedResult.setPagedData(search); when(bankBranchRepository.search(any(BankBranchSearch.class))).thenReturn(expectedResult); Pagination<BankBranch> actualResult = bankBranchService.search(getBankBranchSearch(), errors); assertEquals(expectedResult, actualResult); }
public Pagination<BankBranch> search(BankBranchSearch bankBranchSearch, BindingResult errors) { try { List<BankBranch> bankBranches = new ArrayList<>(); bankBranches.add(bankBranchSearch); validate(bankBranches, Constants.ACTION_SEARCH, errors); if (errors.hasErrors()) { throw new CustomBindException(errors); } } catch (CustomBindException e) { throw new CustomBindException(errors); } return bankBranchRepository.search(bankBranchSearch); }
BankBranchService { public Pagination<BankBranch> search(BankBranchSearch bankBranchSearch, BindingResult errors) { try { List<BankBranch> bankBranches = new ArrayList<>(); bankBranches.add(bankBranchSearch); validate(bankBranches, Constants.ACTION_SEARCH, errors); if (errors.hasErrors()) { throw new CustomBindException(errors); } } catch (CustomBindException e) { throw new CustomBindException(errors); } return bankBranchRepository.search(bankBranchSearch); } }
BankBranchService { public Pagination<BankBranch> search(BankBranchSearch bankBranchSearch, BindingResult errors) { try { List<BankBranch> bankBranches = new ArrayList<>(); bankBranches.add(bankBranchSearch); validate(bankBranches, Constants.ACTION_SEARCH, errors); if (errors.hasErrors()) { throw new CustomBindException(errors); } } catch (CustomBindException e) { throw new CustomBindException(errors); } return bankBranchRepository.search(bankBranchSearch); }  }
BankBranchService { public Pagination<BankBranch> search(BankBranchSearch bankBranchSearch, BindingResult errors) { try { List<BankBranch> bankBranches = new ArrayList<>(); bankBranches.add(bankBranchSearch); validate(bankBranches, Constants.ACTION_SEARCH, errors); if (errors.hasErrors()) { throw new CustomBindException(errors); } } catch (CustomBindException e) { throw new CustomBindException(errors); } return bankBranchRepository.search(bankBranchSearch); }  @Transactional List<BankBranch> create(List<BankBranch> bankBranches, BindingResult errors, RequestInfo requestInfo); @Transactional List<BankBranch> update(List<BankBranch> bankBranches, BindingResult errors, RequestInfo requestInfo); List<BankBranch> fetchRelated(List<BankBranch> bankbranches); @Transactional List<BankBranch> update(List<BankBranch> bankbranches, BindingResult errors); Pagination<BankBranch> search(BankBranchSearch bankBranchSearch, BindingResult errors); @Transactional BankBranch save(BankBranch bankBranch); @Transactional BankBranch update(BankBranch bankBranch); }
BankBranchService { public Pagination<BankBranch> search(BankBranchSearch bankBranchSearch, BindingResult errors) { try { List<BankBranch> bankBranches = new ArrayList<>(); bankBranches.add(bankBranchSearch); validate(bankBranches, Constants.ACTION_SEARCH, errors); if (errors.hasErrors()) { throw new CustomBindException(errors); } } catch (CustomBindException e) { throw new CustomBindException(errors); } return bankBranchRepository.search(bankBranchSearch); }  @Transactional List<BankBranch> create(List<BankBranch> bankBranches, BindingResult errors, RequestInfo requestInfo); @Transactional List<BankBranch> update(List<BankBranch> bankBranches, BindingResult errors, RequestInfo requestInfo); List<BankBranch> fetchRelated(List<BankBranch> bankbranches); @Transactional List<BankBranch> update(List<BankBranch> bankbranches, BindingResult errors); Pagination<BankBranch> search(BankBranchSearch bankBranchSearch, BindingResult errors); @Transactional BankBranch save(BankBranch bankBranch); @Transactional BankBranch update(BankBranch bankBranch);  }