@Test public final void testSearch() { List<AccountDetailKey> search = new ArrayList<>(); search.add(getAccountDetailKeySearch()); Pagination<AccountDetailKey> expectedResult = new Pagination<>(); expectedResult.setPagedData(search); when(accountDetailKeyRepository.search(any(AccountDetailKeySearch.class))).thenReturn(expectedResult); Pagination<AccountDetailKey> actualResult = accountDetailKeyService.search(getAccountDetailKeySearch(), errors); assertEquals(expectedResult, actualResult); }
public Pagination<AccountDetailKey> search(AccountDetailKeySearch accountDetailKeySearch, BindingResult errors) { try { List<AccountDetailKey> accountDetailKeys = new ArrayList<>(); accountDetailKeys.add(accountDetailKeySearch); validate(accountDetailKeys, Constants.ACTION_SEARCH, errors); if (errors.hasErrors()) { throw new CustomBindException(errors); } } catch (CustomBindException e) { throw new CustomBindException(errors); } return accountDetailKeyRepository.search(accountDetailKeySearch); }
AccountDetailKeyService { public Pagination<AccountDetailKey> search(AccountDetailKeySearch accountDetailKeySearch, BindingResult errors) { try { List<AccountDetailKey> accountDetailKeys = new ArrayList<>(); accountDetailKeys.add(accountDetailKeySearch); validate(accountDetailKeys, Constants.ACTION_SEARCH, errors); if (errors.hasErrors()) { throw new CustomBindException(errors); } } catch (CustomBindException e) { throw new CustomBindException(errors); } return accountDetailKeyRepository.search(accountDetailKeySearch); } }
AccountDetailKeyService { public Pagination<AccountDetailKey> search(AccountDetailKeySearch accountDetailKeySearch, BindingResult errors) { try { List<AccountDetailKey> accountDetailKeys = new ArrayList<>(); accountDetailKeys.add(accountDetailKeySearch); validate(accountDetailKeys, Constants.ACTION_SEARCH, errors); if (errors.hasErrors()) { throw new CustomBindException(errors); } } catch (CustomBindException e) { throw new CustomBindException(errors); } return accountDetailKeyRepository.search(accountDetailKeySearch); }  }
AccountDetailKeyService { public Pagination<AccountDetailKey> search(AccountDetailKeySearch accountDetailKeySearch, BindingResult errors) { try { List<AccountDetailKey> accountDetailKeys = new ArrayList<>(); accountDetailKeys.add(accountDetailKeySearch); validate(accountDetailKeys, Constants.ACTION_SEARCH, errors); if (errors.hasErrors()) { throw new CustomBindException(errors); } } catch (CustomBindException e) { throw new CustomBindException(errors); } return accountDetailKeyRepository.search(accountDetailKeySearch); }  @Transactional List<AccountDetailKey> create(List<AccountDetailKey> accountDetailKies, BindingResult errors,
			RequestInfo requestInfo); @Transactional List<AccountDetailKey> update(List<AccountDetailKey> accountDetailKies, BindingResult errors,
			RequestInfo requestInfo); List<AccountDetailKey> fetchRelated(List<AccountDetailKey> accountdetailkeys); @Transactional List<AccountDetailKey> add(List<AccountDetailKey> accountdetailkeys, BindingResult errors); @Transactional List<AccountDetailKey> update(List<AccountDetailKey> accountdetailkeys, BindingResult errors); void addToQue(AccountDetailKeyRequest request); Pagination<AccountDetailKey> search(AccountDetailKeySearch accountDetailKeySearch, BindingResult errors); @Transactional AccountDetailKey save(AccountDetailKey accountDetailKey); @Transactional AccountDetailKey update(AccountDetailKey accountDetailKey); }
AccountDetailKeyService { public Pagination<AccountDetailKey> search(AccountDetailKeySearch accountDetailKeySearch, BindingResult errors) { try { List<AccountDetailKey> accountDetailKeys = new ArrayList<>(); accountDetailKeys.add(accountDetailKeySearch); validate(accountDetailKeys, Constants.ACTION_SEARCH, errors); if (errors.hasErrors()) { throw new CustomBindException(errors); } } catch (CustomBindException e) { throw new CustomBindException(errors); } return accountDetailKeyRepository.search(accountDetailKeySearch); }  @Transactional List<AccountDetailKey> create(List<AccountDetailKey> accountDetailKies, BindingResult errors,
			RequestInfo requestInfo); @Transactional List<AccountDetailKey> update(List<AccountDetailKey> accountDetailKies, BindingResult errors,
			RequestInfo requestInfo); List<AccountDetailKey> fetchRelated(List<AccountDetailKey> accountdetailkeys); @Transactional List<AccountDetailKey> add(List<AccountDetailKey> accountdetailkeys, BindingResult errors); @Transactional List<AccountDetailKey> update(List<AccountDetailKey> accountdetailkeys, BindingResult errors); void addToQue(AccountDetailKeyRequest request); Pagination<AccountDetailKey> search(AccountDetailKeySearch accountDetailKeySearch, BindingResult errors); @Transactional AccountDetailKey save(AccountDetailKey accountDetailKey); @Transactional AccountDetailKey update(AccountDetailKey accountDetailKey);  }