@Test public final void testSearch() { List<AccountCodePurpose> search = new ArrayList<>(); search.add(getAccountCodePurposeSearch()); Pagination<AccountCodePurpose> expectedResult = new Pagination<>(); expectedResult.setPagedData(search); when(accountCodePurposeRepository.search(any(AccountCodePurposeSearch.class))).thenReturn(expectedResult); Pagination<AccountCodePurpose> actualResult = accountCodePurposeService.search(getAccountCodePurposeSearch(), errors); assertEquals(expectedResult, actualResult); }
public Pagination<AccountCodePurpose> search(AccountCodePurposeSearch accountCodePurposeSearch, BindingResult errors) { try { List<AccountCodePurpose> accountCodePurposes = new ArrayList<>(); accountCodePurposes.add(accountCodePurposeSearch); validate(accountCodePurposes, Constants.ACTION_SEARCH, errors); if (errors.hasErrors()) { throw new CustomBindException(errors); } } catch (CustomBindException e) { throw new CustomBindException(errors); } return accountCodePurposeRepository.search(accountCodePurposeSearch); }
AccountCodePurposeService { public Pagination<AccountCodePurpose> search(AccountCodePurposeSearch accountCodePurposeSearch, BindingResult errors) { try { List<AccountCodePurpose> accountCodePurposes = new ArrayList<>(); accountCodePurposes.add(accountCodePurposeSearch); validate(accountCodePurposes, Constants.ACTION_SEARCH, errors); if (errors.hasErrors()) { throw new CustomBindException(errors); } } catch (CustomBindException e) { throw new CustomBindException(errors); } return accountCodePurposeRepository.search(accountCodePurposeSearch); } }
AccountCodePurposeService { public Pagination<AccountCodePurpose> search(AccountCodePurposeSearch accountCodePurposeSearch, BindingResult errors) { try { List<AccountCodePurpose> accountCodePurposes = new ArrayList<>(); accountCodePurposes.add(accountCodePurposeSearch); validate(accountCodePurposes, Constants.ACTION_SEARCH, errors); if (errors.hasErrors()) { throw new CustomBindException(errors); } } catch (CustomBindException e) { throw new CustomBindException(errors); } return accountCodePurposeRepository.search(accountCodePurposeSearch); }  }
AccountCodePurposeService { public Pagination<AccountCodePurpose> search(AccountCodePurposeSearch accountCodePurposeSearch, BindingResult errors) { try { List<AccountCodePurpose> accountCodePurposes = new ArrayList<>(); accountCodePurposes.add(accountCodePurposeSearch); validate(accountCodePurposes, Constants.ACTION_SEARCH, errors); if (errors.hasErrors()) { throw new CustomBindException(errors); } } catch (CustomBindException e) { throw new CustomBindException(errors); } return accountCodePurposeRepository.search(accountCodePurposeSearch); }  @Transactional List<AccountCodePurpose> create(List<AccountCodePurpose> accountCodePurposes, BindingResult errors,
			RequestInfo requestInfo); @Transactional List<AccountCodePurpose> update(List<AccountCodePurpose> accountCodePurposes, BindingResult errors,
			RequestInfo requestInfo); List<AccountCodePurpose> fetchRelated(List<AccountCodePurpose> accountcodepurposes); @Transactional List<AccountCodePurpose> add(List<AccountCodePurpose> accountcodepurposes, BindingResult errors); @Transactional List<AccountCodePurpose> update(List<AccountCodePurpose> accountcodepurposes, BindingResult errors); void addToQue(AccountCodePurposeRequest request); Pagination<AccountCodePurpose> search(AccountCodePurposeSearch accountCodePurposeSearch,
			BindingResult errors); @Transactional AccountCodePurpose save(AccountCodePurpose accountCodePurpose); @Transactional AccountCodePurpose update(AccountCodePurpose accountCodePurpose); }
AccountCodePurposeService { public Pagination<AccountCodePurpose> search(AccountCodePurposeSearch accountCodePurposeSearch, BindingResult errors) { try { List<AccountCodePurpose> accountCodePurposes = new ArrayList<>(); accountCodePurposes.add(accountCodePurposeSearch); validate(accountCodePurposes, Constants.ACTION_SEARCH, errors); if (errors.hasErrors()) { throw new CustomBindException(errors); } } catch (CustomBindException e) { throw new CustomBindException(errors); } return accountCodePurposeRepository.search(accountCodePurposeSearch); }  @Transactional List<AccountCodePurpose> create(List<AccountCodePurpose> accountCodePurposes, BindingResult errors,
			RequestInfo requestInfo); @Transactional List<AccountCodePurpose> update(List<AccountCodePurpose> accountCodePurposes, BindingResult errors,
			RequestInfo requestInfo); List<AccountCodePurpose> fetchRelated(List<AccountCodePurpose> accountcodepurposes); @Transactional List<AccountCodePurpose> add(List<AccountCodePurpose> accountcodepurposes, BindingResult errors); @Transactional List<AccountCodePurpose> update(List<AccountCodePurpose> accountcodepurposes, BindingResult errors); void addToQue(AccountCodePurposeRequest request); Pagination<AccountCodePurpose> search(AccountCodePurposeSearch accountCodePurposeSearch,
			BindingResult errors); @Transactional AccountCodePurpose save(AccountCodePurpose accountCodePurpose); @Transactional AccountCodePurpose update(AccountCodePurpose accountCodePurpose);  }