@Test public final void testAdd() { when(accountCodePurposeRepository.findById(any(AccountCodePurpose.class))).thenReturn(getAccountCodePurpose()); when(chartOfAccountRepository.findById(any(ChartOfAccount.class))).thenReturn(getChartOfAccount()); when(chartOfAccountRepository.uniqueCheck(any(String.class), any(ChartOfAccount.class))).thenReturn(true); chartOfAccounts.add(getChartOfAccount()); chartOfAccountService.add(chartOfAccounts, errors); }
@Transactional public List<ChartOfAccount> add(List<ChartOfAccount> chartofaccounts, BindingResult errors) { chartofaccounts = fetchRelated(chartofaccounts); validate(chartofaccounts, Constants.ACTION_CREATE, errors); if (errors.hasErrors()) { throw new CustomBindException(errors); } for(ChartOfAccount b:chartofaccounts)b.setId(chartOfAccountRepository.getNextSequence()); return chartofaccounts; }
ChartOfAccountService { @Transactional public List<ChartOfAccount> add(List<ChartOfAccount> chartofaccounts, BindingResult errors) { chartofaccounts = fetchRelated(chartofaccounts); validate(chartofaccounts, Constants.ACTION_CREATE, errors); if (errors.hasErrors()) { throw new CustomBindException(errors); } for(ChartOfAccount b:chartofaccounts)b.setId(chartOfAccountRepository.getNextSequence()); return chartofaccounts; } }
ChartOfAccountService { @Transactional public List<ChartOfAccount> add(List<ChartOfAccount> chartofaccounts, BindingResult errors) { chartofaccounts = fetchRelated(chartofaccounts); validate(chartofaccounts, Constants.ACTION_CREATE, errors); if (errors.hasErrors()) { throw new CustomBindException(errors); } for(ChartOfAccount b:chartofaccounts)b.setId(chartOfAccountRepository.getNextSequence()); return chartofaccounts; }  }
ChartOfAccountService { @Transactional public List<ChartOfAccount> add(List<ChartOfAccount> chartofaccounts, BindingResult errors) { chartofaccounts = fetchRelated(chartofaccounts); validate(chartofaccounts, Constants.ACTION_CREATE, errors); if (errors.hasErrors()) { throw new CustomBindException(errors); } for(ChartOfAccount b:chartofaccounts)b.setId(chartOfAccountRepository.getNextSequence()); return chartofaccounts; }  List<ChartOfAccount> fetchRelated(List<ChartOfAccount> chartofaccounts); @Transactional List<ChartOfAccount> add(List<ChartOfAccount> chartofaccounts, BindingResult errors); @Transactional List<ChartOfAccount> update(List<ChartOfAccount> chartofaccounts, BindingResult errors); void addToQue(ChartOfAccountRequest request); Pagination<ChartOfAccount> search(ChartOfAccountSearch chartOfAccountSearch, BindingResult errors); @Transactional ChartOfAccount save(ChartOfAccount chartOfAccount); @Transactional ChartOfAccount update(ChartOfAccount chartOfAccount); }
ChartOfAccountService { @Transactional public List<ChartOfAccount> add(List<ChartOfAccount> chartofaccounts, BindingResult errors) { chartofaccounts = fetchRelated(chartofaccounts); validate(chartofaccounts, Constants.ACTION_CREATE, errors); if (errors.hasErrors()) { throw new CustomBindException(errors); } for(ChartOfAccount b:chartofaccounts)b.setId(chartOfAccountRepository.getNextSequence()); return chartofaccounts; }  List<ChartOfAccount> fetchRelated(List<ChartOfAccount> chartofaccounts); @Transactional List<ChartOfAccount> add(List<ChartOfAccount> chartofaccounts, BindingResult errors); @Transactional List<ChartOfAccount> update(List<ChartOfAccount> chartofaccounts, BindingResult errors); void addToQue(ChartOfAccountRequest request); Pagination<ChartOfAccount> search(ChartOfAccountSearch chartOfAccountSearch, BindingResult errors); @Transactional ChartOfAccount save(ChartOfAccount chartOfAccount); @Transactional ChartOfAccount update(ChartOfAccount chartOfAccount);  }