@Test(expected = NotFoundException.class) public void bulkDeleteWithNonExistentIdTest() { doThrow(new EmptyResultDataAccessException(1)).when(customGoalRepo).deleteById(1L); customGoalService.bulkDelete("1"); }
@Transactional @Override public List<Long> bulkDelete(String ids) { List<Long> arrayIds = Arrays .stream(ids.split(",")) .map(Long::valueOf) .collect(Collectors.toList()); List<Long> deleted = new ArrayList<>(); for (Long id : arrayIds) { deleted.add(delete(id)); } return deleted; }
CustomGoalServiceImpl implements CustomGoalService { @Transactional @Override public List<Long> bulkDelete(String ids) { List<Long> arrayIds = Arrays .stream(ids.split(",")) .map(Long::valueOf) .collect(Collectors.toList()); List<Long> deleted = new ArrayList<>(); for (Long id : arrayIds) { deleted.add(delete(id)); } return deleted; } }
CustomGoalServiceImpl implements CustomGoalService { @Transactional @Override public List<Long> bulkDelete(String ids) { List<Long> arrayIds = Arrays .stream(ids.split(",")) .map(Long::valueOf) .collect(Collectors.toList()); List<Long> deleted = new ArrayList<>(); for (Long id : arrayIds) { deleted.add(delete(id)); } return deleted; }  }
CustomGoalServiceImpl implements CustomGoalService { @Transactional @Override public List<Long> bulkDelete(String ids) { List<Long> arrayIds = Arrays .stream(ids.split(",")) .map(Long::valueOf) .collect(Collectors.toList()); List<Long> deleted = new ArrayList<>(); for (Long id : arrayIds) { deleted.add(delete(id)); } return deleted; }  @Transactional @Override List<CustomGoalResponseDto> save(BulkSaveCustomGoalDto bulkSave, User user); @Transactional @Override List<CustomGoalResponseDto> findAll(); @Transactional @Override CustomGoalResponseDto findById(Long id); @Transactional @Override List<CustomGoalResponseDto> updateBulk(BulkCustomGoalDto bulkCustomGoalDto); @Transactional @Override List<CustomGoalResponseDto> findAllByUser(Long userId); @Transactional @Override List<Long> bulkDelete(String ids); }
CustomGoalServiceImpl implements CustomGoalService { @Transactional @Override public List<Long> bulkDelete(String ids) { List<Long> arrayIds = Arrays .stream(ids.split(",")) .map(Long::valueOf) .collect(Collectors.toList()); List<Long> deleted = new ArrayList<>(); for (Long id : arrayIds) { deleted.add(delete(id)); } return deleted; }  @Transactional @Override List<CustomGoalResponseDto> save(BulkSaveCustomGoalDto bulkSave, User user); @Transactional @Override List<CustomGoalResponseDto> findAll(); @Transactional @Override CustomGoalResponseDto findById(Long id); @Transactional @Override List<CustomGoalResponseDto> updateBulk(BulkCustomGoalDto bulkCustomGoalDto); @Transactional @Override List<CustomGoalResponseDto> findAllByUser(Long userId); @Transactional @Override List<Long> bulkDelete(String ids);  }