@Test(expected = CustomBindException.class) public final void test_update_with_null_req() { List<VoucherSubType> expextedResult = getVoucherSubTypes(); when(voucherSubTypeRepository.update(any(List.class), any(RequestInfo.class))).thenReturn(expextedResult); List<VoucherSubType> actualResult = voucherSubTypeService.update(null, errors, requestInfo); assertEquals(expextedResult, actualResult); }
@Transactional public List<VoucherSubType> update(List<VoucherSubType> voucherSubTypes, BindingResult errors, RequestInfo requestInfo) { try { voucherSubTypes = fetchRelated(voucherSubTypes); validate(voucherSubTypes, Constants.ACTION_UPDATE, errors); if (errors.hasErrors()) { throw new CustomBindException(errors); } } catch (CustomBindException e) { throw new CustomBindException(errors); } return voucherSubTypeRepository.update(voucherSubTypes, requestInfo); }
VoucherSubTypeService { @Transactional public List<VoucherSubType> update(List<VoucherSubType> voucherSubTypes, BindingResult errors, RequestInfo requestInfo) { try { voucherSubTypes = fetchRelated(voucherSubTypes); validate(voucherSubTypes, Constants.ACTION_UPDATE, errors); if (errors.hasErrors()) { throw new CustomBindException(errors); } } catch (CustomBindException e) { throw new CustomBindException(errors); } return voucherSubTypeRepository.update(voucherSubTypes, requestInfo); } }
VoucherSubTypeService { @Transactional public List<VoucherSubType> update(List<VoucherSubType> voucherSubTypes, BindingResult errors, RequestInfo requestInfo) { try { voucherSubTypes = fetchRelated(voucherSubTypes); validate(voucherSubTypes, Constants.ACTION_UPDATE, errors); if (errors.hasErrors()) { throw new CustomBindException(errors); } } catch (CustomBindException e) { throw new CustomBindException(errors); } return voucherSubTypeRepository.update(voucherSubTypes, requestInfo); } @Autowired  VoucherSubTypeService(
            VoucherSubTypeRepository voucherSubTypeRepository,
            SmartValidator validator); }
VoucherSubTypeService { @Transactional public List<VoucherSubType> update(List<VoucherSubType> voucherSubTypes, BindingResult errors, RequestInfo requestInfo) { try { voucherSubTypes = fetchRelated(voucherSubTypes); validate(voucherSubTypes, Constants.ACTION_UPDATE, errors); if (errors.hasErrors()) { throw new CustomBindException(errors); } } catch (CustomBindException e) { throw new CustomBindException(errors); } return voucherSubTypeRepository.update(voucherSubTypes, requestInfo); } @Autowired  VoucherSubTypeService(
            VoucherSubTypeRepository voucherSubTypeRepository,
            SmartValidator validator); @Transactional List<VoucherSubType> create(List<VoucherSubType> voucherSubTypes,
            BindingResult errors, RequestInfo requestInfo); @Transactional List<VoucherSubType> update(List<VoucherSubType> voucherSubTypes, BindingResult errors, RequestInfo requestInfo); List<VoucherSubType> fetchRelated(
            List<VoucherSubType> voucherSubTypes); @Transactional VoucherSubType save(VoucherSubType voucherSubType); @Transactional VoucherSubType update(VoucherSubType voucherSubType); Pagination<VoucherSubType> search(VoucherSubTypeSearch voucherSubTypeSearch); }
VoucherSubTypeService { @Transactional public List<VoucherSubType> update(List<VoucherSubType> voucherSubTypes, BindingResult errors, RequestInfo requestInfo) { try { voucherSubTypes = fetchRelated(voucherSubTypes); validate(voucherSubTypes, Constants.ACTION_UPDATE, errors); if (errors.hasErrors()) { throw new CustomBindException(errors); } } catch (CustomBindException e) { throw new CustomBindException(errors); } return voucherSubTypeRepository.update(voucherSubTypes, requestInfo); } @Autowired  VoucherSubTypeService(
            VoucherSubTypeRepository voucherSubTypeRepository,
            SmartValidator validator); @Transactional List<VoucherSubType> create(List<VoucherSubType> voucherSubTypes,
            BindingResult errors, RequestInfo requestInfo); @Transactional List<VoucherSubType> update(List<VoucherSubType> voucherSubTypes, BindingResult errors, RequestInfo requestInfo); List<VoucherSubType> fetchRelated(
            List<VoucherSubType> voucherSubTypes); @Transactional VoucherSubType save(VoucherSubType voucherSubType); @Transactional VoucherSubType update(VoucherSubType voucherSubType); Pagination<VoucherSubType> search(VoucherSubTypeSearch voucherSubTypeSearch);  }