@Test(expected = InvalidDataException.class) public final void test_delete_null_id() { List<InstrumentAccountCode> expextedResult = getInstrumentAccountCodes(); expextedResult.get(0).setId(null); when(instrumentAccountCodeRepository.delete(any(List.class), any(RequestInfo.class))) .thenReturn(expextedResult); List<InstrumentAccountCode> actualResult = instrumentAccountCodeService.delete(expextedResult, errors, requestInfo); assertEquals(expextedResult, actualResult); }
@Transactional public List<InstrumentAccountCode> delete(List<InstrumentAccountCode> instrumentAccountCodes, BindingResult errors, RequestInfo requestInfo) { try { validate(instrumentAccountCodes, ACTION_DELETE, errors); if (errors.hasErrors()) throw new CustomBindException(errors); } catch (CustomBindException e) { throw new CustomBindException(errors); } return instrumentAccountCodeRepository.delete(instrumentAccountCodes, requestInfo); }
InstrumentAccountCodeService { @Transactional public List<InstrumentAccountCode> delete(List<InstrumentAccountCode> instrumentAccountCodes, BindingResult errors, RequestInfo requestInfo) { try { validate(instrumentAccountCodes, ACTION_DELETE, errors); if (errors.hasErrors()) throw new CustomBindException(errors); } catch (CustomBindException e) { throw new CustomBindException(errors); } return instrumentAccountCodeRepository.delete(instrumentAccountCodes, requestInfo); } }
InstrumentAccountCodeService { @Transactional public List<InstrumentAccountCode> delete(List<InstrumentAccountCode> instrumentAccountCodes, BindingResult errors, RequestInfo requestInfo) { try { validate(instrumentAccountCodes, ACTION_DELETE, errors); if (errors.hasErrors()) throw new CustomBindException(errors); } catch (CustomBindException e) { throw new CustomBindException(errors); } return instrumentAccountCodeRepository.delete(instrumentAccountCodes, requestInfo); } @Autowired  InstrumentAccountCodeService(SmartValidator validator,
            InstrumentAccountCodeRepository instrumentAccountCodeRepository,
            ChartOfAccountContractRepository chartOfAccountContractRepository,
            InstrumentTypeRepository instrumentTypeRepository); }
InstrumentAccountCodeService { @Transactional public List<InstrumentAccountCode> delete(List<InstrumentAccountCode> instrumentAccountCodes, BindingResult errors, RequestInfo requestInfo) { try { validate(instrumentAccountCodes, ACTION_DELETE, errors); if (errors.hasErrors()) throw new CustomBindException(errors); } catch (CustomBindException e) { throw new CustomBindException(errors); } return instrumentAccountCodeRepository.delete(instrumentAccountCodes, requestInfo); } @Autowired  InstrumentAccountCodeService(SmartValidator validator,
            InstrumentAccountCodeRepository instrumentAccountCodeRepository,
            ChartOfAccountContractRepository chartOfAccountContractRepository,
            InstrumentTypeRepository instrumentTypeRepository); @Transactional List<InstrumentAccountCode> create(List<InstrumentAccountCode> instrumentAccountCodes, BindingResult errors,
            RequestInfo requestInfo); @Transactional List<InstrumentAccountCode> update(List<InstrumentAccountCode> instrumentAccountCodes, BindingResult errors,
            RequestInfo requestInfo); @Transactional List<InstrumentAccountCode> delete(List<InstrumentAccountCode> instrumentAccountCodes, BindingResult errors,
            RequestInfo requestInfo); List<InstrumentAccountCode> fetchRelated(List<InstrumentAccountCode> instrumentaccountcodes, RequestInfo requestInfo); @Transactional InstrumentAccountCode delete(InstrumentAccountCode instrumentAccountCode); Pagination<InstrumentAccountCode> search(InstrumentAccountCodeSearch instrumentAccountCodeSearch); @Transactional InstrumentAccountCode save(InstrumentAccountCode instrumentAccountCode); @Transactional InstrumentAccountCode update(InstrumentAccountCode instrumentAccountCode); }
InstrumentAccountCodeService { @Transactional public List<InstrumentAccountCode> delete(List<InstrumentAccountCode> instrumentAccountCodes, BindingResult errors, RequestInfo requestInfo) { try { validate(instrumentAccountCodes, ACTION_DELETE, errors); if (errors.hasErrors()) throw new CustomBindException(errors); } catch (CustomBindException e) { throw new CustomBindException(errors); } return instrumentAccountCodeRepository.delete(instrumentAccountCodes, requestInfo); } @Autowired  InstrumentAccountCodeService(SmartValidator validator,
            InstrumentAccountCodeRepository instrumentAccountCodeRepository,
            ChartOfAccountContractRepository chartOfAccountContractRepository,
            InstrumentTypeRepository instrumentTypeRepository); @Transactional List<InstrumentAccountCode> create(List<InstrumentAccountCode> instrumentAccountCodes, BindingResult errors,
            RequestInfo requestInfo); @Transactional List<InstrumentAccountCode> update(List<InstrumentAccountCode> instrumentAccountCodes, BindingResult errors,
            RequestInfo requestInfo); @Transactional List<InstrumentAccountCode> delete(List<InstrumentAccountCode> instrumentAccountCodes, BindingResult errors,
            RequestInfo requestInfo); List<InstrumentAccountCode> fetchRelated(List<InstrumentAccountCode> instrumentaccountcodes, RequestInfo requestInfo); @Transactional InstrumentAccountCode delete(InstrumentAccountCode instrumentAccountCode); Pagination<InstrumentAccountCode> search(InstrumentAccountCodeSearch instrumentAccountCodeSearch); @Transactional InstrumentAccountCode save(InstrumentAccountCode instrumentAccountCode); @Transactional InstrumentAccountCode update(InstrumentAccountCode instrumentAccountCode); 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; }