@Test public final void test_update() { Function expextedResult = getFunctions().get(0); when(functionRepository.update(any(Function.class))).thenReturn(expextedResult); Function actualResult = functionService.update(getFunctions().get(0)); assertEquals(expextedResult, actualResult); }
@Transactional public List<Function> update(List<Function> functions, BindingResult errors, RequestInfo requestInfo) { try { functions = fetchRelated(functions); validate(functions, Constants.ACTION_UPDATE, errors); if (errors.hasErrors()) { throw new CustomBindException(errors); } for (Function b : functions) { b.update(); } } catch (CustomBindException e) { throw new CustomBindException(errors); } return functionRepository.update(functions, requestInfo); }
FunctionService { @Transactional public List<Function> update(List<Function> functions, BindingResult errors, RequestInfo requestInfo) { try { functions = fetchRelated(functions); validate(functions, Constants.ACTION_UPDATE, errors); if (errors.hasErrors()) { throw new CustomBindException(errors); } for (Function b : functions) { b.update(); } } catch (CustomBindException e) { throw new CustomBindException(errors); } return functionRepository.update(functions, requestInfo); } }
FunctionService { @Transactional public List<Function> update(List<Function> functions, BindingResult errors, RequestInfo requestInfo) { try { functions = fetchRelated(functions); validate(functions, Constants.ACTION_UPDATE, errors); if (errors.hasErrors()) { throw new CustomBindException(errors); } for (Function b : functions) { b.update(); } } catch (CustomBindException e) { throw new CustomBindException(errors); } return functionRepository.update(functions, requestInfo); }  }
FunctionService { @Transactional public List<Function> update(List<Function> functions, BindingResult errors, RequestInfo requestInfo) { try { functions = fetchRelated(functions); validate(functions, Constants.ACTION_UPDATE, errors); if (errors.hasErrors()) { throw new CustomBindException(errors); } for (Function b : functions) { b.update(); } } catch (CustomBindException e) { throw new CustomBindException(errors); } return functionRepository.update(functions, requestInfo); }  @Transactional List<Function> create(List<Function> functions, BindingResult errors, RequestInfo requestInfo); @Transactional List<Function> update(List<Function> functions, BindingResult errors, RequestInfo requestInfo); List<Function> fetchRelated(List<Function> functions); Pagination<Function> search(FunctionSearch functionSearch, BindingResult errors); @Transactional Function save(Function function); @Transactional Function update(Function function); }
FunctionService { @Transactional public List<Function> update(List<Function> functions, BindingResult errors, RequestInfo requestInfo) { try { functions = fetchRelated(functions); validate(functions, Constants.ACTION_UPDATE, errors); if (errors.hasErrors()) { throw new CustomBindException(errors); } for (Function b : functions) { b.update(); } } catch (CustomBindException e) { throw new CustomBindException(errors); } return functionRepository.update(functions, requestInfo); }  @Transactional List<Function> create(List<Function> functions, BindingResult errors, RequestInfo requestInfo); @Transactional List<Function> update(List<Function> functions, BindingResult errors, RequestInfo requestInfo); List<Function> fetchRelated(List<Function> functions); Pagination<Function> search(FunctionSearch functionSearch, BindingResult errors); @Transactional Function save(Function function); @Transactional Function update(Function function);  }