@Test public final void testSearch() { List<BankAccount> search = new ArrayList<>(); search.add(getBankAccount()); Pagination<BankAccount> expectedResult = new Pagination<>(); expectedResult.setPagedData(search); when(bankAccountRepository.search(any(BankAccountSearch.class))).thenReturn(expectedResult); Pagination<BankAccount> actualResult = bankAccountService.search(getBankAccountSearch(), errors); assertEquals(expectedResult, actualResult); }
public Pagination<BankAccount> search(BankAccountSearch bankAccountSearch, BindingResult errors) { try { List<BankAccount> bankAccounts = new ArrayList<>(); bankAccounts.add(bankAccountSearch); validate(bankAccounts, Constants.ACTION_SEARCH, errors); if (errors.hasErrors()) { throw new CustomBindException(errors); } } catch (CustomBindException e) { throw new CustomBindException(errors); } return bankAccountRepository.search(bankAccountSearch); }
BankAccountService { public Pagination<BankAccount> search(BankAccountSearch bankAccountSearch, BindingResult errors) { try { List<BankAccount> bankAccounts = new ArrayList<>(); bankAccounts.add(bankAccountSearch); validate(bankAccounts, Constants.ACTION_SEARCH, errors); if (errors.hasErrors()) { throw new CustomBindException(errors); } } catch (CustomBindException e) { throw new CustomBindException(errors); } return bankAccountRepository.search(bankAccountSearch); } }
BankAccountService { public Pagination<BankAccount> search(BankAccountSearch bankAccountSearch, BindingResult errors) { try { List<BankAccount> bankAccounts = new ArrayList<>(); bankAccounts.add(bankAccountSearch); validate(bankAccounts, Constants.ACTION_SEARCH, errors); if (errors.hasErrors()) { throw new CustomBindException(errors); } } catch (CustomBindException e) { throw new CustomBindException(errors); } return bankAccountRepository.search(bankAccountSearch); }  }
BankAccountService { public Pagination<BankAccount> search(BankAccountSearch bankAccountSearch, BindingResult errors) { try { List<BankAccount> bankAccounts = new ArrayList<>(); bankAccounts.add(bankAccountSearch); validate(bankAccounts, Constants.ACTION_SEARCH, errors); if (errors.hasErrors()) { throw new CustomBindException(errors); } } catch (CustomBindException e) { throw new CustomBindException(errors); } return bankAccountRepository.search(bankAccountSearch); }  @Transactional List<BankAccount> create(List<BankAccount> bankAccounts, BindingResult errors, RequestInfo requestInfo); @Transactional List<BankAccount> update(List<BankAccount> bankAccounts, BindingResult errors, RequestInfo requestInfo); List<BankAccount> fetchRelated(List<BankAccount> bankaccounts); @Transactional List<BankAccount> update(List<BankAccount> bankaccounts, BindingResult errors); void addToQue(BankAccountRequest request); Pagination<BankAccount> search(BankAccountSearch bankAccountSearch, BindingResult errors); @Transactional BankAccount save(BankAccount bankAccount); @Transactional BankAccount update(BankAccount bankAccount); }
BankAccountService { public Pagination<BankAccount> search(BankAccountSearch bankAccountSearch, BindingResult errors) { try { List<BankAccount> bankAccounts = new ArrayList<>(); bankAccounts.add(bankAccountSearch); validate(bankAccounts, Constants.ACTION_SEARCH, errors); if (errors.hasErrors()) { throw new CustomBindException(errors); } } catch (CustomBindException e) { throw new CustomBindException(errors); } return bankAccountRepository.search(bankAccountSearch); }  @Transactional List<BankAccount> create(List<BankAccount> bankAccounts, BindingResult errors, RequestInfo requestInfo); @Transactional List<BankAccount> update(List<BankAccount> bankAccounts, BindingResult errors, RequestInfo requestInfo); List<BankAccount> fetchRelated(List<BankAccount> bankaccounts); @Transactional List<BankAccount> update(List<BankAccount> bankaccounts, BindingResult errors); void addToQue(BankAccountRequest request); Pagination<BankAccount> search(BankAccountSearch bankAccountSearch, BindingResult errors); @Transactional BankAccount save(BankAccount bankAccount); @Transactional BankAccount update(BankAccount bankAccount);  }