@Test public final void testSearch() { List<AccountEntity> search = new ArrayList<>(); search.add(getAccountEntitySearch()); Pagination<AccountEntity> expectedResult = new Pagination<>(); expectedResult.setPagedData(search); when(accountEntityRepository.search(any(AccountEntitySearch.class))).thenReturn(expectedResult); Pagination<AccountEntity> actualResult = accountEntityService.search(getAccountEntitySearch(), errors); assertEquals(expectedResult, actualResult); }
public Pagination<AccountEntity> search(AccountEntitySearch accountEntitySearch, BindingResult errors) { try { List<AccountEntity> accountentities = new ArrayList<>(); accountentities.add(accountEntitySearch); validate(accountentities, Constants.ACTION_SEARCH, errors); if (errors.hasErrors()) { throw new CustomBindException(errors); } } catch (CustomBindException e) { throw new CustomBindException(errors); } return accountEntityRepository.search(accountEntitySearch); }
AccountEntityService { public Pagination<AccountEntity> search(AccountEntitySearch accountEntitySearch, BindingResult errors) { try { List<AccountEntity> accountentities = new ArrayList<>(); accountentities.add(accountEntitySearch); validate(accountentities, Constants.ACTION_SEARCH, errors); if (errors.hasErrors()) { throw new CustomBindException(errors); } } catch (CustomBindException e) { throw new CustomBindException(errors); } return accountEntityRepository.search(accountEntitySearch); } }
AccountEntityService { public Pagination<AccountEntity> search(AccountEntitySearch accountEntitySearch, BindingResult errors) { try { List<AccountEntity> accountentities = new ArrayList<>(); accountentities.add(accountEntitySearch); validate(accountentities, Constants.ACTION_SEARCH, errors); if (errors.hasErrors()) { throw new CustomBindException(errors); } } catch (CustomBindException e) { throw new CustomBindException(errors); } return accountEntityRepository.search(accountEntitySearch); }  }
AccountEntityService { public Pagination<AccountEntity> search(AccountEntitySearch accountEntitySearch, BindingResult errors) { try { List<AccountEntity> accountentities = new ArrayList<>(); accountentities.add(accountEntitySearch); validate(accountentities, Constants.ACTION_SEARCH, errors); if (errors.hasErrors()) { throw new CustomBindException(errors); } } catch (CustomBindException e) { throw new CustomBindException(errors); } return accountEntityRepository.search(accountEntitySearch); }  @Transactional List<AccountEntity> create(List<AccountEntity> accountEntities, BindingResult errors, RequestInfo requestInfo); @Transactional List<AccountEntity> update(List<AccountEntity> accountEntities, BindingResult errors, RequestInfo requestInfo); List<AccountEntity> fetchRelated(List<AccountEntity> accountentities); @Transactional List<AccountEntity> add(List<AccountEntity> accountentities, BindingResult errors); @Transactional List<AccountEntity> update(List<AccountEntity> accountentities, BindingResult errors); void addToQue(AccountEntityRequest request); Pagination<AccountEntity> search(AccountEntitySearch accountEntitySearch, BindingResult errors); @Transactional AccountEntity save(AccountEntity accountEntity); @Transactional AccountEntity update(AccountEntity accountEntity); }
AccountEntityService { public Pagination<AccountEntity> search(AccountEntitySearch accountEntitySearch, BindingResult errors) { try { List<AccountEntity> accountentities = new ArrayList<>(); accountentities.add(accountEntitySearch); validate(accountentities, Constants.ACTION_SEARCH, errors); if (errors.hasErrors()) { throw new CustomBindException(errors); } } catch (CustomBindException e) { throw new CustomBindException(errors); } return accountEntityRepository.search(accountEntitySearch); }  @Transactional List<AccountEntity> create(List<AccountEntity> accountEntities, BindingResult errors, RequestInfo requestInfo); @Transactional List<AccountEntity> update(List<AccountEntity> accountEntities, BindingResult errors, RequestInfo requestInfo); List<AccountEntity> fetchRelated(List<AccountEntity> accountentities); @Transactional List<AccountEntity> add(List<AccountEntity> accountentities, BindingResult errors); @Transactional List<AccountEntity> update(List<AccountEntity> accountentities, BindingResult errors); void addToQue(AccountEntityRequest request); Pagination<AccountEntity> search(AccountEntitySearch accountEntitySearch, BindingResult errors); @Transactional AccountEntity save(AccountEntity accountEntity); @Transactional AccountEntity update(AccountEntity accountEntity);  }