@Test public final void testSearch() { List<Bank> search = new ArrayList<>(); search.add(getBank()); Pagination<Bank> expectedResult = new Pagination<>(); expectedResult.setPagedData(search); when(bankRepository.search(any(BankSearch.class))).thenReturn(expectedResult); Pagination<Bank> actualResult = bankService.search(getBankSearch(), errors); assertEquals(expectedResult, actualResult); }
public Pagination<Bank> search(BankSearch bankSearch, BindingResult errors) { try { List<Bank> banks = new ArrayList<>(); banks.add(bankSearch); validate(banks, Constants.ACTION_SEARCH, errors); if (errors.hasErrors()) { throw new CustomBindException(errors); } } catch (CustomBindException e) { throw new CustomBindException(errors); } return bankRepository.search(bankSearch); }
BankService { public Pagination<Bank> search(BankSearch bankSearch, BindingResult errors) { try { List<Bank> banks = new ArrayList<>(); banks.add(bankSearch); validate(banks, Constants.ACTION_SEARCH, errors); if (errors.hasErrors()) { throw new CustomBindException(errors); } } catch (CustomBindException e) { throw new CustomBindException(errors); } return bankRepository.search(bankSearch); } }
BankService { public Pagination<Bank> search(BankSearch bankSearch, BindingResult errors) { try { List<Bank> banks = new ArrayList<>(); banks.add(bankSearch); validate(banks, Constants.ACTION_SEARCH, errors); if (errors.hasErrors()) { throw new CustomBindException(errors); } } catch (CustomBindException e) { throw new CustomBindException(errors); } return bankRepository.search(bankSearch); }  }
BankService { public Pagination<Bank> search(BankSearch bankSearch, BindingResult errors) { try { List<Bank> banks = new ArrayList<>(); banks.add(bankSearch); validate(banks, Constants.ACTION_SEARCH, errors); if (errors.hasErrors()) { throw new CustomBindException(errors); } } catch (CustomBindException e) { throw new CustomBindException(errors); } return bankRepository.search(bankSearch); }  @Transactional List<Bank> create(List<Bank> banks, BindingResult errors, RequestInfo requestInfo); @Transactional List<Bank> update(List<Bank> banks, BindingResult errors, RequestInfo requestInfo); List<Bank> fetchRelated(List<Bank> banks); @Transactional List<Bank> update(List<Bank> banks, BindingResult errors); Pagination<Bank> search(BankSearch bankSearch, BindingResult errors); @Transactional Bank save(Bank bank); @Transactional Bank update(Bank bank); }
BankService { public Pagination<Bank> search(BankSearch bankSearch, BindingResult errors) { try { List<Bank> banks = new ArrayList<>(); banks.add(bankSearch); validate(banks, Constants.ACTION_SEARCH, errors); if (errors.hasErrors()) { throw new CustomBindException(errors); } } catch (CustomBindException e) { throw new CustomBindException(errors); } return bankRepository.search(bankSearch); }  @Transactional List<Bank> create(List<Bank> banks, BindingResult errors, RequestInfo requestInfo); @Transactional List<Bank> update(List<Bank> banks, BindingResult errors, RequestInfo requestInfo); List<Bank> fetchRelated(List<Bank> banks); @Transactional List<Bank> update(List<Bank> banks, BindingResult errors); Pagination<Bank> search(BankSearch bankSearch, BindingResult errors); @Transactional Bank save(Bank bank); @Transactional Bank update(Bank bank);  }