@Test public final void testSearch() { List<AccountDetailType> search = new ArrayList<>(); search.add(getAccountDetailTypeSearch()); Pagination<AccountDetailType> expectedResult = new Pagination<>(); expectedResult.setPagedData(search); when(accountDetailTypeRepository.search(any(AccountDetailTypeSearch.class))).thenReturn(expectedResult); Pagination<AccountDetailType> actualResult = accountDetailTypeService.search(getAccountDetailTypeSearch(), errors); assertEquals(expectedResult, actualResult); }
public Pagination<AccountDetailType> search(AccountDetailTypeSearch accountDetailTypeSearch, BindingResult errors) { try { List<AccountDetailType> accountDetailTypes = new ArrayList<>(); accountDetailTypes.add(accountDetailTypeSearch); validate(accountDetailTypes, Constants.ACTION_SEARCH, errors); if (errors.hasErrors()) { throw new CustomBindException(errors); } } catch (CustomBindException e) { throw new CustomBindException(errors); } return accountDetailTypeRepository.search(accountDetailTypeSearch); }
AccountDetailTypeService { public Pagination<AccountDetailType> search(AccountDetailTypeSearch accountDetailTypeSearch, BindingResult errors) { try { List<AccountDetailType> accountDetailTypes = new ArrayList<>(); accountDetailTypes.add(accountDetailTypeSearch); validate(accountDetailTypes, Constants.ACTION_SEARCH, errors); if (errors.hasErrors()) { throw new CustomBindException(errors); } } catch (CustomBindException e) { throw new CustomBindException(errors); } return accountDetailTypeRepository.search(accountDetailTypeSearch); } }
AccountDetailTypeService { public Pagination<AccountDetailType> search(AccountDetailTypeSearch accountDetailTypeSearch, BindingResult errors) { try { List<AccountDetailType> accountDetailTypes = new ArrayList<>(); accountDetailTypes.add(accountDetailTypeSearch); validate(accountDetailTypes, Constants.ACTION_SEARCH, errors); if (errors.hasErrors()) { throw new CustomBindException(errors); } } catch (CustomBindException e) { throw new CustomBindException(errors); } return accountDetailTypeRepository.search(accountDetailTypeSearch); }  }
AccountDetailTypeService { public Pagination<AccountDetailType> search(AccountDetailTypeSearch accountDetailTypeSearch, BindingResult errors) { try { List<AccountDetailType> accountDetailTypes = new ArrayList<>(); accountDetailTypes.add(accountDetailTypeSearch); validate(accountDetailTypes, Constants.ACTION_SEARCH, errors); if (errors.hasErrors()) { throw new CustomBindException(errors); } } catch (CustomBindException e) { throw new CustomBindException(errors); } return accountDetailTypeRepository.search(accountDetailTypeSearch); }  @Transactional List<AccountDetailType> create(List<AccountDetailType> accountDetailTypes, BindingResult errors,
			RequestInfo requestInfo); @Transactional List<AccountDetailType> update(List<AccountDetailType> accountDetailTypes, BindingResult errors,
			RequestInfo requestInfo); List<AccountDetailType> fetchRelated(List<AccountDetailType> accountdetailtypes); @Transactional List<AccountDetailType> add(List<AccountDetailType> accountdetailtypes, BindingResult errors); @Transactional List<AccountDetailType> update(List<AccountDetailType> accountdetailtypes, BindingResult errors); void addToQue(AccountDetailTypeRequest request); Pagination<AccountDetailType> search(AccountDetailTypeSearch accountDetailTypeSearch, BindingResult errors); @Transactional AccountDetailType save(AccountDetailType accountDetailType); @Transactional AccountDetailType update(AccountDetailType accountDetailType); }
AccountDetailTypeService { public Pagination<AccountDetailType> search(AccountDetailTypeSearch accountDetailTypeSearch, BindingResult errors) { try { List<AccountDetailType> accountDetailTypes = new ArrayList<>(); accountDetailTypes.add(accountDetailTypeSearch); validate(accountDetailTypes, Constants.ACTION_SEARCH, errors); if (errors.hasErrors()) { throw new CustomBindException(errors); } } catch (CustomBindException e) { throw new CustomBindException(errors); } return accountDetailTypeRepository.search(accountDetailTypeSearch); }  @Transactional List<AccountDetailType> create(List<AccountDetailType> accountDetailTypes, BindingResult errors,
			RequestInfo requestInfo); @Transactional List<AccountDetailType> update(List<AccountDetailType> accountDetailTypes, BindingResult errors,
			RequestInfo requestInfo); List<AccountDetailType> fetchRelated(List<AccountDetailType> accountdetailtypes); @Transactional List<AccountDetailType> add(List<AccountDetailType> accountdetailtypes, BindingResult errors); @Transactional List<AccountDetailType> update(List<AccountDetailType> accountdetailtypes, BindingResult errors); void addToQue(AccountDetailTypeRequest request); Pagination<AccountDetailType> search(AccountDetailTypeSearch accountDetailTypeSearch, BindingResult errors); @Transactional AccountDetailType save(AccountDetailType accountDetailType); @Transactional AccountDetailType update(AccountDetailType accountDetailType);  }