@Test public final void test_createinvalid() { Recovery recovery1 = Recovery.builder().name("name").code("code").type("M").mode('M').remittanceMode('M').active(true).build(); recoverys.add(recovery1); when(recoveryRepository.uniqueCheck(any(String.class), any(Recovery.class))).thenReturn(true); recoveryService.create(recoverys, errors, requestInfo); }
@Transactional public List<Recovery> create(List<Recovery> recoveries, BindingResult errors, RequestInfo requestInfo) { try { recoveries = fetchRelated(recoveries); validate(recoveries, Constants.ACTION_CREATE, errors); if (errors.hasErrors()) { throw new CustomBindException(errors); } for (Recovery b : recoveries) { b.setId(recoveryRepository.getNextSequence()); } } catch (CustomBindException e) { throw new CustomBindException(errors); } return recoveryRepository.save(recoveries, requestInfo); }
RecoveryService { @Transactional public List<Recovery> create(List<Recovery> recoveries, BindingResult errors, RequestInfo requestInfo) { try { recoveries = fetchRelated(recoveries); validate(recoveries, Constants.ACTION_CREATE, errors); if (errors.hasErrors()) { throw new CustomBindException(errors); } for (Recovery b : recoveries) { b.setId(recoveryRepository.getNextSequence()); } } catch (CustomBindException e) { throw new CustomBindException(errors); } return recoveryRepository.save(recoveries, requestInfo); } }
RecoveryService { @Transactional public List<Recovery> create(List<Recovery> recoveries, BindingResult errors, RequestInfo requestInfo) { try { recoveries = fetchRelated(recoveries); validate(recoveries, Constants.ACTION_CREATE, errors); if (errors.hasErrors()) { throw new CustomBindException(errors); } for (Recovery b : recoveries) { b.setId(recoveryRepository.getNextSequence()); } } catch (CustomBindException e) { throw new CustomBindException(errors); } return recoveryRepository.save(recoveries, requestInfo); }  }
RecoveryService { @Transactional public List<Recovery> create(List<Recovery> recoveries, BindingResult errors, RequestInfo requestInfo) { try { recoveries = fetchRelated(recoveries); validate(recoveries, Constants.ACTION_CREATE, errors); if (errors.hasErrors()) { throw new CustomBindException(errors); } for (Recovery b : recoveries) { b.setId(recoveryRepository.getNextSequence()); } } catch (CustomBindException e) { throw new CustomBindException(errors); } return recoveryRepository.save(recoveries, requestInfo); }  @Transactional List<Recovery> create(List<Recovery> recoveries, BindingResult errors,
                                 RequestInfo requestInfo); @Transactional List<Recovery> update(List<Recovery> recoveries, BindingResult errors,
                                 RequestInfo requestInfo); List<Recovery> fetchRelated(List<Recovery> recoveries); Pagination<Recovery> search(RecoverySearch recoverySearch, BindingResult errors); @Transactional Recovery save(Recovery recovery); @Transactional Recovery update(Recovery recovery); }
RecoveryService { @Transactional public List<Recovery> create(List<Recovery> recoveries, BindingResult errors, RequestInfo requestInfo) { try { recoveries = fetchRelated(recoveries); validate(recoveries, Constants.ACTION_CREATE, errors); if (errors.hasErrors()) { throw new CustomBindException(errors); } for (Recovery b : recoveries) { b.setId(recoveryRepository.getNextSequence()); } } catch (CustomBindException e) { throw new CustomBindException(errors); } return recoveryRepository.save(recoveries, requestInfo); }  @Transactional List<Recovery> create(List<Recovery> recoveries, BindingResult errors,
                                 RequestInfo requestInfo); @Transactional List<Recovery> update(List<Recovery> recoveries, BindingResult errors,
                                 RequestInfo requestInfo); List<Recovery> fetchRelated(List<Recovery> recoveries); Pagination<Recovery> search(RecoverySearch recoverySearch, BindingResult errors); @Transactional Recovery save(Recovery recovery); @Transactional Recovery update(Recovery recovery);  }