@Test(expected = InvalidDataException.class) public final void test_update_with_out_kafka_and_with_null_req() { final List<Budget> expextedResult = getBudgets(); when(budgetRepository.update(any(List.class), any(RequestInfo.class))).thenReturn(expextedResult); final List<Budget> actualResult = budgetService.update(null, errors, requestInfo); assertEquals(expextedResult, actualResult); }
@Transactional public List<Budget> update(List<Budget> budgets, final BindingResult errors, final RequestInfo requestInfo) { try { budgets = fetchRelated(budgets,requestInfo); validate(budgets, ACTION_UPDATE, errors); if (errors.hasErrors()) throw new CustomBindException(errors); } catch (final CustomBindException e) { throw new CustomBindException(errors); } return budgetRepository.update(budgets, requestInfo); }
BudgetService { @Transactional public List<Budget> update(List<Budget> budgets, final BindingResult errors, final RequestInfo requestInfo) { try { budgets = fetchRelated(budgets,requestInfo); validate(budgets, ACTION_UPDATE, errors); if (errors.hasErrors()) throw new CustomBindException(errors); } catch (final CustomBindException e) { throw new CustomBindException(errors); } return budgetRepository.update(budgets, requestInfo); } }
BudgetService { @Transactional public List<Budget> update(List<Budget> budgets, final BindingResult errors, final RequestInfo requestInfo) { try { budgets = fetchRelated(budgets,requestInfo); validate(budgets, ACTION_UPDATE, errors); if (errors.hasErrors()) throw new CustomBindException(errors); } catch (final CustomBindException e) { throw new CustomBindException(errors); } return budgetRepository.update(budgets, requestInfo); } @Autowired  BudgetService(final SmartValidator validator, final BudgetRepository budgetRepository,
            final FinancialYearContractRepository financialYearContractRepository); }
BudgetService { @Transactional public List<Budget> update(List<Budget> budgets, final BindingResult errors, final RequestInfo requestInfo) { try { budgets = fetchRelated(budgets,requestInfo); validate(budgets, ACTION_UPDATE, errors); if (errors.hasErrors()) throw new CustomBindException(errors); } catch (final CustomBindException e) { throw new CustomBindException(errors); } return budgetRepository.update(budgets, requestInfo); } @Autowired  BudgetService(final SmartValidator validator, final BudgetRepository budgetRepository,
            final FinancialYearContractRepository financialYearContractRepository); @Transactional List<Budget> create(List<Budget> budgets, final BindingResult errors,
            final RequestInfo requestInfo); @Transactional List<Budget> update(List<Budget> budgets, final BindingResult errors,
            final RequestInfo requestInfo); @Transactional List<Budget> delete(List<Budget> budgets, final BindingResult errors,
            final RequestInfo requestInfo); BindingResult validate(final List<Budget> budgets, final String method, final BindingResult errors); List<Budget> fetchRelated(final List<Budget> budgets,RequestInfo requestInfo); Pagination<Budget> search(final BudgetSearch budgetSearch); @Transactional Budget save(final Budget budget); @Transactional Budget update(final Budget budget); @Transactional Budget delete(Budget budget); }
BudgetService { @Transactional public List<Budget> update(List<Budget> budgets, final BindingResult errors, final RequestInfo requestInfo) { try { budgets = fetchRelated(budgets,requestInfo); validate(budgets, ACTION_UPDATE, errors); if (errors.hasErrors()) throw new CustomBindException(errors); } catch (final CustomBindException e) { throw new CustomBindException(errors); } return budgetRepository.update(budgets, requestInfo); } @Autowired  BudgetService(final SmartValidator validator, final BudgetRepository budgetRepository,
            final FinancialYearContractRepository financialYearContractRepository); @Transactional List<Budget> create(List<Budget> budgets, final BindingResult errors,
            final RequestInfo requestInfo); @Transactional List<Budget> update(List<Budget> budgets, final BindingResult errors,
            final RequestInfo requestInfo); @Transactional List<Budget> delete(List<Budget> budgets, final BindingResult errors,
            final RequestInfo requestInfo); BindingResult validate(final List<Budget> budgets, final String method, final BindingResult errors); List<Budget> fetchRelated(final List<Budget> budgets,RequestInfo requestInfo); Pagination<Budget> search(final BudgetSearch budgetSearch); @Transactional Budget save(final Budget budget); @Transactional Budget update(final Budget budget); @Transactional Budget delete(Budget budget); static final String ACTION_CREATE; static final String ACTION_UPDATE; static final String ACTION_DELETE; static final String ACTION_VIEW; static final String ACTION_EDIT; static final String ACTION_SEARCH; }